diff options
author | Araq <rumpf_a@web.de> | 2014-02-25 01:06:35 +0100 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2014-02-25 01:06:35 +0100 |
commit | 10768904eb65da1899d0d48cc1a2f3547af3bef0 (patch) | |
tree | 79676143be1663cacdbb5a8790451fde4e7366bc /compiler/semstmts.nim | |
parent | ab72377ce64cf2b563ea90204925b793082971cb (diff) | |
parent | e6b0b7ecc9bb81d94eec19fbc4fc62e104f59253 (diff) | |
download | Nim-10768904eb65da1899d0d48cc1a2f3547af3bef0.tar.gz |
Merge branch 'devel' of https://github.com/Araq/Nimrod into devel
Conflicts: lib/system/jssys.nim
Diffstat (limited to 'compiler/semstmts.nim')
-rw-r--r-- | compiler/semstmts.nim | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/compiler/semstmts.nim b/compiler/semstmts.nim index 503ea4bc1..6c4e29f29 100644 --- a/compiler/semstmts.nim +++ b/compiler/semstmts.nim @@ -143,10 +143,11 @@ proc discardCheck(c: PContext, result: PNode) = while n.kind in skipForDiscardable: n = n.lastSon n.typ = nil - elif c.inTypeClass > 0 and result.typ.kind == tyBool: - let verdict = semConstExpr(c, result) - if verdict.intVal == 0: - localError(result.info, "type class predicate failed") + elif c.inTypeClass > 0: + if result.typ.kind == tyBool: + let verdict = semConstExpr(c, result) + if verdict.intVal == 0: + localError(result.info, "type class predicate failed") elif result.typ.kind != tyError and gCmd != cmdInteractive: if result.typ.kind == tyNil: fixNilType(result) @@ -349,7 +350,12 @@ proc semVarOrLet(c: PContext, n: PNode, symkind: TSymKind): PNode = # BUGFIX: ``fitNode`` is needed here! # check type compability between def.typ and typ: if typ != nil: def = fitNode(c, typ, def) - else: typ = skipIntLit(def.typ) + else: + typ = skipIntLit(def.typ) + if typ.kind in {tySequence, tyArray, tySet} and + typ.lastSon.kind == tyEmpty: + localError(def.info, errCannotInferTypeOfTheLiteral, + ($typ.kind).substr(2).toLower) else: def = ast.emptyNode if symkind == skLet: localError(a.info, errLetNeedsInit) |