Skip to content

Commit c79d5f8

Browse files
committed
Simplify widenRHS
1 parent e3d26e0 commit c79d5f8

File tree

1 file changed

+3
-11
lines changed

1 file changed

+3
-11
lines changed

compiler/src/dotty/tools/dotc/typer/Namer.scala

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1439,18 +1439,10 @@ class Namer { typer: Typer =>
14391439
// instead of widening to the underlying module class types.
14401440
// We also drop the @Repeated annotation here to avoid leaking it in method result types
14411441
// (see run/inferred-repeated-result).
1442-
def widenRhs(tp: Type): Type = {
1443-
val tp1 = tp.widenTermRefExpr.simplified match
1442+
def widenRhs(tp: Type): Type =
1443+
tp.widenTermRefExpr.simplified match
14441444
case ctp: ConstantType if isInlineVal => ctp
1445-
case ref: TypeRef if ref.symbol.is(ModuleClass) => tp
1446-
case tp =>
1447-
if true then ctx.typeComparer.widenInferred(tp, rhsProto)
1448-
else rhsProto match {
1449-
case OrType(_, _) | WildcardType(TypeBounds(_, OrType(_, _))) => tp.widen
1450-
case _ => tp.widenUnion
1451-
}
1452-
tp1.dropRepeatedAnnot
1453-
}
1445+
case tp => ctx.typeComparer.widenInferred(tp, rhsProto)
14541446

14551447
// Replace aliases to Unit by Unit itself. If we leave the alias in
14561448
// it would be erased to BoxedUnit.

0 commit comments

Comments
 (0)