@@ -148,6 +148,7 @@ Rules
148148-----
149149
1501501 ) The ` erased ` modifier can appear:
151+
151152* At the start of a parameter block of a method, function or class
152153* In a method definition
153154* In a ` val ` definition (but not ` lazy val ` or ` var ` )
@@ -164,11 +165,15 @@ def h(x: erased Int => Int) = ...
164165class K (erased x : Int ) { ... }
165166```
166167
168+
1671692 ) A reference to an ` erased ` definition can only be used
170+
168171* Inside the expression of argument to an ` erased ` parameter
169172* Inside the body of an ` erased ` ` val ` or ` def `
170173
174+
1711753 ) Functions
176+
172177* ` (erased x1: T1, x2: T2, ..., xN: TN) => y : (erased T1, T2, ..., TN) => R `
173178* ` (implicit erased x1: T1, x2: T2, ..., xN: TN) => y : (implicit erased T1, T2, ..., TN) => R `
174179* ` implicit erased T1 => R <:< erased T1 => R `
@@ -177,20 +182,27 @@ class K(erased x: Int) { ... }
177182
178183Note that there is no subtype relation between ` erased T => R ` and ` T => R ` (or ` implicit erased T => R ` and ` implicit T => R ` )
179184
185+
1801864 ) Eta expansion
187+
181188if ` def f(erased x: T): U ` then ` f: (erased T) => U ` .
182189
183190
1841915 ) Erasure Semantics
192+
185193* All ` erased ` paramters are removed from the function
186194* All argument to ` erased ` paramters are not passed to the function
187195* All ` erased ` definitions are removed
188196* All ` (erased T1, T2, ..., TN) => R ` and ` (implicit erased T1, T2, ..., TN) => R ` become ` () => R `
189197
198+
1901996 ) Overloading
200+
191201Method with ` erased ` parameters will follow the normal overloading constraints after erasure.
192202
203+
1932047 ) Overriding
205+
194206* Member definitions overidding each other must both be ` erased ` or not be ` erased `
195207* ` def foo(x: T): U ` cannot be overriden by ` def foo(erased x: T): U ` an viceversa
196208
0 commit comments