File tree 3 files changed +8
-2
lines changed
compiler/src/dotty/tools/dotc
3 files changed +8
-2
lines changed Original file line number Diff line number Diff line change @@ -1163,7 +1163,7 @@ class Definitions {
1163
1163
case info : MethodType =>
1164
1164
! info.resType.isInstanceOf [MethodOrPoly ] && // Has only one parameter list
1165
1165
! info.isVarArgsMethod &&
1166
- ! info.paramInfos.exists(_. isInstanceOf [ ExprType ]) // No by-name parameters
1166
+ ! info.isMethodWithByNameArgs // No by-name parameters
1167
1167
case _ => false
1168
1168
info match
1169
1169
case info : PolyType => isValidMethodType(info.resType)
Original file line number Diff line number Diff line change @@ -419,6 +419,12 @@ object Types {
419
419
case _ => false
420
420
}
421
421
422
+ /** Is this the type of a method that has a by-name parameters? */
423
+ def isMethodWithByNameArgs (using Context ): Boolean = stripPoly match {
424
+ case mt : MethodType => mt.paramInfos.exists(_.isInstanceOf [ExprType ])
425
+ case _ => false
426
+ }
427
+
422
428
/** Is this the type of a method with a leading empty parameter list?
423
429
*/
424
430
def isNullaryMethod (using Context ): Boolean = stripPoly match {
Original file line number Diff line number Diff line change @@ -507,7 +507,7 @@ object Nullables:
507
507
def postProcessByNameArgs (fn : TermRef , app : Tree )(using Context ): Tree =
508
508
fn.widen match
509
509
case mt : MethodType
510
- if mt.paramInfos.exists(_. isInstanceOf [ ExprType ]) && ! fn.symbol.is(Inline ) =>
510
+ if mt.isMethodWithByNameArgs && ! fn.symbol.is(Inline ) =>
511
511
app match
512
512
case Apply (fn, args) =>
513
513
object dropNotNull extends TreeMap :
You can’t perform that action at this time.
0 commit comments