diff options
author | Charles Blake <cblake@csail.mit.edu> | 2015-02-14 14:26:16 -0500 |
---|---|---|
committer | Charles Blake <cblake@csail.mit.edu> | 2015-02-14 14:26:16 -0500 |
commit | 62067954640619fb328d343c641109a5f8fac80c (patch) | |
tree | 91a1da12059a23476ddf44bb1a0b8d36b6aa9ba3 | |
parent | 5068a5aa016fef0b65c7cd6af27eeeefda0e5c95 (diff) | |
parent | ece23d39bce679be75da10e0e6b6fcf1814dca49 (diff) | |
download | Nim-62067954640619fb328d343c641109a5f8fac80c.tar.gz |
Merge ../Nim into devel
-rw-r--r-- | compiler/ccgstmts.nim | 2 | ||||
-rw-r--r-- | compiler/parser.nim | 1 | ||||
-rw-r--r-- | tests/parser/twhen_in_enum.nim | 11 | ||||
-rw-r--r-- | tests/tuples/tgeneric_tuple.nim | 9 |
4 files changed, 22 insertions, 1 deletions
diff --git a/compiler/ccgstmts.nim b/compiler/ccgstmts.nim index 18705c974..61568c9e6 100644 --- a/compiler/ccgstmts.nim +++ b/compiler/ccgstmts.nim @@ -48,7 +48,7 @@ proc genVarTuple(p: BProc, n: PNode) = return genLineDir(p, n) initLocExpr(p, n.sons[L-1], tup) - var t = tup.t + var t = tup.t.getUniqueType for i in countup(0, L-3): var v = n.sons[i].sym if sfCompileTime in v.flags: continue diff --git a/compiler/parser.nim b/compiler/parser.nim index f249b37c8..8fbf033d8 100644 --- a/compiler/parser.nim +++ b/compiler/parser.nim @@ -1597,6 +1597,7 @@ proc parseEnum(p: var TParser): PNode = optInd(p, result) while true: var a = parseSymbol(p) + if a.kind == nkEmpty: return if p.tok.indent >= 0 and p.tok.indent <= p.currInd: add(result, a) break diff --git a/tests/parser/twhen_in_enum.nim b/tests/parser/twhen_in_enum.nim new file mode 100644 index 000000000..d4a3ea56a --- /dev/null +++ b/tests/parser/twhen_in_enum.nim @@ -0,0 +1,11 @@ +discard """ + errormsg: "identifier expected, but found 'keyword when'" +""" + +# bug #2123 +type num = enum + NUM_NONE = 0 + NUM_ALL = 1 + when defined(macosx): NUM_OSX = 10 # only this differs for real + NUM_XTRA = 20 + diff --git a/tests/tuples/tgeneric_tuple.nim b/tests/tuples/tgeneric_tuple.nim new file mode 100644 index 000000000..32f081596 --- /dev/null +++ b/tests/tuples/tgeneric_tuple.nim @@ -0,0 +1,9 @@ +# bug #2121 + +type + Item[K,V] = tuple + key: K + value: V + +var q = newseq[Item[int,int]](0) +let (x,y) = q[0] |