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
-`Int => String` is compatible to `ToString` -- when expecting a value of type `ToString`, you may pass a function literal from `Int` to `String`, as it will be SAM-converted to said function;
1198
1198
-`ToString` is not compatible to `Int => String` -- when expecting a function from `Int` to `String`, you may not pass a `ToString`.
1199
1199
1200
-
## Volatile Types
1200
+
## Realizability
1201
1201
1202
-
Type volatility approximates the possibility that a type parameter or abstract type instance of a type does not have any non-null values.
1203
-
A value member of a volatile type cannot appear in a [path](#paths).
1202
+
A type ´T´ is _realizable_ if and only if it is inhabited by non-null values.
1203
+
It is defined as:
1204
1204
1205
-
A type is _volatile_ if it falls into one of four categories:
1205
+
- A term designator ´p.x´ with underlying type ´U´ is realizable if ´p´ is ´\epsilon´ or a package ref or a realizable type and
1206
+
-`memberType(´p´, ´x´)` has the stable flag, or
1207
+
- the type returned by `memberType(´p´, ´x´)` is realizable.
1208
+
- A stable type that is not a term designator is realizable.
1209
+
- Another type ´T´ is realizable if
1210
+
- ´T´ is concrete, and
1211
+
- ´T´ has good bounds.
1206
1212
1207
-
A compound type `´T_1´ with ... with ´T_n´ {´R\,´}` is volatile if one of the following three conditions hold.
1213
+
A concrete type ´T´ has good bounds if all of the following apply:
1208
1214
1209
-
1. One of ´T_2, ..., T_n´ is a type parameter or abstract type, or
1210
-
1. ´T_1´ is an abstract type and either the refinement ´R´ or a type ´T_j´ for ´j > 1´ contributes an abstract member to the compound type, or
1211
-
1. one of ´T_1, ..., T_n´ is a singleton type.
1215
+
- all its non-class type members have good bounds, i.e., their bounds ´L´ and ´H´ are such that ´L <: H´,
1216
+
- all its type refinements have good bounds, and
1217
+
- for all base classes ´C´ of ´T´:
1218
+
-`baseType(´T´, ´C´)` is defined with some result ´p.C[T_1, ..., T_n]´, and
1219
+
- for all ´i \in \{ 1, ..., n \}´, ´T_i´ is a real type or (when it is a wildcard type argument) it has good bounds.
1212
1220
1213
-
Here, a type ´S´ _contributes an abstract member_ to a type ´T´ if ´S´ contains an abstract member that is also a member of ´T´.
1214
-
A refinement ´R´ contributes an abstract member to a type ´T´ if ´R´ contains an abstract declaration which is also a member of ´T´.
1215
-
1216
-
A type designator is volatile if it is an alias of a volatile type, or if it designates a type parameter or abstract type that has a volatile type as its upper bound.
1217
-
1218
-
A singleton type `´p´.type` is volatile, if the underlying type of path ´p´ is volatile.
1221
+
Note: it is possible for `baseType(´T´, ´C´)` not to be defined because of the `meet` computation, which may fail to merge prefixes and/or invariant type arguments.
0 commit comments