Files
Nim/tests/pragmas/tinvalidcustompragma.nim
metagn c694d8e4fd custom pragmas: correct error condition, remove outdated symkind whitelist (#21653)
* test not restricting custom pragma applied symbols

fixes #21652

* fix other test

* different patch

* fix tests

* actually test #18212 and other routines
2023-04-13 12:50:43 +02:00

24 lines
851 B
Nim

discard """
cmd: "nim check $file"
"""
# issue #21652
type Foo = object
template foo() {.tags:[Foo].} = #[tt.Error
^ invalid pragma: tags: [Foo]]#
discard
{.foobar.} #[tt.Error
^ invalid pragma: foobar]#
type A = enum a {.foobar.} #[tt.Error
^ invalid pragma: foobar]#
for b {.foobar.} in [1]: discard #[tt.Error
^ invalid pragma: foobar]#
template foobar {.pragma.}
{.foobar.} #[tt.Error
^ cannot attach a custom pragma to 'tinvalidcustompragma'; custom pragmas are not supported for modules]#
type A = enum a {.foobar.} #[tt.Error
^ cannot attach a custom pragma to 'a'; custom pragmas are not supported for enum fields]#
for b {.foobar.} in [1]: discard #[tt.Error
^ cannot attach a custom pragma to 'b'; custom pragmas are not supported for `for` loop variables]#