summary refs log tree commit diff stats
path: root/compiler
diff options
context:
space:
mode:
authorJason Beetham <beefers331@gmail.com>2021-09-11 05:05:53 -0600
committerGitHub <noreply@github.com>2021-09-11 13:05:53 +0200
commit66e53bdd7b465edd9045314d4d6a60ef6e0b5e32 (patch)
tree1b1f5a032f8a558d09f0e100bbf7c86fab6e2b3f /compiler
parent1f68f71ec24d3ec6b8e83411a6f1604277f9d493 (diff)
downloadNim-66e53bdd7b465edd9045314d4d6a60ef6e0b5e32.tar.gz
Fixed type inference for 'set` and 'tuple' (#18827)
* improved built in typeclass inference

* Smarter logic to fit node

* Forgot the untyped check
Diffstat (limited to 'compiler')
-rw-r--r--compiler/sem.nim3
1 files changed, 2 insertions, 1 deletions
diff --git a/compiler/sem.nim b/compiler/sem.nim
index ad0ba1f7c..bdecbe602 100644
--- a/compiler/sem.nim
+++ b/compiler/sem.nim
@@ -77,7 +77,8 @@ template semIdeForTemplateOrGeneric(c: PContext; n: PNode;
 
 proc fitNodePostMatch(c: PContext, formal: PType, arg: PNode): PNode =
   let x = arg.skipConv
-  if x.kind in {nkPar, nkTupleConstr, nkCurly} and formal.kind != tyUntyped:
+  if (x.kind == nkCurly and formal.kind == tySet and formal.base.kind != tyGenericParam) or
+    (x.kind in {nkPar, nkTupleConstr}) and formal.kind notin {tyUntyped, tyBuiltInTypeClass}:
     changeType(c, x, formal, check=true)
   result = arg
   result = skipHiddenSubConv(result, c.graph, c.idgen)