fixes #3212
This commit is contained in:
parent
0aa908c86c
commit
1251fc76c3
1 changed files with 3 additions and 3 deletions
|
|
@ -452,18 +452,18 @@ proc changeType(n: PNode, newType: PType, check: bool) =
|
||||||
let tup = newType.skipTypes({tyGenericInst})
|
let tup = newType.skipTypes({tyGenericInst})
|
||||||
if tup.kind != tyTuple:
|
if tup.kind != tyTuple:
|
||||||
if tup.kind == tyObject: return
|
if tup.kind == tyObject: return
|
||||||
internalError(n.info, "changeType: no tuple type for constructor")
|
globalError(n.info, "no tuple type for constructor")
|
||||||
elif sonsLen(n) > 0 and n.sons[0].kind == nkExprColonExpr:
|
elif sonsLen(n) > 0 and n.sons[0].kind == nkExprColonExpr:
|
||||||
# named tuple?
|
# named tuple?
|
||||||
for i in countup(0, sonsLen(n) - 1):
|
for i in countup(0, sonsLen(n) - 1):
|
||||||
var m = n.sons[i].sons[0]
|
var m = n.sons[i].sons[0]
|
||||||
if m.kind != nkSym:
|
if m.kind != nkSym:
|
||||||
internalError(m.info, "changeType(): invalid tuple constr")
|
globalError(m.info, "invalid tuple constructor")
|
||||||
return
|
return
|
||||||
if tup.n != nil:
|
if tup.n != nil:
|
||||||
var f = getSymFromList(tup.n, m.sym.name)
|
var f = getSymFromList(tup.n, m.sym.name)
|
||||||
if f == nil:
|
if f == nil:
|
||||||
internalError(m.info, "changeType(): invalid identifier")
|
globalError(m.info, "unknown identifier: " & m.sym.name.s)
|
||||||
return
|
return
|
||||||
changeType(n.sons[i].sons[1], f.typ, check)
|
changeType(n.sons[i].sons[1], f.typ, check)
|
||||||
else:
|
else:
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue