@@ -2800,7 +2800,7 @@ object Types {
28002800 }
28012801 }
28022802
2803- case class LazyRef (private var refFn : Context ? => Type ) extends UncachedProxyType with ValueType {
2803+ case class LazyRef (private var refFn : Context => Type ) extends UncachedProxyType with ValueType {
28042804 private var myRef : Type = null
28052805 private var computed = false
28062806
@@ -2813,7 +2813,7 @@ object Types {
28132813 throw CyclicReference (NoDenotation )
28142814 else
28152815 computed = true
2816- val result = refFn
2816+ val result = refFn(ctx)
28172817 refFn = null
28182818 if result != null then myRef = result
28192819 else assert(myRef != null ) // must have been `update`d
@@ -2835,6 +2835,8 @@ object Types {
28352835 override def equals (other : Any ): Boolean = this .eq(other.asInstanceOf [AnyRef ])
28362836 override def hashCode : Int = System .identityHashCode(this )
28372837 }
2838+ object LazyRef :
2839+ def of (refFn : Context ?=> Type ): LazyRef = LazyRef (refFn(using _))
28382840
28392841 // --- Refined Type and RecType ------------------------------------------------
28402842
@@ -4655,7 +4657,7 @@ object Types {
46554657 RefinedType (selfType, sym.name,
46564658 TypeAlias (
46574659 withMode(Mode .CheckCyclic )(
4658- LazyRef (force))))
4660+ LazyRef .of (force))))
46594661 cinfo.selfInfo match
46604662 case self : Type =>
46614663 cinfo.derivedClassInfo(
@@ -5254,7 +5256,8 @@ object Types {
52545256 derivedSuperType(tp, this (thistp), this (supertp))
52555257
52565258 case tp : LazyRef =>
5257- LazyRef { refCtx ?=>
5259+ LazyRef { refCtx =>
5260+ given Context = refCtx
52585261 val ref1 = tp.ref
52595262 if refCtx.runId == mapCtx.runId then this (ref1)
52605263 else // splice in new run into map context
0 commit comments