File tree Expand file tree Collapse file tree 3 files changed +8
-2
lines changed
compiler/src/dotty/tools/dotc Expand file tree Collapse file tree 3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -1166,7 +1166,7 @@ class Definitions {
11661166 case info : MethodType =>
11671167 ! info.resType.isInstanceOf [MethodOrPoly ] && // Has only one parameter list
11681168 ! info.isVarArgsMethod &&
1169- ! info.paramInfos.exists(_. isInstanceOf [ ExprType ]) // No by-name parameters
1169+ ! info.isMethodWithByNameArgs // No by-name parameters
11701170 case _ => false
11711171 info match
11721172 case info : PolyType => isValidMethodType(info.resType)
Original file line number Diff line number Diff line change @@ -429,6 +429,12 @@ object Types {
429429 case _ => false
430430 }
431431
432+ /** Is this the type of a method that has a by-name parameters? */
433+ def isMethodWithByNameArgs (using Context ): Boolean = stripPoly match {
434+ case mt : MethodType => mt.paramInfos.exists(_.isInstanceOf [ExprType ])
435+ case _ => false
436+ }
437+
432438 /** Is this the type of a method with a leading empty parameter list?
433439 */
434440 def isNullaryMethod (using Context ): Boolean = stripPoly match {
Original file line number Diff line number Diff line change @@ -518,7 +518,7 @@ object Nullables:
518518 def postProcessByNameArgs (fn : TermRef , app : Tree )(using Context ): Tree =
519519 fn.widen match
520520 case mt : MethodType
521- if mt.paramInfos.exists(_. isInstanceOf [ ExprType ]) && ! fn.symbol.is(Inline ) =>
521+ if mt.isMethodWithByNameArgs && ! fn.symbol.is(Inline ) =>
522522 app match
523523 case Apply (fn, args) =>
524524 object dropNotNull extends TreeMap :
You can’t perform that action at this time.
0 commit comments