We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
f => f(f)
1 parent 4859415 commit d32761cCopy full SHA for d32761c
compiler/src/dotty/tools/dotc/transform/EtaReduce.scala
@@ -40,7 +40,7 @@ class EtaReduce extends MiniPhase:
40
case Apply(Select(fn, name), args)
41
if (name == nme.apply || defn.FunctionSpecializedApplyNames.contains(name))
42
&& mdef.paramss.head.corresponds(args)((param, arg) =>
43
- arg.isInstanceOf[Ident] && arg.symbol == param.symbol)
+ arg.isInstanceOf[Ident] && arg.symbol == param.symbol && arg.symbol != fn.symbol)
44
&& isPurePath(fn)
45
&& fn.tpe <:< tree.tpe
46
&& defn.isFunctionClass(fn.tpe.widen.typeSymbol) =>
tests/pos/i19962.scala
@@ -0,0 +1,2 @@
1
+def selfie0: (AnyRef => AnyRef) => AnyRef = (f:AnyRef => AnyRef) => f(f)
2
+def selfie1: Any = (f: Any => Any) => f(f)
0 commit comments