You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
### Syntax
Erased parameters in a method / lambda comes with an `erased` modifier
before its name:
```scala
def erasedSecondParam(x: Int, erased y: Int): Int = x
type EraseSecondParam[T, U] = (T, erased U) => T
val esp: EraseSecondParam[Int, Int] = (x, erased y) => erasedSecondParam(x, y)
```
This is a breaking change, as previously erased methods / functions with
multiple parameters now only have its first parameter erased.
### Semantics
`[Impure][Contextual]ErasedFunctionN` traits are no longer available.
Instead, erased function values are denoted by refining the
`scala.runtime.ErasedFunction` trait:
```scala
type Int_EInt = (Int, erased Int) => Int
// is equivalent to
type Int_EInt2 = scala.runtime.ErasedFunction {
def apply(x$0: Int, erased x$1: Int): Int
}
```
They are subsequently compiled (during Erasure) into
`[Contextual]FunctionM` where `M` is the number of non-erased
parameters.
### Erased Classes
Any parameter that is an instance of an erased class is automatically
erased. This is different from before, where the parameters are erased
only if all parameters are instances of erased classes.
0 commit comments