allow typed/untyped in magic procs (#12911)
This commit is contained in:
parent
e5ed4c1b7d
commit
e8f4586c68
2 changed files with 20 additions and 6 deletions
|
|
@ -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)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue