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 @@ -1166,7 +1166,7 @@ class Definitions {
1166
1166
case info : MethodType =>
1167
1167
! info.resType.isInstanceOf [MethodOrPoly ] && // Has only one parameter list
1168
1168
! info.isVarArgsMethod &&
1169
- ! info.paramInfos.exists(_. isInstanceOf [ ExprType ]) // No by-name parameters
1169
+ ! info.isMethodWithByNameArgs // No by-name parameters
1170
1170
case _ => false
1171
1171
info match
1172
1172
case info : PolyType => isValidMethodType(info.resType)
Original file line number Diff line number Diff line change @@ -429,6 +429,12 @@ object Types {
429
429
case _ => false
430
430
}
431
431
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
+
432
438
/** Is this the type of a method with a leading empty parameter list?
433
439
*/
434
440
def isNullaryMethod (using Context ): Boolean = stripPoly match {
Original file line number Diff line number Diff line change @@ -518,7 +518,7 @@ object Nullables:
518
518
def postProcessByNameArgs (fn : TermRef , app : Tree )(using Context ): Tree =
519
519
fn.widen match
520
520
case mt : MethodType
521
- if mt.paramInfos.exists(_. isInstanceOf [ ExprType ]) && ! fn.symbol.is(Inline ) =>
521
+ if mt.isMethodWithByNameArgs && ! fn.symbol.is(Inline ) =>
522
522
app match
523
523
case Apply (fn, args) =>
524
524
object dropNotNull extends TreeMap :
You can’t perform that action at this time.
0 commit comments