Skip to content

compiler crash on simple macro #7093

@krux02

Description

@krux02
import macros

macro foobar(arg: untyped): untyped =
  let procDef = quote do:
    proc foo(): void =
      echo "bar"

  result = newStmtList(
    arg, procDef
  )

  echo result.repr

iterator bar(): int {.foobar.} =
  discard

compilation log:

nim c -r bug2.nim
Hint: used config file '/local/doering/Nim/config/nim.cfg' [Conf]
Hint: system [Processing]
Hint: bug2 [Processing]
Hint: macros [Processing]

iterator bar(): int =
  discard

proc foo(): void =
  echo "bar"

nim.nim(121)             nim
nim.nim(77)              handleCmdLine
main.nim(172)            mainCommand
main.nim(77)             commandCompileToC
modules.nim(240)         compileProject
modules.nim(180)         compileModule
passes.nim(218)          processModule
passes.nim(136)          processTopLevelStmt
sem.nim(571)             myProcess
sem.nim(539)             semStmtAndGenerateGenerics
semstmts.nim(1896)       semStmt
semexprs.nim(793)        semExprNoType
semexprs.nim(2371)       semExpr
semstmts.nim(1635)       semIterator
system.nim(2833)         sysFatal
Error: unhandled exception: sym is not accessible [FieldError]

nim-compile exited abnormally with code 1 at Tue Jan 16 18:23:19

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions