File tree Expand file tree Collapse file tree 2 files changed +19
-6
lines changed
src/compiler/scala/tools/nsc/typechecker Expand file tree Collapse file tree 2 files changed +19
-6
lines changed Original file line number Diff line number Diff line change @@ -36,6 +36,10 @@ trait Adaptations {
3636 case Apply (_, arg :: Nil ) => arg
3737 case _ => EmptyTree
3838 }
39+ def isInfix = t match {
40+ case Apply (_, arg :: Nil ) => t.hasAttachment[MultiargInfixAttachment .type ]
41+ case _ => false
42+ }
3943 def callString = (
4044 ( if (t.symbol.isConstructor) " new " else " " ) +
4145 ( t.symbol.owner.decodedName ) +
@@ -86,15 +90,17 @@ trait Adaptations {
8690 true // keep adaptation
8791 }
8892 @ inline def warnAdaptation = {
89- if (settings.warnAdaptedArgs) context.warning(t.pos, adaptWarningMessage(
93+ if (settings.warnAdaptedArgs && ! isInfix ) context.warning(t.pos, adaptWarningMessage(
9094 s " adapted the argument list to the expected ${args.size}-tuple: add additional parens instead " ),
9195 WarningCategory .LintAdaptedArgs )
9296 true // keep adaptation
9397 }
94- if (args.isEmpty) {
95- if (currentRun.isScala3) noAdaptation else deprecatedAdaptation
96- } else
98+ if (args.nonEmpty)
9799 warnAdaptation
100+ else if (currentRun.isScala3)
101+ noAdaptation
102+ else
103+ deprecatedAdaptation
98104 }
99105 }
100106}
Original file line number Diff line number Diff line change 11
2+ // scalac: -Xlint -Werror
3+
24trait Test {
35
4- trait T [A ]
6+ trait T [_ ]
57
68 class C {
79 def -: (x : AnyRef ): T [x.type ] = ???
@@ -33,4 +35,9 @@ class B {
3335}
3436
3537// issue 11117
36- class A2 [B ](val b : B ) { def c : List [b.type ] = b :: Nil }
38+ class A2 [B2 ](val b : B2 ) { def c : List [b.type ] = b :: Nil }
39+
40+ // don't bug me about adapting a tuple when I wrote a tuple arg to infix
41+ class `lukas warned me about this and I brushed him off but that was last year before pandemic` {
42+ def `tuple in infix expression must not warn` = (42 , 27 ) :: Nil
43+ }
You can’t perform that action at this time.
0 commit comments