diff options
author | Zahary Karadjov <zahary@gmail.com> | 2014-02-11 01:14:57 +0200 |
---|---|---|
committer | Zahary Karadjov <zahary@gmail.com> | 2014-02-11 01:14:57 +0200 |
commit | a158053ae9d04ebd882b2c973ddf4a3dd7d4efe8 (patch) | |
tree | e0603a6329810239e51587546e0ba6a59a1f484f /compiler/semexprs.nim | |
parent | e8c87d070a4fa507208a042e9f02b356eaa567ad (diff) | |
download | Nim-a158053ae9d04ebd882b2c973ddf4a3dd7d4efe8.tar.gz |
fixes #797; generic procs can be used in places expecting matching concrete proc types
Diffstat (limited to 'compiler/semexprs.nim')
-rw-r--r-- | compiler/semexprs.nim | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/compiler/semexprs.nim b/compiler/semexprs.nim index a8a16672d..3fe1367ec 100644 --- a/compiler/semexprs.nim +++ b/compiler/semexprs.nim @@ -204,7 +204,14 @@ proc semConv(c: PContext, n: PNode): PNode = if not isSymChoice(op): let status = checkConvertible(c, result.typ, op.typ) case status - of convOK: discard + 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]) of convNotNeedeed: message(n.info, hintConvFromXtoItselfNotNeeded, result.typ.typeToString) of convNotLegal: |