Skip to content

Commit 528c607

Browse files
committed
Drop lazy recursive application in approximateParent
This plays badly with any code that inspects bounds deeply when creating constraints since the LazyRefs create new type variables at unexpected times. Not clear we need it at all since higher-kinded type variables (AppliedType case) don't go deeply into bounds. If we do need it then we should come up with a way to turn all type recursive references of a type parameter clause into typevars at the time we first see the clause rather than later on demand.
1 parent afc6ce4 commit 528c607

File tree

1 file changed

+1
-9
lines changed

1 file changed

+1
-9
lines changed

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

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -770,20 +770,12 @@ object TypeOps:
770770
tref
771771

772772
case tp: TypeRef if !tp.symbol.isClass =>
773-
def lo = LazyRef.of(apply(tp.underlying.loBound))
774-
def hi = LazyRef.of(apply(tp.underlying.hiBound))
775773
val lookup = boundTypeParams.lookup(tp)
776774
if lookup != null then lookup
777775
else
778-
val tv = newTypeVar(TypeBounds(lo, hi))
776+
val tv = newTypeVar(tp.underlying.bounds)
779777
boundTypeParams(tp) = tv
780-
// Force lazy ref eagerly using current context
781-
// Otherwise, the lazy ref will be forced with a unknown context,
782-
// which causes a problem in tests/patmat/i3645e.scala
783-
lo.ref
784-
hi.ref
785778
tv
786-
end if
787779

788780
case tp @ AppliedType(tycon: TypeRef, _) if !tycon.dealias.typeSymbol.isClass && !tp.isMatchAlias =>
789781

0 commit comments

Comments
 (0)