diff options
author | Andreas Rumpf <rumpf_a@web.de> | 2016-07-29 00:58:39 +0200 |
---|---|---|
committer | Andreas Rumpf <rumpf_a@web.de> | 2016-07-29 01:00:25 +0200 |
commit | 1ddd2a3865cbea7378a1f14575ea49766a54c0ab (patch) | |
tree | a20ec2028d71decdd9bf378cd40992c54d6ce136 /compiler | |
parent | ce91a1b25db6e121cfe1f5ce3e5f4d61c80361e7 (diff) | |
download | Nim-1ddd2a3865cbea7378a1f14575ea49766a54c0ab.tar.gz |
fixes #4432
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/semexprs.nim | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index 9f0696252..d76bd791e 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -191,10 +191,6 @@ proc semConv(c: PContext, n: PNode): PNode = case status of convOK: # handle SomeProcType(SomeGenericProc) - # XXX: This needs fixing. checkConvertible uses typeRel internally, but - # doesn't bother to perform the work done in paramTypeMatchAux/fitNode - # so we are redoing the typeRel work here. Why does semConv exist as a - # separate proc from fitNode? if op.kind == nkSym and op.sym.isGenericRoutine: result.sons[1] = fitNode(c, result.typ, result.sons[1]) elif op.kind == nkPar and targetType.kind == tyTuple: @@ -202,8 +198,10 @@ proc semConv(c: PContext, n: PNode): PNode = of convNotNeedeed: message(n.info, hintConvFromXtoItselfNotNeeded, result.typ.typeToString) of convNotLegal: - localError(n.info, errGenerated, msgKindToString(errIllegalConvFromXtoY)% - [op.typ.typeToString, result.typ.typeToString]) + result = fitNode(c, result.typ, result.sons[1]) + if result == nil: + localError(n.info, errGenerated, msgKindToString(errIllegalConvFromXtoY)% + [op.typ.typeToString, result.typ.typeToString]) else: for i in countup(0, sonsLen(op) - 1): let it = op.sons[i] |