diff options
author | Araq <rumpf_a@web.de> | 2015-07-01 17:42:12 +0200 |
---|---|---|
committer | Araq <rumpf_a@web.de> | 2015-07-01 17:42:12 +0200 |
commit | b159fc3b349573114ac990f52d5c3e10684f6a91 (patch) | |
tree | 5e680db32a9359f4aece31298479f13a6dc86dd4 | |
parent | 30829ffec41dd7c4e024e506f45404f9038bb9b3 (diff) | |
download | Nim-b159fc3b349573114ac990f52d5c3e10684f6a91.tar.gz |
fixes #2993
-rw-r--r-- | compiler/sigmatch.nim | 8 | ||||
-rw-r--r-- | tests/namedparams/tnamedparams3.nim | 10 |
2 files changed, 12 insertions, 6 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 97a059dbe..88a2155dc 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -158,15 +158,11 @@ proc sumGeneric(t: PType): int = t = t.sons[0] inc result inc isvar - of tyTypeDesc: - t = t.lastSon - if t.kind == tyEmpty: break - inc result of tyGenericInvocation, tyTuple: result += ord(t.kind == tyGenericInvocation) for i in 0 .. <t.len: result += t.sons[i].sumGeneric break - of tyGenericParam, tyExpr, tyStatic, tyStmt: break + of tyGenericParam, tyExpr, tyStatic, tyStmt, tyTypeDesc: break of tyBool, tyChar, tyEnum, tyObject, tyProc, tyPointer, tyString, tyCString, tyInt..tyInt64, tyFloat..tyFloat128, tyUInt..tyUInt64: @@ -1522,7 +1518,7 @@ proc matchesAux(c: PContext, n, nOrig: PNode, n.sons[a].sons[1] = prepareOperand(c, formal.typ, n.sons[a].sons[1]) n.sons[a].typ = n.sons[a].sons[1].typ var arg = paramTypesMatch(m, formal.typ, n.sons[a].typ, - n.sons[a].sons[1], nOrig.sons[a].sons[1]) + n.sons[a].sons[1], n.sons[a].sons[1]) if arg == nil: m.state = csNoMatch return diff --git a/tests/namedparams/tnamedparams3.nim b/tests/namedparams/tnamedparams3.nim new file mode 100644 index 000000000..d9c79bf98 --- /dev/null +++ b/tests/namedparams/tnamedparams3.nim @@ -0,0 +1,10 @@ +discard """ + errormsg: "type mismatch: got (int literal(5), b: bool)" + line: 10 +""" + +# bug #2993 +proc test(i: int, a, b: bool) = discard +#test(5, b = false) #Missing param a + +5.test(b = false) #Missing param a |