diff options
author | Araq <rumpf_a@web.de> | 2011-01-06 00:33:56 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2011-01-06 00:33:56 +0100 |
commit | 8f41312ca685faa91a950bfce866301631d0e2a9 (patch) | |
tree | d1aeb6d83f208e571cfc8c16d2508c6f58cc7c5d | |
parent | ce672c19d245827f8809dc1c914f42003cb56bdc (diff) | |
download | Nim-8f41312ca685faa91a950bfce866301631d0e2a9.tar.gz |
bugfix: semantic checking: tuples without named fields
-rwxr-xr-x | rod/semexprs.nim | 2 | ||||
-rw-r--r-- | tests/reject/twrongtupleaccess.nim | 5 |
2 files changed, 6 insertions, 1 deletions
diff --git a/rod/semexprs.nim b/rod/semexprs.nim index 6ce1628d5..10ed6567e 100755 --- a/rod/semexprs.nim +++ b/rod/semexprs.nim @@ -662,7 +662,7 @@ proc builtinFieldAccess(c: PContext, n: PNode, flags: TExprFlags): PNode = check.sons[0] = n check.typ = n.typ result = check - elif ty.kind == tyTuple: + elif ty.kind == tyTuple and ty.n != nil: f = getSymFromList(ty.n, i) if f != nil: n.sons[0] = makeDeref(n.sons[0]) diff --git a/tests/reject/twrongtupleaccess.nim b/tests/reject/twrongtupleaccess.nim new file mode 100644 index 000000000..f706e267c --- /dev/null +++ b/tests/reject/twrongtupleaccess.nim @@ -0,0 +1,5 @@ +# Bugfix + +var v = (5.0, 10.0) +v.setBLAH(10) + |