Skip to content

Commit 1912e08

Browse files
authored
new line after rule heading
The list is broken on http://dotty.epfl.ch/docs. I suppose it requires a new line after the rule heading (at least the list in workflow.md has a new line and this one is displayed correctly)
1 parent 5be1360 commit 1912e08

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

docs/docs/reference/erased-terms.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,7 @@ Rules
148148
-----
149149

150150
1) 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) = ...
164165
class K(erased x: Int) { ... }
165166
```
166167

168+
167169
2) 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+
171175
3) 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

178183
Note that there is no subtype relation between `erased T => R` and `T => R` (or `implicit erased T => R` and `implicit T => R`)
179184

185+
180186
4) Eta expansion
187+
181188
if `def f(erased x: T): U` then `f: (erased T) => U`.
182189

183190

184191
5) 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+
190199
6) Overloading
200+
191201
Method with `erased` parameters will follow the normal overloading constraints after erasure.
192202

203+
193204
7) 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

Comments
 (0)