Skip to content

[Regression] Generic converter not matched against subclass #25014

@yglukhov

Description

@yglukhov

Nim Version

Nim Compiler Version 2.3.1 [Linux: amd64]
Compiled at 2025-06-25
Copyright (c) 2006-2025 by Andreas Rumpf

git hash: 334848f
active boot switches: -d:release

Description

type
  FooBase[T] {.inheritable.} = object
    val: T
  FooChild[T] = object of FooBase[T]

converter toValue*[T](r: FooBase[T]): T = r.val

proc foo(a: int) = discard
var f: FooChild[int]
foo(f)

Current Output

.../test.nim(10, 5) template/generic instantiation from here
.../test.nim(6, 20) Error: cannot instantiate: 'T'

Expected Output

No compilation errors

Known Workarounds

No response

Additional Information

Regression introduced in #24867. CC @metagn

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions