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 @@ -1175,7 +1175,7 @@ class Definitions {
1175
1175
case info : MethodType =>
1176
1176
! info.resType.isInstanceOf [MethodOrPoly ] && // Has only one parameter list
1177
1177
! info.isVarArgsMethod &&
1178
- ! info.paramInfos.exists(_. isInstanceOf [ ExprType ]) // No by-name parameters
1178
+ ! info.isMethodWithByNameArgs // No by-name parameters
1179
1179
case _ => false
1180
1180
info match
1181
1181
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