fixes #2993
This commit is contained in:
parent
30829ffec4
commit
b159fc3b34
2 changed files with 12 additions and 6 deletions
|
|
@ -158,15 +158,11 @@ proc sumGeneric(t: PType): int =
|
||||||
t = t.sons[0]
|
t = t.sons[0]
|
||||||
inc result
|
inc result
|
||||||
inc isvar
|
inc isvar
|
||||||
of tyTypeDesc:
|
|
||||||
t = t.lastSon
|
|
||||||
if t.kind == tyEmpty: break
|
|
||||||
inc result
|
|
||||||
of tyGenericInvocation, tyTuple:
|
of tyGenericInvocation, tyTuple:
|
||||||
result += ord(t.kind == tyGenericInvocation)
|
result += ord(t.kind == tyGenericInvocation)
|
||||||
for i in 0 .. <t.len: result += t.sons[i].sumGeneric
|
for i in 0 .. <t.len: result += t.sons[i].sumGeneric
|
||||||
break
|
break
|
||||||
of tyGenericParam, tyExpr, tyStatic, tyStmt: break
|
of tyGenericParam, tyExpr, tyStatic, tyStmt, tyTypeDesc: break
|
||||||
of tyBool, tyChar, tyEnum, tyObject, tyProc, tyPointer,
|
of tyBool, tyChar, tyEnum, tyObject, tyProc, tyPointer,
|
||||||
tyString, tyCString, tyInt..tyInt64, tyFloat..tyFloat128,
|
tyString, tyCString, tyInt..tyInt64, tyFloat..tyFloat128,
|
||||||
tyUInt..tyUInt64:
|
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].sons[1] = prepareOperand(c, formal.typ, n.sons[a].sons[1])
|
||||||
n.sons[a].typ = n.sons[a].sons[1].typ
|
n.sons[a].typ = n.sons[a].sons[1].typ
|
||||||
var arg = paramTypesMatch(m, formal.typ, n.sons[a].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:
|
if arg == nil:
|
||||||
m.state = csNoMatch
|
m.state = csNoMatch
|
||||||
return
|
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
|
||||||
Loading…
Add table
Add a link
Reference in a new issue