Skip to content

Commit 31c902b

Browse files
committed
Eliminate the notion of "bound resolution" from inference.md.
In its place, the spec's definition of "T_0 bounded" is tightened up so that for any type T, there is exactly one type T_0 such that T is T_0 bounded. Then, instead of saying "let U_0 be the bound resolution of T_0", we can say "let U_0 be the unique type such that T_0 is U_0 bounded." This avoids some redundancy, since we no longer need to define separate but related notions of "T_0 bounded" and "bound resolution".
1 parent 8035e8e commit 31c902b

File tree

2 files changed

+8
-19
lines changed

2 files changed

+8
-19
lines changed

resources/type-system/inference.md

+1-19
Original file line numberDiff line numberDiff line change
@@ -969,24 +969,6 @@ with respect to `L` under constraints `C0`
969969
- If for `i` in `0...m`, `Mi` is a subtype match for `Ni` with respect to `L`
970970
under constraints `Ci`.
971971

972-
## Bound resolution
973-
974-
For any type `T`, the _bound resolution_ of `T` is a type `U`, defined by the
975-
following recursive process:
976-
977-
- If `T` is a type variable `X`, then let `B` be the bound of `X`. Then let `U`
978-
be the bound resolution of `B`.
979-
980-
- Otherwise, if `T` is a promoted type variable `X&B`, then let `U` be the bound
981-
resolution of `B`.
982-
983-
- Otherwise, let `U` be `T`.
984-
985-
_Note that the spec notions of __dynamic__ boundedness and __Function__
986-
boundedness can be defined in terms of bound resolution, as follows: a type is
987-
__dynamic__ bounded iff its bound resolution is __dynamic__, and a type is
988-
__Function__ bounded if its bound resolution if __Function__._
989-
990972
# Expression inference
991973

992974
Expression inference is a recursive process of elaborating an expression in Dart
@@ -1599,7 +1581,7 @@ static type `T`, where `m` and `T` are determined as follows:
15991581

16001582
- If `T_0` is `void`, there is a compile-time error.
16011583

1602-
- Let `U_0` be the [bound resolution](#Bound-resolution) of `T_0`.
1584+
- Let `U_0` be the unique type such that `T_0` is `U_0` bounded.
16031585

16041586
- If `U_0` is `dynamic` or `Never`, or `U_0` is `Function` and `id` is `call`,
16051587
then:

specification/dartLangSpec.tex

+7
Original file line numberDiff line numberDiff line change
@@ -13039,6 +13039,7 @@ \subsubsection{Binding Actuals to Formals}
1303913039
\LMHash{}%
1304013040
For a given type $T_0$, we introduce the notion of a
1304113041
\IndexCustom{$T_0$ bounded type}{type!T0 bounded}:
13042+
If $T_0$ is neither a type variable nor an intersection type, then
1304213043
$T_0$ itself is $T_0$ bounded;
1304313044
if $B$ is $T_0$ bounded and
1304413045
$X$ is a type variable with bound $B$
@@ -13054,6 +13055,12 @@ \subsubsection{Binding Actuals to Formals}
1305413055
Similarly for a
1305513056
\IndexCustom{\FUNCTION{} bounded type}{type!function bounded}.
1305613057

13058+
\commentary{%
13059+
Since it is illegal for a type parameter to be a supertype of its own
13060+
bound, it follows that for any type $T$, there exists exactly one type
13061+
$T_0$ for which $T$ is $T_0$ bounded.%
13062+
}
13063+
1305713064
\LMHash{}%
1305813065
A
1305913066
\IndexCustom{function-type bounded type}{type!function-type bounded}

0 commit comments

Comments
 (0)