@@ -196,11 +196,11 @@ class Namer { typer: Typer =>
196
196
197
197
import untpd ._
198
198
199
- val TypedAhead : Property .Key [tpd.Tree ] = new Property .Key
200
- val ExpandedTree : Property .Key [untpd.Tree ] = new Property .Key
199
+ val TypedAhead : Property .Key [tpd.Tree ] = new Property .Key
200
+ val ExpandedTree : Property .Key [untpd.Tree ] = new Property .Key
201
201
val ExportForwarders : Property .Key [List [tpd.MemberDef ]] = new Property .Key
202
- val SymOfTree : Property .Key [Symbol ] = new Property .Key
203
- val Deriver : Property .Key [typer.Deriver ] = new Property .Key
202
+ val SymOfTree : Property .Key [Symbol ] = new Property .Key
203
+ val Deriver : Property .Key [typer.Deriver ] = new Property .Key
204
204
205
205
/** A partial map from unexpanded member and pattern defs and to their expansions.
206
206
* Populated during enterSyms, emptied during typer.
@@ -1443,7 +1443,12 @@ class Namer { typer: Typer =>
1443
1443
val tp1 = tp.widenTermRefExpr.simplified match
1444
1444
case ctp : ConstantType if isInlineVal => ctp
1445
1445
case ref : TypeRef if ref.symbol.is(ModuleClass ) => tp
1446
- case tp => tp.widenUnion
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
+ }
1447
1452
tp1.dropRepeatedAnnot
1448
1453
}
1449
1454
@@ -1512,10 +1517,10 @@ class Namer { typer: Typer =>
1512
1517
case _ =>
1513
1518
WildcardType
1514
1519
}
1515
- val memTpe = paramFn(checkSimpleKinded(typedAheadType(mdef.tpt, tptProto)).tpe)
1520
+ val mbrTpe = paramFn(checkSimpleKinded(typedAheadType(mdef.tpt, tptProto)).tpe)
1516
1521
if (ctx.explicitNulls && mdef.mods.is(JavaDefined ))
1517
- JavaNullInterop .nullifyMember(sym, memTpe , mdef.mods.isAllOf(JavaEnumValue ))
1518
- else memTpe
1522
+ JavaNullInterop .nullifyMember(sym, mbrTpe , mdef.mods.isAllOf(JavaEnumValue ))
1523
+ else mbrTpe
1519
1524
}
1520
1525
1521
1526
/** The type signature of a DefDef with given symbol */
0 commit comments