bugfix: semantic checking: tuples without named fields
This commit is contained in:
parent
ce672c19d2
commit
8f41312ca6
2 changed files with 6 additions and 1 deletions
|
|
@ -662,7 +662,7 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode =
|
||||||
check.sons[0] = n
|
check.sons[0] = n
|
||||||
check.typ = n.typ
|
check.typ = n.typ
|
||||||
result = check
|
result = check
|
||||||
elif ty.kind == tyTuple:
|
elif ty.kind == tyTuple and ty.n != nil:
|
||||||
f = getSymFromList(ty.n, i)
|
f = getSymFromList(ty.n, i)
|
||||||
if f != nil:
|
if f != nil:
|
||||||
n.sons[0] = makeDeref(n.sons[0])
|
n.sons[0] = makeDeref(n.sons[0])
|
||||||
|
|
|
||||||
5
tests/reject/twrongtupleaccess.nim
Normal file
5
tests/reject/twrongtupleaccess.nim
Normal file
|
|
@ -0,0 +1,5 @@
|
||||||
|
# Bugfix
|
||||||
|
|
||||||
|
var v = (5.0, 10.0)
|
||||||
|
v.setBLAH(10)
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue