Files
Nim/tests/pragmas/tinvalid_user_pragma.nim
Jake Leahy 4fdc6c49bd Don't process a user pragma if its invalid (#23041)
When running `check`/`suggest` in a file with an invalid user pragma
like
```nim
{.pragma foo: test.}
```
It will continue to try and process it which leads to the compiler
running into a `FieldDefect`
```
fatal.nim(53)            sysFatal
Error: unhandled exception: field 'sons' is not accessible for type 'TNode' using 'kind = nkIdent' [FieldDefect]
```
This makes it instead bail out trying to process the user pragma if its
invalid
2023-12-07 08:14:23 +01:00

10 lines
178 B
Nim

discard """
cmd: "nim check $file"
"""
{.pragma test: foo.} #[tt.Error
^ invalid pragma: {.pragma, test: foo.} ]#
{.pragma: 1.} #[tt.Error
^ invalid pragma: {.pragma: 1.} ]#