Files
Nim/tests/converter/tgenericconverterbindings2.nim
metagn 334f96c05a isolate and rematch generic converters to get bindings (#24867)
fixes #4554, fixes #10900, fixes #13843, fixes #19471, fixes #19517

Instead of matching generic converters to their arguments using the full
call match bindings, a new match is created for them (from which the
bindings are used to instantiate the converter return type). Then when
instantiating generic converters, they are matched to their argument
again to get their bindings again instead of using the call bindings.
This prevents generic converters which match more than once from
interfering with each other's bindings.
2025-04-12 17:53:18 +02:00

11 lines
243 B
Nim

# issue #4554 comment
type Obj[T] = object
b: T
converter test1[T](a: Obj[T]): T = a.b
proc doStuff(a: int, b: float) = discard
doStuff(Obj[int](b: 1), Obj[float](b: 1.2)) # Error: type mismatch: got <Obj[system.int], Obj[system.float]>