#23172

(cherry picked from commit a4f3bf3742)
This commit is contained in:
Ryan McConnell
2024-01-06 05:50:09 +00:00
committed by narimiran
parent 2ed16bf2d4
commit 4886534ed3
3 changed files with 16 additions and 1 deletions

View File

@@ -1711,7 +1711,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType,
if tfExplicitCallConv in target.flags and
target.callConv != effectiveArgType.callConv:
return isNone
put(c, f, a)
if doBind: put(c, f, a)
return isGeneric
else:
return isNone

View File

@@ -0,0 +1,6 @@
type
Foo* = object
Bar* = object
func `$`*(x: Foo | Bar): string =
"X"

9
tests/lookups/t23172.nim Normal file
View File

@@ -0,0 +1,9 @@
import issue_23172/m23172
type FooX = distinct Foo
func `$`*(x: FooX): string =
$m23172.Foo(x)
var a: FooX
doAssert $a == "X"