Skip to content

Commit c9dded7

Browse files
committed
gadt: Externalise all parts of sym bounds
1 parent a5980f7 commit c9dded7

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

compiler/src/dotty/tools/dotc/core/GadtConstraint.scala

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -193,12 +193,7 @@ final class ProperGadtConstraint private(
193193
case null => null
194194
// TODO: Improve flow typing so that ascription becomes redundant
195195
case tv: TypeVar =>
196-
def retrieveBounds: TypeBounds =
197-
bounds(tv.origin) match {
198-
case TypeAlias(tpr: TypeParamRef) if reverseMapping.contains(tpr) =>
199-
TypeAlias(reverseMapping(tpr).nn.typeRef)
200-
case tb => tb
201-
}
196+
def retrieveBounds: TypeBounds = externalize(bounds(tv.origin)).bounds
202197
retrieveBounds
203198
//.showing(i"gadt bounds $sym: $result", gadts)
204199
//.ensuring(containsNoInternalTypes(_))
@@ -260,6 +255,7 @@ final class ProperGadtConstraint private(
260255
case param: TypeParamRef => reverseMapping(param) match
261256
case sym: Symbol => sym.typeRef
262257
case null => param
258+
case tp: TypeAlias => tp.derivedAlias(externalize(tp.alias, theMap))
263259
case tp => (if theMap == null then ExternalizeMap() else theMap).mapOver(tp)
264260

265261
private class ExternalizeMap(using Context) extends TypeMap:

0 commit comments

Comments
 (0)