File tree Expand file tree Collapse file tree 4 files changed +11
-4
lines changed
compiler/src/dotty/tools/dotc/typer Expand file tree Collapse file tree 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
39023902
39033903 // Reasons NOT to eta expand:
39043904 // - we reference a constructor
3905- // - we reference a typelevel method
39063905 // - we are in a pattern
39073906 // - the current tree is a synthetic apply which is not expandable (eta-expasion would simply undo that)
39083907 if arity >= 0
39093908 && ! tree.symbol.isConstructor
3910- && ! tree.symbol.isAllOf(InlineMethod )
39113909 && ! ctx.mode.is(Mode .Pattern )
39123910 && ! (isSyntheticApply(tree) && ! functionExpected)
39133911 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 = ???
55inline def env [P <: Tuple , T ](op : P ?=> T ): P ?=> T = op
66
77@ 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 {
22 inline def summon [T ](x : T ): T = x match {
33 case t : T => t
44 }
5- println(summon) // error
5+ println(summon)
66}
77
88import 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