allow typed/untyped in magic procs (#12911)

This commit is contained in:
Timothee Cour 2019-12-17 10:07:32 +00:00 • committed by Andreas Rumpf
commit e8f4586c68
2 changed files with 20 additions and 6 deletions

View file

@ -1,7 +1,15 @@
discard """
errormsg: "'untyped' is only allowed in templates and macros"
line: 6
errormsg: "'untyped' is only allowed in templates and macros or magic procs"
line: 14
"""
# magic procs are allowed with `untyped`
proc declaredInScope2*(x: untyped): bool {.magic: "DefinedInScope", noSideEffect, compileTime.}
proc bar(): bool =
var x = 1
declaredInScope2(x)
static: doAssert bar()
# but not non-magic procs
proc fun(x:untyped)=discard
fun(10)