Files
Nim/tests/objects/tobjconstr_msgs.nim
Jake Leahy 6bc52737b3 Make 'field is not accessible' and 'field initialized twice' errors point to the field inside the obj construction (#24557)
Fixes two line infos to make the error's clearer inside editors

- 'field is not accessible' would point to the whole object construction
instead of just the field inside the construction
- 'field initialized twice' would point to the colon instead of the
field
2024-12-22 14:25:36 +01:00

24 lines
334 B
Nim

discard """
cmd: "nim check $file"
"""
import mobjconstr_msgs
block:
discard PrivateField(
priv: "test" #[tt.Error
^ the field 'priv' is not accessible]#
)
block:
type
Foo = object
field: string
discard Foo(
field: "test",
field: "test" #[tt.Error
^ field initialized twice: 'field']#
)