Skip to content

Commit 87ad61f

Browse files
authored
Merge pull request #4174 from robstoll/patch-2
new line after rule heading
2 parents 742b0fa + f87507a commit 87ad61f

File tree

1 file changed

+30
-23
lines changed

1 file changed

+30
-23
lines changed

docs/docs/reference/erased-terms.md

Lines changed: 30 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -147,10 +147,10 @@ object Test {
147147
Rules
148148
-----
149149

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`)
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`)
154154

155155
```scala
156156
erased val x = ...
@@ -164,33 +164,40 @@ def h(x: erased Int => Int) = ...
164164
class K(erased x: Int) { ... }
165165
```
166166

167-
2) A reference to an `erased` definition can only be used
168-
* Inside the expression of argument to an `erased` parameter
169-
* Inside the body of an `erased` `val` or `def`
170167

171-
3) Functions
172-
* `(erased x1: T1, x2: T2, ..., xN: TN) => y : (erased T1, T2, ..., TN) => R`
173-
* `(implicit erased x1: T1, x2: T2, ..., xN: TN) => y : (implicit erased T1, T2, ..., TN) => R`
174-
* `implicit erased T1 => R <:< erased T1 => R`
175-
* `(implicit erased T1, T2) => R <:< (erased T1, T2) => R`
176-
* ...
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`
171+
172+
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+
* ...
177179

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

180-
4) Eta expansion
182+
183+
4. Eta expansion
184+
181185
if `def f(erased x: T): U` then `f: (erased T) => U`.
182186

183187

184-
5) Erasure Semantics
185-
* All `erased` paramters are removed from the function
186-
* All argument to `erased` paramters are not passed to the function
187-
* All `erased` definitions are removed
188-
* All `(erased T1, T2, ..., TN) => R` and `(implicit erased T1, T2, ..., TN) => R` become `() => R`
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`
193+
194+
195+
6. Overloading
189196

190-
6) Overloading
191197
Method with `erased` parameters will follow the normal overloading constraints after erasure.
192198

193-
7) Overriding
194-
* Member definitions overidding each other must both be `erased` or not be `erased`
195-
* `def foo(x: T): U` cannot be overriden by `def foo(erased x: T): U` an viceversa
199+
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
196203

0 commit comments

Comments
 (0)