|
|
Created:
4 years ago by Lasse Reichstein Nielsen Modified:
3 years, 11 months ago CC:
karlklose, Johnni Winther Target Ref:
refs/heads/master Visibility:
Public. |
DescriptionMake Null act like the bottom type for all the (default nullable) types.
BUG= http://dartbug.com/28024
R=eernst@google.com
Committed: https://github.com/dart-lang/sdk/commit/10abaf89fd9378ff4f5d5258ba7e018f204ee4ac
Patch Set 1 #
Total comments: 4
Patch Set 2 : Address comments. #
Total comments: 4
Messages
Total messages: 15 (4 generated)
lrn@google.com changed reviewers: + johnniwinther@google.com, karlklose@google.com
My first (and not really proof-read or anything) go at making Null act as if it is a subtype of all types. It should basically only affect generic classes and function types where Null is considered more specific than anything else. That means: List<int> x = new List<Null>(); // valid! typedef void Foo(Null x); Foo var = (int x) { something; }; // valid! I'll read it a few more times and see if I need to touch the <: relation as well. Any input appreciated :)
https://codereview.chromium.org/2555343004/diff/1/docs/language/dartLangSpec.tex File docs/language/dartLangSpec.tex (right): https://codereview.chromium.org/2555343004/diff/1/docs/language/dartLangSpec.... docs/language/dartLangSpec.tex:2622: The \code{Null} type can be assigned anywhere without complaint by the static checker. Can you be more precise about what being assigned means for a type here? https://codereview.chromium.org/2555343004/diff/1/docs/language/dartLangSpec.... docs/language/dartLangSpec.tex:7381: \item T id \NULL{} and $S$ is not $\bot$. 'id' -> 'is'
lgtm
https://codereview.chromium.org/2555343004/diff/1/docs/language/dartLangSpec.tex File docs/language/dartLangSpec.tex (right): https://codereview.chromium.org/2555343004/diff/1/docs/language/dartLangSpec.... docs/language/dartLangSpec.tex:2622: The \code{Null} type can be assigned anywhere without complaint by the static checker. Hmm, not really. I think I'll just remove the entire rationale, since we don't need to rationalize anything at this point of the spec any more, where previously it gave a rationale for picking bottom as the static type of the null literal. https://codereview.chromium.org/2555343004/diff/1/docs/language/dartLangSpec.... docs/language/dartLangSpec.tex:7381: \item T id \NULL{} and $S$ is not $\bot$. On 2016/12/09 08:03:55, karlklose wrote: > 'id' -> 'is' Done.
lrn@google.com changed reviewers: + eernst@google.com, floitsch@google.com - johnniwinther@google.com, karlklose@google.com
LGTM, noting that we are bending the subtype rules to make them work as if we had reinterpreted every type annotation and actual type argument to mean `T | Null` when it says `T`, just so we avoid introducing a name for the bottom type, and we may have to bend them back again later.
Description was changed from ========== Make Null act like the bottom type for all the (default nullable) types. BUG= http://dartbug.com/28024 ========== to ========== Make Null act like the bottom type for all the (default nullable) types. BUG= http://dartbug.com/28024 R=eernst@google.com Committed: https://github.com/dart-lang/sdk/commit/10abaf89fd9378ff4f5d5258ba7e018f204ee4ac ==========
Message was sent while issue was closed.
Committed patchset #2 (id:20001) manually as 10abaf89fd9378ff4f5d5258ba7e018f204ee4ac (presubmit successful).
Message was sent while issue was closed.
On 2016/12/09 10:55:49, eernst wrote: > LGTM, noting that we are bending the subtype rules to make them work as if we<font></font> > had reinterpreted every type annotation and actual type argument to mean `T |<font></font> > Null` when it says `T`, just so we avoid introducing a name for the bottom type,<font></font> > and we may have to bend them back again later. hi im his wife
Message was sent while issue was closed.
On 2016/12/09 11:59:51, Lasse Reichstein Nielsen wrote: > Committed patchset #2 (id:20001) manually as > 10abaf89fd9378ff4f5d5258ba7e018f204ee4ac (presubmit successful). im his wife fuckin hello
Message was sent while issue was closed.
leafp@google.com changed reviewers: + leafp@google.com
Message was sent while issue was closed.
https://codereview.chromium.org/2555343004/diff/20001/docs/language/dartLangS... File docs/language/dartLangSpec.tex (right): https://codereview.chromium.org/2555343004/diff/20001/docs/language/dartLangS... docs/language/dartLangSpec.tex:7377: \item $T$ is \NULL{} and $S$ is not $\bot$. Should \NULL{} here be \code{Null}? https://codereview.chromium.org/2555343004/diff/20001/docs/language/dartLangS... docs/language/dartLangSpec.tex:7405: An interface type $T$ may be assigned to a type $S$, written $T \Longleftrightarrow S$, iff either $T <: S$, $S <: T$, or either $T$ or $S$ is the \code{Null} type. Why is this last bit needed, given the subtyping/assignability changes above?
Message was sent while issue was closed.
https://codereview.chromium.org/2555343004/diff/20001/docs/language/dartLangS... File docs/language/dartLangSpec.tex (right): https://codereview.chromium.org/2555343004/diff/20001/docs/language/dartLangS... docs/language/dartLangSpec.tex:7377: \item $T$ is \NULL{} and $S$ is not $\bot$. On 2017/01/18 00:58:36, Leaf wrote: > Should \NULL{} here be \code{Null}? Done. https://codereview.chromium.org/2555343004/diff/20001/docs/language/dartLangS... docs/language/dartLangSpec.tex:7405: An interface type $T$ may be assigned to a type $S$, written $T \Longleftrightarrow S$, iff either $T <: S$, $S <: T$, or either $T$ or $S$ is the \code{Null} type. It's not. Good catch. |