diff options
author | ringabout <43030857+ringabout@users.noreply.github.com> | 2023-06-16 18:06:50 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-06-16 12:06:50 +0200 |
commit | 77beb152141f0efe4d5c93b784e42f973ba46551 (patch) | |
tree | b3489ba32952b1dd5a00894face8a05803c0d4a0 /compiler | |
parent | 0750210a508f34e9dcf26a64f4727dfe9ad9c98a (diff) | |
download | Nim-77beb152141f0efe4d5c93b784e42f973ba46551.tar.gz |
fixes #22049; fixes #22054; implicit conversion keeps varness (#22097)
* fixes #22054; codegen for var tuples conv * rethink fixes * add test cases * templates only * fixes var tuples * keep varness no matter what * fixes typ.isNil * make it work for generics * restore isSubrange * add a test case as requested
Diffstat (limited to 'compiler')
-rw-r--r-- | compiler/sigmatch.nim | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index d6740a7e8..5786a320c 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1932,7 +1932,13 @@ proc implicitConv(kind: TNodeKind, f: PType, arg: PNode, m: TCandidate, else: result.typ = errorType(c) else: - result.typ = f.skipTypes({tySink, tyVar}) + result.typ = f.skipTypes({tySink}) + # keep varness + if arg.typ != nil and arg.typ.kind == tyVar: + result.typ = toVar(result.typ, tyVar, c.idgen) + else: + result.typ = result.typ.skipTypes({tyVar}) + if result.typ == nil: internalError(c.graph.config, arg.info, "implicitConv") result.add c.graph.emptyNode result.add arg |