@@ -850,7 +850,9 @@ class Namer { typer: Typer =>
850
850
if (tparamSyms.nonEmpty && ! isDerived) tp.LambdaAbstract (tparamSyms)
851
851
// else if (toParameterize) tp.parameterizeWith(tparamSyms)
852
852
else tp
853
- sym.info = abstracted(TypeBounds .empty)
853
+
854
+ val dummyInfo = abstracted(TypeBounds .empty)
855
+ sym.info = dummyInfo
854
856
// Temporarily set info of defined type T to ` >: Nothing <: Any.
855
857
// This is done to avoid cyclic reference errors for F-bounds.
856
858
// This is subtle: `sym` has now an empty TypeBounds, but is not automatically
@@ -871,6 +873,19 @@ class Namer { typer: Typer =>
871
873
sym.info = NoCompleter
872
874
sym.info = checkNonCyclic(sym, unsafeInfo, reportErrors = true )
873
875
}
876
+
877
+ // Here we pay the price for the cavalier setting info to TypeBounds.empty above.
878
+ // We need to compensate by invalidating caches in references that might
879
+ // still contain the TypeBounds.empty. If we do not do this, stdlib factories
880
+ // fail with a bounds error in PostTyper.
881
+ def ensureUpToDate (tp : Type , outdated : Type ) = tp match {
882
+ case tref : TypeRef if tref.info == outdated && sym.info != outdated =>
883
+ tref.uncheckedSetSym(null )
884
+ case _ =>
885
+ }
886
+ ensureUpToDate(sym.typeRef, dummyInfo)
887
+ ensureUpToDate(sym.typeRef.appliedTo(tparamSyms.map(_.typeRef)), TypeBounds .empty)
888
+
874
889
etaExpandArgs.apply(sym.info)
875
890
}
876
891
0 commit comments