You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Note that there is no subtype relation between `(erased T) => R` and `T => R` (or `(given erased T) => R` and `(given T) => R`). The `erased` parameters must match exactly in their respective positions.
17
+
*`(erased T1, T2) => R`
18
+
*`(x: T1, y: erased T2) ?=> T`
43
19
20
+
Note that there is no subtype relation between `(erased T) => R` and `T => R` (or `(erased T) ?=> R` and `T ?=> R`). The `erased` parameters must match exactly in their respective positions.
44
21
45
22
4. Eta expansion
46
23
47
24
if `def f(erased x: T): U` then `f: (erased T) => U`.
48
25
49
-
50
26
5. Erasure semantics
51
27
* All `erased` parameters are removed from the function
52
28
* All argument to `erased` parameters are not passed to the function
53
-
*All `erased` definitions are removed
54
-
* `(erased ET1, erased ET2, T1, ..., erased ETN, TM) => R` are erased to `(T1, ..., TM) => R`.
* All `erased` argument types are removed from a function type
57
31
58
32
6. Overloading
59
33
60
34
Method with `erased` parameters will follow the normal overloading constraints after erasure.
61
35
62
-
63
36
7. Overriding
64
37
* Member definitions overriding each other must both be `erased` or not be `erased`.
65
38
*`def foo(x: T): U` cannot be overridden by `def foo(erased x: T): U` and vice-versa.
66
39
67
40
8. Type Restrictions
68
-
*For dependent functions, `erased` parameters are limited to realizable types, that is, types that are inhabited by non-null values.
69
-
This restriction stops us from using a bad bound introduced by an erased value, which leads to unsoundness (see #4060).
70
41
* Polymorphic functions with erased parameters are currently not supported, and will be rejected by the compiler. This is purely an implementation restriction, and might be lifted in the future.
0 commit comments