fixes #17437 - crash where error reporting > 1 (#17547)

* fixes #17437

* Fix bug reference comment

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>

* [skip ci] describe why we have hasError

Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
This commit is contained in:
Saem Ghani
2021-03-29 03:48:00 -07:00
committed by GitHub
parent 8b26b3ad0d
commit c6dc9c0255
2 changed files with 34 additions and 4 deletions

22
tests/objects/t17437.nim Normal file
View File

@@ -0,0 +1,22 @@
discard """
cmd: "nim check $file"
errormsg: ""
nimout: '''
t17437.nim(20, 16) Error: undeclared identifier: 'x'
t17437.nim(20, 16) Error: expression 'x' has no type (or is ambiguous)
t17437.nim(20, 19) Error: incorrect object construction syntax
t17437.nim(20, 19) Error: incorrect object construction syntax
t17437.nim(20, 12) Error: expression '' has no type (or is ambiguous)
'''
"""
# bug #17437 invalid object construction should result in error
type
V = ref object
x, y: int
proc m =
var v = V(x: x, y)
m()