@@ -7158,7 +7158,7 @@ \section{Generics}
7158
7158
\LMHash{}%
7159
7159
A type parameter $T$ may be suffixed with an \EXTENDS{} clause
7160
7160
that specifies the \Index{upper bound} for $T$.
7161
- If no \EXTENDS{} clause is present, the upper bound is \code{Object}.
7161
+ If no \EXTENDS{} clause is present, the upper bound is \code{Object? }.
7162
7162
It is a
7163
7163
\Error{compile-time error} if a type parameter is a supertype of its upper bound
7164
7164
when that upper bound is itself a type variable.
@@ -21886,27 +21886,19 @@ \subsubsection{Additional Subtyping Concepts}
21886
21886
\LMHash{}%
21887
21887
A type $T$
21888
21888
\Index{may be assigned}
21889
- to a type $S$ in an environment $\Gamma$,
21890
- written \AssignableStd{S}{T},
21891
- if{}f either \SubtypeStd{S}{T} or \SubtypeStd{T}{S}.
21892
- In this case we say that the types $S$ and $T$ are
21893
- \Index{assignable}.
21889
+ to a type $S$ in an environment $\Gamma$
21890
+ if{}f $T$ is \DYNAMIC, or \SubtypeStd{T}{S}.
21891
+ In this case we also say that the type $T$ is \Index{assignable} to $S$.
21894
21892
21895
21893
\rationale{%
21896
- This rule may surprise readers accustomed to conventional typechecking.
21897
- The intent of the \AssignableRelationSymbol{} relation
21898
- is not to ensure that an assignment is guaranteed to succeed dynamically.
21899
- Instead, it aims to only flag assignments
21900
- that are almost certain to be erroneous,
21901
- without precluding assignments that may work.
21902
-
21903
- For example, assigning an object of static type \code{Object}
21904
- to a variable with static type \code{String},
21905
- while not guaranteed to be correct,
21906
- might be fine if the run-time value happens to be a string.
21907
-
21908
- A static analyzer or compiler
21909
- may support more strict static checks as an option.%
21894
+ The use of the type \DYNAMIC{} is intended to shift type checks from
21895
+ compile time to run time,
21896
+ thus allowing operations that are not statically safe,
21897
+ but which may succeed or fail at run time.
21898
+ This treatment of \DYNAMIC{} ensures that
21899
+ expressions of type \DYNAMIC{} are treated
21900
+ as if the compiler would implicitly insert a downcast whenever needed,
21901
+ in order to make the program type correct.%
21910
21902
}
21911
21903
21912
21904
@@ -23840,32 +23832,10 @@ \subsubsection{Const type variable elimination}
23840
23832
\}
23841
23833
\end{dartCode}
23842
23834
23843
- \subsubsection{Extension method resolution }
23835
+ \subsubsection{Combined member signatures }
23844
23836
23845
23837
!!!TODO!!!
23846
23838
23847
- For the purposes of extension method resolution, there is no special treatment
23848
- of nullable types with respect to what members are considered accessible. That
23849
- is, the only members of a nullable type that are considered accessible
23850
- (and hence which take precedence over extensions) are the members on \code{Object}.
23851
-
23852
- For the purposes of extension method resolution, the type \code{Never} is considered
23853
- to implement all members, and hence no extension may apply to an expression of
23854
- type \code{Never}.
23855
-
23856
- \subsubsection{Assignability}
23857
-
23858
- The definition of assignability is changed as follows.
23859
-
23860
- A type $T$ is \Index{assignable} to a type $S$ if $T$ is \DYNAMIC, or if $T$ is a
23861
- subtype of $S$.
23862
-
23863
- \subsubsection{Generics}
23864
-
23865
- The default bound of generic type parameters is treated as \code{Object?}.
23866
-
23867
- \subsubsection{Combined member signatures}
23868
-
23869
23839
This section, line 4241
23870
23840
in the language specification defines the notion of a _combined member
23871
23841
signature_. In Dart before null-safety it is based on the textually first
0 commit comments