File tree Expand file tree Collapse file tree 1 file changed +9
-3
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 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 {
12621262 final def widen (using Context ): Type = this match
12631263 case _ : TypeRef | _ : MethodOrPoly => this // fast path for most frequent cases
12641264 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
12661267 case tp : SingletonType => tp.underlying.widen
12671268 case tp : ExprType => tp.resultType.widen
12681269 case tp =>
@@ -1276,15 +1277,20 @@ object Types extends TypeUtils {
12761277 * base type by applying one or more `underlying` dereferences.
12771278 */
12781279 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
12801284 case _ => this
12811285 }
12821286
12831287 /** Widen from TermRef to its underlying non-termref
12841288 * base type, while also skipping Expr types.
12851289 */
12861290 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
12881294 case _ => this
12891295 }
12901296
You can’t perform that action at this time.
0 commit comments