mirror of
https://github.com/nim-lang/Nim.git
synced 2026-06-04 02:44:44 +00:00
fixes #4672
This commit is contained in:
@@ -1075,7 +1075,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
|
||||
of tyBuiltInTypeClass:
|
||||
considerPreviousT:
|
||||
let targetKind = f.sons[0].kind
|
||||
if targetKind == a.skipTypes({tyRange, tyGenericInst}).kind or
|
||||
if targetKind == a.skipTypes({tyRange, tyGenericInst, tyBuiltInTypeClass}).kind or
|
||||
(targetKind in {tyProc, tyPointer} and a.kind == tyNil):
|
||||
put(c, f, a)
|
||||
return isGeneric
|
||||
|
||||
12
tests/generics/ttypeclass_to_typeclass.nim
Normal file
12
tests/generics/ttypeclass_to_typeclass.nim
Normal file
@@ -0,0 +1,12 @@
|
||||
# bug #4672
|
||||
type
|
||||
EnumContainer[T: enum] = object
|
||||
v: T
|
||||
SomeEnum {.pure.} = enum
|
||||
A,B,C
|
||||
|
||||
proc value[T: enum](this: EnumContainer[T]): T =
|
||||
this.v
|
||||
|
||||
var enumContainer: EnumContainer[SomeEnum]
|
||||
discard enumContainer.value()
|
||||
Reference in New Issue
Block a user