fixes #4672
This commit is contained in:
parent
0a90613288
commit
f6a2ff731b
2 changed files with 13 additions and 1 deletions
|
|
@ -1075,7 +1075,7 @@ proc typeRel(c: var TCandidate, f, aOrig: PType, doBind = true): TTypeRelation =
|
||||||
of tyBuiltInTypeClass:
|
of tyBuiltInTypeClass:
|
||||||
considerPreviousT:
|
considerPreviousT:
|
||||||
let targetKind = f.sons[0].kind
|
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):
|
(targetKind in {tyProc, tyPointer} and a.kind == tyNil):
|
||||||
put(c, f, a)
|
put(c, f, a)
|
||||||
return isGeneric
|
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()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue