From bd32dab5614965526d55abc7375303781775c4e6 Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 10 Sep 2026 08:49:43 +0200 Subject: [PATCH] concepts: fix generic concept devaluation skipped in typeRel (#26164) Fix and tests for issues #26147 case A. See individual commit messages. Checked on the full test suite: no new failure with respect to devel as baseline. --- compiler/sigmatch.nim | 8 ++-- tests/concepts/t26147.nim | 18 ++++++++ tests/concepts/tconcept_overload_priority.nim | 46 +++++++++++++++++++ 3 files changed, 69 insertions(+), 3 deletions(-) create mode 100644 tests/concepts/tconcept_overload_priority.nim diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index 16d0057c36..3e9483c24c 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1805,7 +1805,11 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, let inst = prepareMetatypeForSigmatch(c.c, c.bindings, c.call.info, f) return typeRel(c, inst, a, flags) - if x.kind == tyGenericInvocation: + if concpt.kind == tyConcept: + # Concept dispatch devaluates generic concepts, + # so it must precede the generic invocation case + result = enterConceptMatch(c, f, x, flags) + elif x.kind == tyGenericInvocation: if f[0] == x[0]: for i in 1..