Skip to content

Commit f3f8ede

Browse files
Medowhillodersky
authored andcommitted
check function type before warning
1 parent 0d481d5 commit f3f8ede

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

compiler/src/dotty/tools/dotc/typer/Typer.scala

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2481,8 +2481,8 @@ class Typer extends Namer
24812481
!tree.symbol.is(InlineMethod) &&
24822482
!ctx.mode.is(Mode.Pattern) &&
24832483
!(isSyntheticApply(tree) && !isExpandableApply)) {
2484-
if (!pt.classSymbol.hasAnnotation(defn.FunctionalInterfaceAnnot))
2485-
ctx.warning(ex"${tree.symbol} is eta-expanded even though $pt does not have the @FunctionalInterface annotation.", tree.pos)
2484+
if (!defn.isFunctionType(pt) && !pt.classSymbol.hasAnnotation(defn.FunctionalInterfaceAnnot))
2485+
ctx.warning(ex"${tree.symbol} is eta-expanded even though ${pt.classSymbol} does not have the @FunctionalInterface annotation.", tree.pos)
24862486
simplify(typed(etaExpand(tree, wtp, arity), pt), pt, locked)
24872487
} else if (wtp.paramInfos.isEmpty && isAutoApplied(tree.symbol))
24882488
readaptSimplified(tpd.Apply(tree, Nil))

0 commit comments

Comments
 (0)