File tree 4 files changed +11
-4
lines changed
compiler/src/dotty/tools/dotc/typer
4 files changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -3902,12 +3902,10 @@ class Typer(@constructorOnly nestingLevel: Int = 0) extends Namer
3902
3902
3903
3903
// Reasons NOT to eta expand:
3904
3904
// - we reference a constructor
3905
- // - we reference a typelevel method
3906
3905
// - we are in a pattern
3907
3906
// - the current tree is a synthetic apply which is not expandable (eta-expasion would simply undo that)
3908
3907
if arity >= 0
3909
3908
&& ! tree.symbol.isConstructor
3910
- && ! tree.symbol.isAllOf(InlineMethod )
3911
3909
&& ! ctx.mode.is(Mode .Pattern )
3912
3910
&& ! (isSyntheticApply(tree) && ! functionExpected)
3913
3911
then
Original file line number Diff line number Diff line change @@ -5,4 +5,4 @@ extension [T](t: T) inline def pi[P <: Tuple](using P): T = ???
5
5
inline def env [P <: Tuple , T ](op : P ?=> T ): P ?=> T = op
6
6
7
7
@ main def Test =
8
- env { pi[String ] } // error // error
8
+ env { pi[String ] } // error
Original file line number Diff line number Diff line change @@ -2,7 +2,7 @@ object Foo {
2
2
inline def summon [T ](x : T ): T = x match {
3
3
case t : T => t
4
4
}
5
- println(summon) // error
5
+ println(summon)
6
6
}
7
7
8
8
import scala .deriving .*
Original file line number Diff line number Diff line change
1
+ class Foo (x : Int )
2
+
3
+ object A :
4
+ inline def bar (x : Int ): Int = x
5
+ val g1 = bar
6
+ val g2 : Int => Int = bar
7
+
8
+ def foo (xs : List [Int ]) =
9
+ xs.map(Foo .apply) // use the `inline def apply` constructor proxy
You can’t perform that action at this time.
0 commit comments