@@ -147,11 +147,10 @@ object Test {
147
147
Rules
148
148
-----
149
149
150
- 1 ) The ` erased ` modifier can appear:
151
-
152
- * At the start of a parameter block of a method, function or class
153
- * In a method definition
154
- * In a ` val ` definition (but not ` lazy val ` or ` var ` )
150
+ 1 . The ` erased ` modifier can appear:
151
+ * At the start of a parameter block of a method, function or class
152
+ * In a method definition
153
+ * In a ` val ` definition (but not ` lazy val ` or ` var ` )
155
154
156
155
``` scala
157
156
erased val x = ...
@@ -166,43 +165,39 @@ class K(erased x: Int) { ... }
166
165
```
167
166
168
167
169
- 2 ) A reference to an ` erased ` definition can only be used
170
-
171
- * Inside the expression of argument to an ` erased ` parameter
172
- * Inside the body of an ` erased ` ` val ` or ` def `
173
-
168
+ 2 . A reference to an ` erased ` definition can only be used
169
+ * Inside the expression of argument to an ` erased ` parameter
170
+ * Inside the body of an ` erased ` ` val ` or ` def `
174
171
175
- 3 ) Functions
176
172
177
- * ` (erased x1: T1, x2: T2, ..., xN: TN) => y : (erased T1, T2, ..., TN) => R `
178
- * ` (implicit erased x1: T1, x2: T2, ..., xN: TN) => y : (implicit erased T1, T2, ..., TN) => R `
179
- * ` implicit erased T1 => R <:< erased T1 => R `
180
- * ` (implicit erased T1, T2) => R <:< (erased T1, T2) => R `
181
- * ...
173
+ 3 . Functions
174
+ * ` (erased x1: T1, x2: T2, ..., xN: TN) => y : (erased T1, T2, ..., TN) => R `
175
+ * ` (implicit erased x1: T1, x2: T2, ..., xN: TN) => y : (implicit erased T1, T2, ..., TN) => R `
176
+ * ` implicit erased T1 => R <:< erased T1 => R `
177
+ * ` (implicit erased T1, T2) => R <:< (erased T1, T2) => R `
178
+ * ...
182
179
183
180
Note that there is no subtype relation between ` erased T => R ` and ` T => R ` (or ` implicit erased T => R ` and ` implicit T => R ` )
184
181
185
182
186
- 4 ) Eta expansion
183
+ 4 . Eta expansion
187
184
188
185
if ` def f(erased x: T): U ` then ` f: (erased T) => U ` .
189
186
190
187
191
- 5 ) Erasure Semantics
188
+ 5 . Erasure Semantics
189
+ * All ` erased ` paramters are removed from the function
190
+ * All argument to ` erased ` paramters are not passed to the function
191
+ * All ` erased ` definitions are removed
192
+ * All ` (erased T1, T2, ..., TN) => R ` and ` (implicit erased T1, T2, ..., TN) => R ` become ` () => R `
192
193
193
- * All ` erased ` paramters are removed from the function
194
- * All argument to ` erased ` paramters are not passed to the function
195
- * All ` erased ` definitions are removed
196
- * All ` (erased T1, T2, ..., TN) => R ` and ` (implicit erased T1, T2, ..., TN) => R ` become ` () => R `
197
194
198
-
199
- 6 ) Overloading
195
+ 6 . Overloading
200
196
201
197
Method with ` erased ` parameters will follow the normal overloading constraints after erasure.
202
198
203
199
204
- 7 ) Overriding
205
-
206
- * Member definitions overidding each other must both be ` erased ` or not be ` erased `
207
- * ` def foo(x: T): U ` cannot be overriden by ` def foo(erased x: T): U ` an viceversa
200
+ 7 . Overriding
201
+ * Member definitions overidding each other must both be ` erased ` or not be ` erased `
202
+ * ` def foo(x: T): U ` cannot be overriden by ` def foo(erased x: T): U ` an viceversa
208
203
0 commit comments