File tree Expand file tree Collapse file tree 1 file changed +3
-7
lines changed
compiler/src/dotty/tools/dotc/core Expand file tree Collapse file tree 1 file changed +3
-7
lines changed Original file line number Diff line number Diff line change @@ -283,15 +283,11 @@ trait ConstraintHandling[AbstractContext] {
283283 * as those could leak the annotation to users (see run/inferred-repeated-result).
284284 */
285285 def widenInferred (inst : Type , bound : Type )(implicit actx : AbstractContext ): Type = {
286- def widenSingle (tp : Type ) = {
287- val tpw = tp.widenSingletons
286+ def tryWiden (tp : Type , widen : Type => Type ) = {
287+ val tpw = widen(tp)
288288 if ((tpw ne tp) && tpw <:< bound) tpw else tp
289289 }
290- def widenOr (tp : Type ) = {
291- val tpw = tp.widenUnion
292- if ((tpw ne tp) && tpw <:< bound) tpw else tp
293- }
294- widenOr(widenSingle(inst)).dropRepeatedAnnot
290+ tryWiden(tryWiden(inst, _.widenSingletons), _.widenUnion).dropRepeatedAnnot
295291 }
296292
297293 /** The instance type of `param` in the current constraint (which contains `param`).
You can’t perform that action at this time.
0 commit comments