Skip to content

UndefVarError due to invalid macro lookup in nested expansion #121

@topolarity

Description

@topolarity

Possibly related to #120:

$ JULIA_USE_FLISP_LOWERING=0 ./julia -e 'GC.@preserve @static if true println(@__MODULE__) else end'
┌ Info: JuliaLowering threw given input:
│   code =
│    :(#= none:1 =# GC.@preserve #= none:1 =# @static(if true#= none:1 =#println(#= none:1 =# @__MODULE__())
│              else#= none:1 =#end))
│   st0 =
│    SyntaxTree with attributes toplevel_pure,kind,value,var_id,name_val,syntax_flags,is_toplevel_thunk,meta,source,scope_layer
│    [macrocall]                                                  │
│      [.]                                                        │
│        GC                                   :: Identifier       │
│        [macro_name]                                             │
│          preserve                           :: Identifier       │
│      [macrocall]                                                │
│        [macro_name]                                             │
│          static                             :: Identifier       │
│        [if]                                                     │
│          true                               :: Bool             │
│          [block]                                                │
│            [call]                                               │
│              println                        :: Identifier       │
│              [macrocall]                                        │
│                [macro_name]                                     │
│                  __MODULE__                 :: Identifier       │
│          [block]                                                │
│
│   file = "none"
│   line = 1
└   mod = MainERROR: MacroExpansionError while expanding $(Expr(:scope_layer, :__MODULE__, 1)) in module Base.JuliaLowering:
#= none:1 =# - Macro not found
Caused by:
UndefVarError: `__MODULE__` not defined in `Main`

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions