@@ -1029,14 +1029,10 @@ object Types {
1029
1029
*/
1030
1030
def recoverable_& (that : Type )(using Context ): Type =
1031
1031
try this & that
1032
- catch {
1033
- case ex : CyclicReference => this safe_& that
1034
- // A test case where this happens is tests/pos/i536.scala.
1035
- // The & causes a subtype check which calls baseTypeRef again with the same
1036
- // superclass.
1037
- case ex : LazyRefCycle => this safe_& that
1038
- // A test case where this happens is tests/pos/i9364.scala
1039
- }
1032
+ catch case ex : CyclicReference => this safe_& that
1033
+ // A test case where this happens is tests/pos/i536.scala.
1034
+ // The & causes a subtype check which calls baseTypeRef again with the same
1035
+ // superclass.
1040
1036
1041
1037
def | (that : Type )(using Context ): Type = {
1042
1038
record(" |" )
@@ -2643,12 +2639,9 @@ object Types {
2643
2639
def ref (using Context ): Type =
2644
2640
if computed then
2645
2641
if myRef == null then
2646
- // if errors were reported previously handle this by throwing a CyclicReference
2647
- // instead of crashing immediately. A test case is neg/i6057.scala.
2648
- if reportCycles || ctx.reporter.errorsReported then
2649
- throw CyclicReference (NoDenotation ) // recoverable
2650
- else
2651
- throw LazyRefCycle () // generally not recoverable, but there are a few exceptions
2642
+ throw CyclicReference (NoDenotation )
2643
+ // i9346.scala shows that such cycles can arise in normal code
2644
+ // when trying to compute asSeenFrom on refined types.
2652
2645
else
2653
2646
computed = true
2654
2647
val result = refFn
@@ -2674,8 +2667,6 @@ object Types {
2674
2667
override def hashCode : Int = System .identityHashCode(this )
2675
2668
}
2676
2669
2677
- class LazyRefCycle extends Error (" Illegal cycle: LazyRef depends on itself" )
2678
-
2679
2670
// --- Refined Type and RecType ------------------------------------------------
2680
2671
2681
2672
abstract class RefinedOrRecType extends CachedProxyType with ValueType {
0 commit comments