From a20ff29873290d7f0b72ecaeb52d97f7bf598306 Mon Sep 17 00:00:00 2001 From: metagn Date: Wed, 2 Oct 2024 21:29:16 +0300 Subject: [PATCH] test fix --- compiler/sigmatch.nim | 5 ++--- tests/overload/torconv.nim | 5 +++++ 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/compiler/sigmatch.nim b/compiler/sigmatch.nim index f271c1f879f5..793a4744fb51 100644 --- a/compiler/sigmatch.nim +++ b/compiler/sigmatch.nim @@ -1971,9 +1971,8 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, if f.len > 0 and f[0].kind != tyNone: c.bindings = newTypeMapLayer(c.bindings) result = typeRel(c, f[0], a, flags + {trBindGenericParam}) - if result == isGeneric: - bound = lookup(c.bindings, f[0]) - else: + bound = lookup(c.bindings, f[0]) + if bound == nil and result != isGeneric: bound = f[0] setToPreviousLayer(c.bindings) if doBindGP and result notin {isNone, isGeneric}: diff --git a/tests/overload/torconv.nim b/tests/overload/torconv.nim index 8a70ef580062..2ee4c6329463 100644 --- a/tests/overload/torconv.nim +++ b/tests/overload/torconv.nim @@ -57,3 +57,8 @@ block: # issue #15721, set block: # issue #21331 let a : int8 | uint8 = 3 doAssert sizeof(a)==sizeof(int8) # this fails + +block: + let x: range[0..5] = 1 + proc foo[T: SomeInteger](x: T): string = $typeof(x) + discard foo(x)