@@ -174,7 +174,7 @@ object Applications {
174
174
def productArity : Int = app.productArity
175
175
def productElement (n : Int ): Any = app.productElement(n)
176
176
}
177
-
177
+
178
178
/** The unapply method of this extractor also recognizes ExtMethodApplys in closure blocks.
179
179
* This is necessary to deal with closures as left arguments of extension method applications.
180
180
* A test case is i5606.scala
@@ -1511,14 +1511,14 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
1511
1511
1512
1512
case pt @ PolyProto (targs1, pt1) if targs.isEmpty =>
1513
1513
val alts1 = alts filter pt.isMatchedBy
1514
- resolveOverloaded(alts1, pt1, targs1.tpes, pos )
1514
+ resolveOverloaded(alts1, pt1, targs1.tpes)
1515
1515
1516
1516
case defn.FunctionOf (args, resultType, _, _) =>
1517
1517
narrowByTypes(alts, args, resultType)
1518
1518
1519
1519
case pt =>
1520
- val noSam = alts filter (normalizedCompatible(_, pt))
1521
- if (noSam .isEmpty) {
1520
+ val compat = alts. filter(normalizedCompatible(_, pt))
1521
+ if (compat .isEmpty)
1522
1522
/*
1523
1523
* the case should not be moved to the enclosing match
1524
1524
* since SAM type must be considered only if there are no candidates
@@ -1528,14 +1528,10 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
1528
1528
* new java.io.ObjectOutputStream(f)
1529
1529
*/
1530
1530
pt match {
1531
- case SAMType (mtp) =>
1532
- val sam = narrowByTypes(alts, mtp.paramInfos, mtp.resultType)
1533
- if (sam.nonEmpty && ! pt.classSymbol.hasAnnotation(defn.FunctionalInterfaceAnnot ))
1534
- ctx.warning(ex " ${sam.head.designator} is eta-expanded even though $pt does not have the @FunctionalInterface annotation. " , pos)
1535
- sam
1536
- case _ => noSam
1531
+ case SAMType (mtp) => narrowByTypes(alts, mtp.paramInfos, mtp.resultType)
1532
+ case _ => compat
1537
1533
}
1538
- } else noSam
1534
+ else compat
1539
1535
}
1540
1536
val found = narrowMostSpecific(candidates)
1541
1537
if (found.length <= 1 ) found
@@ -1544,7 +1540,7 @@ trait Applications extends Compatibility { self: Typer with Dynamic =>
1544
1540
if (noDefaults.length == 1 ) noDefaults // return unique alternative without default parameters if it exists
1545
1541
else {
1546
1542
val deepPt = pt.deepenProto
1547
- if (deepPt ne pt) resolveOverloaded(alts, deepPt, targs, pos )
1543
+ if (deepPt ne pt) resolveOverloaded(alts, deepPt, targs)
1548
1544
else alts
1549
1545
}
1550
1546
}
0 commit comments