File tree Expand file tree Collapse file tree 2 files changed +12
-4
lines changed
compiler/src/dotty/tools/dotc/transform Expand file tree Collapse file tree 2 files changed +12
-4
lines changed Original file line number Diff line number Diff line change @@ -535,15 +535,13 @@ class PostTyper extends MacroTransform with InfoTransformer { thisPhase =>
535535 // Make an exception for ChildAnnot, which should really have AnyKind bounds
536536 Checking .checkBounds(args, fn.tpe.widen.asInstanceOf [PolyType ])
537537 if ctx.settings.Whas .inferUnion then
538- val inferredOrTypes = args.filter( tpt =>
538+ val inferredOrTypes = args.find : tpt =>
539539 tpt.isInstanceOf [InferredTypeTree ] && tpt.tpe.stripTypeVar.isInstanceOf [OrType ]
540- )
541- inferredOrTypes.headOption.foreach(tpt =>
540+ inferredOrTypes.foreach: tpt =>
542541 report.warning(
543542 em """ |A type argument was inferred to be union type ${tpt.tpe.stripTypeVar}
544543 |This may indicate a programming error.
545544 | """ , tpt.srcPos)
546- )
547545 fn match {
548546 case sel : Select =>
549547 val args1 = transform(args)
Original file line number Diff line number Diff line change 1+ -- Warning: tests/warn/infer-or-type.scala:6:18 ------------------------------------------------------------------------
2+ 6 | val _ = List(1).contains("") // warn
3+ | ^^^^^^^^^^^^^^^^
4+ | A type argument was inferred to be union type Int | String
5+ | This may indicate a programming error.
6+ -- Warning: tests/warn/infer-or-type.scala:7:10 ------------------------------------------------------------------------
7+ 7 | val _ = Pair(1, "") // warn
8+ | ^^^^
9+ | A type argument was inferred to be union type Int | String
10+ | This may indicate a programming error.
You can’t perform that action at this time.
0 commit comments