File tree Expand file tree Collapse file tree 1 file changed +7
-1
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 1 file changed +7
-1
lines changed Original file line number Diff line number Diff line change @@ -130,6 +130,9 @@ object Checking {
130
130
*/
131
131
class CheckNonCyclicMap (sym : Symbol , reportErrors : Boolean )(implicit ctx : Context ) extends TypeMap {
132
132
133
+ /** Set of type references whose info is currently checked */
134
+ private val locked = mutable.Set [TypeRef ]()
135
+
133
136
/** Are cycles allowed within nested refinedInfos of currently checked type? */
134
137
private var nestedCycleOK = false
135
138
@@ -212,7 +215,10 @@ object Checking {
212
215
}
213
216
if (isInteresting(pre)) {
214
217
val pre1 = this (pre, false , false )
215
- checkInfo(tp.info)
218
+ if (locked.contains(tp)) throw CyclicReference (tp.symbol)
219
+ locked += tp
220
+ try checkInfo(tp.info)
221
+ finally locked -= tp
216
222
if (pre1 eq pre) tp else tp.newLikeThis(pre1)
217
223
}
218
224
else tp
You can’t perform that action at this time.
0 commit comments