diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 0393d8ec65398..9cb7b0c4a3670 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1777,6 +1777,9 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, result = isGeneric elif concpt.kind == tyConcept: result = enterConceptMatch(c, f, x, flags) + elif x.kind == tyGenericBody and f[0] == x: + # not specific enough + result = isNone else: let genericBody = f[0] var askip = skippedNone diff --git a/testament/important_packages.nim b/testament/important_packages.nim index 2471a2d113186..ed5344fe27f00 100644 --- a/testament/important_packages.nim +++ b/testament/important_packages.nim @@ -35,7 +35,9 @@ proc pkg(name: string; cmd = "nimble test -l"; url = "", useHead = true, allowFa pkg "alea" pkg "argparse" -pkg "arraymancer", "nimble install -y; nimble uninstall -i -y nimcuda; nimble install nimcuda@0.2.1; nim c tests/tests_cpu.nim" +pkg "arraymancer", "nimble install -y; nimble uninstall -i -y nimcuda; nimble install nimcuda@0.2.1; nim c tests/tests_cpu.nim", + # remove when https://github.com/mratsim/Arraymancer/pull/674 is merged + url = "https://github.com/metagn/Arraymancer" pkg "ast_pattern_matching", "nim c -r tests/test1.nim" pkg "asyncftpclient", "nimble compileExample" pkg "asyncthreadpool", "nimble test --mm:refc" diff --git a/tests/generics/tgenerics_issues.nim b/tests/generics/tgenerics_issues.nim index 3068a22f25be2..2cda8d3b518ad 100644 --- a/tests/generics/tgenerics_issues.nim +++ b/tests/generics/tgenerics_issues.nim @@ -741,7 +741,8 @@ block t1684: block t5632: type Option[T] = object - proc point[A](v: A, t: typedesc[Option[A]]): Option[A] = + # original issue test uses Option[A] instead + proc point[A](v: A, t: typedesc[Option]): Option[A] = discard discard point(1, Option) diff --git a/tests/overload/tgenericbodymatch.nim b/tests/overload/tgenericbodymatch.nim new file mode 100644 index 0000000000000..2dd3e79c10997 --- /dev/null +++ b/tests/overload/tgenericbodymatch.nim @@ -0,0 +1,13 @@ +# issue #24688 + +type + R[T, E] = object + A = object + B = object + +# Remove this overload to make it work +func err[T](_: type R[T, void]): R[T, void] = discard + +func err(_: type R): R[A, B] = discard + +discard R.err()