@@ -196,11 +196,11 @@ class Namer { typer: Typer =>
196196
197197 import untpd ._
198198
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
201201 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
204204
205205 /** A partial map from unexpanded member and pattern defs and to their expansions.
206206 * Populated during enterSyms, emptied during typer.
@@ -1443,7 +1443,12 @@ class Namer { typer: Typer =>
14431443 val tp1 = tp.widenTermRefExpr.simplified match
14441444 case ctp : ConstantType if isInlineVal => ctp
14451445 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+ }
14471452 tp1.dropRepeatedAnnot
14481453 }
14491454
@@ -1512,10 +1517,10 @@ class Namer { typer: Typer =>
15121517 case _ =>
15131518 WildcardType
15141519 }
1515- val memTpe = paramFn(checkSimpleKinded(typedAheadType(mdef.tpt, tptProto)).tpe)
1520+ val mbrTpe = paramFn(checkSimpleKinded(typedAheadType(mdef.tpt, tptProto)).tpe)
15161521 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
15191524 }
15201525
15211526 /** The type signature of a DefDef with given symbol */
0 commit comments