File tree 1 file changed +9
-3
lines changed
compiler/src/dotty/tools/dotc/core
1 file changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -1262,7 +1262,8 @@ object Types extends TypeUtils {
1262
1262
final def widen (using Context ): Type = this match
1263
1263
case _ : TypeRef | _ : MethodOrPoly => this // fast path for most frequent cases
1264
1264
case tp : TermRef => // fast path for next most frequent case
1265
- if tp.isOverloaded then tp else tp.underlying.widen
1265
+ val denot = tp.denot
1266
+ if denot.isOverloaded then tp else denot.info.widen
1266
1267
case tp : SingletonType => tp.underlying.widen
1267
1268
case tp : ExprType => tp.resultType.widen
1268
1269
case tp =>
@@ -1276,15 +1277,20 @@ object Types extends TypeUtils {
1276
1277
* base type by applying one or more `underlying` dereferences.
1277
1278
*/
1278
1279
final def widenSingleton (using Context ): Type = stripped match {
1279
- case tp : SingletonType if ! tp.isOverloaded => tp.underlying.widenSingleton
1280
+ case tp : TermRef =>
1281
+ val denot = tp.denot
1282
+ if denot.isOverloaded then this else denot.info.widenSingleton
1283
+ case tp : SingletonType => tp.underlying.widenSingleton
1280
1284
case _ => this
1281
1285
}
1282
1286
1283
1287
/** Widen from TermRef to its underlying non-termref
1284
1288
* base type, while also skipping Expr types.
1285
1289
*/
1286
1290
final def widenTermRefExpr (using Context ): Type = stripTypeVar match {
1287
- case tp : TermRef if ! tp.isOverloaded => tp.underlying.widenExpr.widenTermRefExpr
1291
+ case tp : TermRef =>
1292
+ val denot = tp.denot
1293
+ if denot.isOverloaded then this else denot.info.widenExpr.widenTermRefExpr
1288
1294
case _ => this
1289
1295
}
1290
1296
You can’t perform that action at this time.
0 commit comments