forked from nim-lang/Nim
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make 'field is not accessible' and 'field initialized twice' errors p…
…oint to the field inside the obj construction (nim-lang#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
- Loading branch information
1 parent
f29234b
commit 6bc5273
Showing
3 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
type | ||
PrivateField* = object | ||
priv: string |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
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']# | ||
) |