@@ -7197,7 +7197,7 @@ \section{Generics}
7197
7197
\LMHash{}%
7198
7198
A type parameter $T$ may be suffixed with an \EXTENDS{} clause
7199
7199
that specifies the \Index{upper bound} for $T$.
7200
- If no \EXTENDS{} clause is present, the upper bound is \code{Object}.
7200
+ If no \EXTENDS{} clause is present, the upper bound is \code{Object? }.
7201
7201
It is a
7202
7202
\Error{compile-time error} if a type parameter is a supertype of its upper bound
7203
7203
when that upper bound is itself a type variable.
@@ -22014,27 +22014,19 @@ \subsubsection{Additional Subtyping Concepts}
22014
22014
\LMHash{}%
22015
22015
A type $T$
22016
22016
\Index{may be assigned}
22017
- to a type $S$ in an environment $\Gamma$,
22018
- written \AssignableStd{S}{T},
22019
- if{}f either \SubtypeStd{S}{T} or \SubtypeStd{T}{S}.
22020
- In this case we say that the types $S$ and $T$ are
22021
- \Index{assignable}.
22017
+ to a type $S$ in an environment $\Gamma$
22018
+ if{}f $T$ is \DYNAMIC, or \SubtypeStd{T}{S}.
22019
+ In this case we also say that the type $T$ is \Index{assignable} to $S$.
22022
22020
22023
22021
\rationale{%
22024
- This rule may surprise readers accustomed to conventional typechecking.
22025
- The intent of the \AssignableRelationSymbol{} relation
22026
- is not to ensure that an assignment is guaranteed to succeed dynamically.
22027
- Instead, it aims to only flag assignments
22028
- that are almost certain to be erroneous,
22029
- without precluding assignments that may work.
22030
-
22031
- For example, assigning an object of static type \code{Object}
22032
- to a variable with static type \code{String},
22033
- while not guaranteed to be correct,
22034
- might be fine if the run-time value happens to be a string.
22035
-
22036
- A static analyzer or compiler
22037
- may support more strict static checks as an option.%
22022
+ The use of the type \DYNAMIC{} is intended to shift type checks from
22023
+ compile time to run time,
22024
+ thus allowing operations that are not statically safe,
22025
+ but which may succeed or fail at run time.
22026
+ This treatment of \DYNAMIC{} ensures that
22027
+ expressions of type \DYNAMIC{} are treated
22028
+ as if the compiler would implicitly insert a downcast whenever needed,
22029
+ in order to make the program type correct.%
22038
22030
}
22039
22031
22040
22032
@@ -23968,32 +23960,10 @@ \subsubsection{Const type variable elimination}
23968
23960
\}
23969
23961
\end{dartCode}
23970
23962
23971
- \subsubsection{Extension method resolution }
23963
+ \subsubsection{Combined member signatures }
23972
23964
23973
23965
!!!TODO!!!
23974
23966
23975
- For the purposes of extension method resolution, there is no special treatment
23976
- of nullable types with respect to what members are considered accessible. That
23977
- is, the only members of a nullable type that are considered accessible
23978
- (and hence which take precedence over extensions) are the members on \code{Object}.
23979
-
23980
- For the purposes of extension method resolution, the type \code{Never} is considered
23981
- to implement all members, and hence no extension may apply to an expression of
23982
- type \code{Never}.
23983
-
23984
- \subsubsection{Assignability}
23985
-
23986
- The definition of assignability is changed as follows.
23987
-
23988
- A type $T$ is \Index{assignable} to a type $S$ if $T$ is \DYNAMIC, or if $T$ is a
23989
- subtype of $S$.
23990
-
23991
- \subsubsection{Generics}
23992
-
23993
- The default bound of generic type parameters is treated as \code{Object?}.
23994
-
23995
- \subsubsection{Combined member signatures}
23996
-
23997
23967
This section, line 4241
23998
23968
in the language specification defines the notion of a _combined member
23999
23969
signature_. In Dart before null-safety it is based on the textually first
0 commit comments