parent
90025e242d
commit
e69d8ec416
2 changed files with 9 additions and 1 deletions
|
|
@ -113,6 +113,7 @@ proc checkConvertible(c: PContext, castDest, src: PType): TConvStatus =
|
||||||
if castDest.kind notin IntegralTypes+{tyRange}:
|
if castDest.kind notin IntegralTypes+{tyRange}:
|
||||||
result = convNotNeedeed
|
result = convNotNeedeed
|
||||||
return
|
return
|
||||||
|
# Save for later
|
||||||
var d = skipTypes(castDest, abstractVar)
|
var d = skipTypes(castDest, abstractVar)
|
||||||
var s = src
|
var s = src
|
||||||
if s.kind in tyUserTypeClasses and s.isResolvedUserTypeClass:
|
if s.kind in tyUserTypeClasses and s.isResolvedUserTypeClass:
|
||||||
|
|
@ -135,7 +136,7 @@ proc checkConvertible(c: PContext, castDest, src: PType): TConvStatus =
|
||||||
# we use d, s here to speed up that operation a bit:
|
# we use d, s here to speed up that operation a bit:
|
||||||
case cmpTypes(c, d, s)
|
case cmpTypes(c, d, s)
|
||||||
of isNone, isGeneric:
|
of isNone, isGeneric:
|
||||||
if not compareTypes(castDest, src, dcEqIgnoreDistinct):
|
if not compareTypes(castDest.skipTypes(abstractVar), src, dcEqIgnoreDistinct):
|
||||||
result = convNotLegal
|
result = convNotLegal
|
||||||
else:
|
else:
|
||||||
discard
|
discard
|
||||||
|
|
|
||||||
7
tests/typerel/t8905.nim
Normal file
7
tests/typerel/t8905.nim
Normal file
|
|
@ -0,0 +1,7 @@
|
||||||
|
type
|
||||||
|
Foo[T] = distinct seq[T]
|
||||||
|
Bar[T] = object
|
||||||
|
|
||||||
|
proc newFoo[T](): Foo[T] = Foo[T](newSeq[T]())
|
||||||
|
|
||||||
|
var x = newFoo[Bar[int]]()
|
||||||
Loading…
Add table
Add a link
Reference in a new issue