From 528c6078ddff1faca2f8236ec6a948baa6b22805 Mon Sep 17 00:00:00 2001 From: odersky Date: Mon, 19 Sep 2022 18:33:45 +0200 Subject: [PATCH] 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. --- compiler/src/dotty/tools/dotc/core/TypeOps.scala | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/compiler/src/dotty/tools/dotc/core/TypeOps.scala b/compiler/src/dotty/tools/dotc/core/TypeOps.scala index 0c58cab0347f..0f4b981726f0 100644 --- a/compiler/src/dotty/tools/dotc/core/TypeOps.scala +++ b/compiler/src/dotty/tools/dotc/core/TypeOps.scala @@ -770,20 +770,12 @@ object TypeOps: tref case tp: TypeRef if !tp.symbol.isClass => - def lo = LazyRef.of(apply(tp.underlying.loBound)) - def hi = LazyRef.of(apply(tp.underlying.hiBound)) val lookup = boundTypeParams.lookup(tp) if lookup != null then lookup else - val tv = newTypeVar(TypeBounds(lo, hi)) + val tv = newTypeVar(tp.underlying.bounds) boundTypeParams(tp) = tv - // Force lazy ref eagerly using current context - // Otherwise, the lazy ref will be forced with a unknown context, - // which causes a problem in tests/patmat/i3645e.scala - lo.ref - hi.ref tv - end if case tp @ AppliedType(tycon: TypeRef, _) if !tycon.dealias.typeSymbol.isClass && !tp.isMatchAlias =>