-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Implement individual erased parameters (#16507)
### 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.
- Loading branch information
Showing
71 changed files
with
879 additions
and
403 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.