mirror of
https://github.com/nim-lang/Nim.git
synced 2026-04-19 14:00:35 +00:00
fixes #2993
This commit is contained in:
@@ -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
|
||||
|
||||
10
tests/namedparams/tnamedparams3.nim
Normal file
10
tests/namedparams/tnamedparams3.nim
Normal file
@@ -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
|
||||
Reference in New Issue
Block a user