Commit graph

350 commits

Author SHA1 Message Date
Lasse R.H. Nielsen
89347169c7 Incorporate mixin declarations in language specification.
Change-Id: I41e8f558fd4c3145637a7d2f09cc261815ab2161
Reviewed-on: https://dart-review.googlesource.com/c/84605
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2019-01-25 09:30:51 +00:00
Erik Ernst
33ae5f0a47 Performed copyedits proposed by Patrice Chalin
.. in https://codereview.chromium.org/1217533003. Several of them were
not applicable because the text is very different today, and many were
already performed. This CL performs the missing ones.

Cf. https://github.com/dart-lang/sdk/issues/23781.

Change-Id: If356c887188368ec26755d99aa7d97fa8ea56b8c
Reviewed-on: https://dart-review.googlesource.com/c/90223
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-01-24 12:42:13 +00:00
Erik Ernst
fed59a7a8f Whitespace and formatting cleanup
This CL just changes whitespace and formatting.

In particular, it replaces \syntax{`...'} by \lit{...} as much as
possible (because it's simpler and shorter, and \lit{...} works in
some situations where \syntax{...} does not).

Change-Id: Icd241a8c9d04280ff57041450aa342eb56d34589
Reviewed-on: https://dart-review.googlesource.com/c/90742
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-01-23 17:38:25 +00:00
Erik Ernst
a12805b90f Gathered all spec snippets about operator == into one location
This was needed because we had a handful of long sentences, nearly
identical, specifying that operator == must not be overridden, except
if it's in a specific built-in class.

These locations have been adjusted several times because it's tricky,
and now we have this in just one location (so we won't forget to
include bool again, somewhere).

Note that this shows a couple of facts (this was already a consequence
of the wording in the language specification, but now it's explicit):
We can `switch` on constant lists, sets, maps, and function objects,
and similarly for element expressions in constant lists and sets, and
for keys in constant maps.

Bug: https://github.com/dart-lang/language/issues/188.
Change-Id: Ie54bce573ee577654b598926b711d6dc8eab6ff1
Reviewed-on: https://dart-review.googlesource.com/c/90462
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-01-23 13:03:36 +00:00
Erik Ernst
649c4e6c85 Revised all spec occurrences of "dynamic error"/"dynamic type error"
.. and checked that they can occur also in Dart 2; added a comment
about why this is so, on each of them. Also, got rid of the term
"run-time error": the majority of references to errors at run time
were "dynamic error", and now that is the term used everywhere.

Cf. https://github.com/dart-lang/sdk/issues/34521.

Change-Id: I7579c84a8d52199524770fb91c64804173ed533d
Reviewed-on: https://dart-review.googlesource.com/c/90243
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-01-21 12:56:31 +00:00
Erik Ernst
da6938a5b2 After some more git cl uploads, this fixes a bunch of
little problems in the spec that we have noted over time.

Fixed a couple of LaTeX mistakes; adjusted FutureOr section

The 'Type FutureOr' section was adjusted in order to avoid duplicate
subtype rules (the ones that we have had in section 'Type FutureOr'
until now are duplicates of rules in \ref{subtypeRules}).
Also changed the name of \basetype to \futureOrBase, because the former
is too generic to be helpful for readers.

Change-Id: I8d83cf1a0af275a930fbbb94cf59a9d758066583
Reviewed-on: https://dart-review.googlesource.com/c/90061
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-01-18 11:04:12 +00:00
Erik Ernst
d51a847891 Integrating generic-function-instantiation.md into dartLangSpec.tex
Change-Id: I3afa22ce86bb7e3e9a24bc995aca8610e70193de
Reviewed-on: https://dart-review.googlesource.com/c/87184
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-01-17 14:59:18 +00:00
Michael Thomsen
37e06d34b2 Create breaking-changes.md
Closes #35403
https://github.com/dart-lang/sdk/pull/35403

GitOrigin-RevId: cbf8ab36ee9e5c955405f6a7b716f4030c87a6ef
Change-Id: I024bd034ab34c92535489b97d66e8680c168f430
Reviewed-on: https://dart-review.googlesource.com/c/87168
Commit-Queue: Michael Thomsen <mit@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2019-01-17 11:56:15 +00:00
Erik Ernst
02bb4379a2 Added specification of new style function types, generalized typedefs
Change-Id: I02b86e91d0457f4f50293c8d2f609c1d9ad91246
Reviewed-on: https://dart-review.googlesource.com/c/81414
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2019-01-11 13:54:07 +00:00
Erik Ernst
f4986cc78d Fixed a couple of typos, including LaTeX error
Change-Id: I5a50f7d27dfa9642af7249ae368f7e94c960ddd0
Reviewed-on: https://dart-review.googlesource.com/c/88829
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2019-01-09 13:19:43 +00:00
Lasse R.H. Nielsen
68f77faa96 Specify that extending or implementing Function does nothing.
Change-Id: I0008f74c75da28fbf38a959e2925b72dd1dfd38f
Reviewed-on: https://dart-review.googlesource.com/c/88563
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2019-01-09 12:19:26 +00:00
Erik Ernst
cba23af8ce Adjusted spec to make it an error to have a method - getter/setter clash
Currently, this kind of clash is an error when there is a declaration
at which the conflict is known to be an error, but it was not an error
when it occurs because a class `implements` two other classes where one
provides the getter/setter and the other provides the method.

Note to implementors: The analyzer apparently already flags this
situation as an error, so the change should be non-breaking, and if
implementation changes are needed at all it would most likely only be
in other tools.

Bug: https://github.com/dart-lang/sdk/issues/35561
Change-Id: I7f55b8995829ad64b86ebf33045b235813fc5161
Reviewed-on: https://dart-review.googlesource.com/c/88455
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2019-01-08 08:46:36 +00:00
Paul Berry
5ed1c6132a Minor grammar and consistency fixes
Change-Id: I7123d1b11efe4275467617fb8602eb9d9d52956f
Reviewed-on: https://dart-review.googlesource.com/c/88290
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2019-01-04 13:22:43 +00:00
Lasse R.H. Nielsen
c565d4e477 Make the specification not mention LinkedHashSet.
It has implementation consequences to refer to classes that are not
declared in dart:core, and it increases the library/spec interaction surface.

This change removes all references to `LinkedHashSet` from the spec.
It changess the rule for when a `{}` is a set to be

    context type is a subtype of `FutureOr^\inf(Iterable<Object>)`
    and not a subtupe of `FutureOr^\inf(Map<Object,Object>)`.

That should *work* for

* `Iterable<X>`
* `Set<X>`
* `LinkedHashSet<X>`
* `HashSet<X>`
* `FutureOr<Set<X>>`

(with likely exect-type issues as usual).

Change-Id: I3074da27b36093075c8c83e9672bf2fdec135c1c
Reviewed-on: https://dart-review.googlesource.com/c/87972
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2019-01-03 10:19:24 +00:00
Erik Ernst
5b3b1996a8 Integrated generalized-void.md into dartLangSpec.tex
Also marked the feature specification generalized-void.md
as background material

Change-Id: I08c9b54d956208db5aa8e695540b0c1fc941e46b
Reviewed-on: https://dart-review.googlesource.com/c/86421
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-12-21 18:33:19 +00:00
Erik Ernst
9e48cc7f25 Adjust specification of type tests to include promotion to X & S
Addresses https://github.com/dart-lang/sdk/issues/35314.

Change-Id: I97550187255c5ac896bfea881de85c5e97e9930e
Reviewed-on: https://dart-review.googlesource.com/c/85921
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-12-20 13:33:30 +00:00
Leaf Petersen
a862e8645a Remove docs/language/informal/subtyping.md, which is now in the language repo
Change-Id: I9ccea6c780f2b47a0097e462f8d395aca565b0f4
Reviewed-on: https://dart-review.googlesource.com/c/87703
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2018-12-20 01:18:57 +00:00
Erik Ernst
5d8501a07e Integrated invalid_returns.md
Also marked feature spec as background material.

Change-Id: I130d60aea7825cbb42738e31d0a262fb18446f67
Reviewed-on: https://dart-review.googlesource.com/c/85959
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-12-17 15:01:46 +00:00
Lasse Reichstein Holst Nielsen
8dd03bee13 Add specification of set literals.
Bug: 63d164fa7a/accepted/future-releases/set-literals/implementation-plan.md (Task 10)
Change-Id: I9728706e235162318aec824484274aea58210e8a
Reviewed-on: https://dart-review.googlesource.com/c/84600
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2018-12-14 13:15:38 +00:00
Erik Ernst
825b1c0817 Corrected status of subtyping.md
Change-Id: Iaede132c879a63bd2722593b284c8a791971190f
Reviewed-on: https://dart-review.googlesource.com/c/87064
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-12-12 14:29:26 +00:00
Erik Ernst
d118c7f94e Added changelog entry for instantiate-to-bound integration + commentary
Change-Id: Ia6b39eb9087e9101c3e652e07bc62a7bbdfbb391
Reviewed-on: https://dart-review.googlesource.com/c/87062
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-12-12 14:08:52 +00:00
Erik Ernst
67217f4ef8 Integration of i2b into dartLangSpec.tex
Needs some iterations of sanity checks, but has the expected shape
for it all at this point.

Change-Id: Idd96efa95d65ad6bd202b694c9d1f297cf04a8b6
Reviewed-on: https://dart-review.googlesource.com/c/86660
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-12-12 08:48:26 +00:00
Erik Ernst
cd2e7680ed Corrected instantiate-to-bound.md.
Corrected instantiate-to-bound.md to (1) take the variance of the top level
type into account for each step of the algorithm, and (2) explicitly require
that the type yielded by the algorithm must be checked for well-boundedness;
finally (3) an example showing that we can indeed get a result which is not
well-bounded was added.

Also adjusted the terminology to be consistent with dartLangSpec.tex
(where we say 'generic type alias' rather than 'parameterized type
alias').

Change-Id: I4b4e4ee7988439e39b05514f172d69233b1695d7
Reviewed-on: https://dart-review.googlesource.com/c/80140
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-12-07 09:25:17 +00:00
Erik Ernst
00cec998f5 Integrated subtyping.md into dartLangSpec.tex
Change-Id: Ie0beb59e83f14f0786ea91e0039b96d3d8cd2968
Reviewed-on: https://dart-review.googlesource.com/c/84027
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-12-04 10:23:30 +00:00
Erik Ernst
f43c76538b TBR: Added a missing status update to the int64.md feature specification.
Change-Id: I1f735b946cef540358c867a49131f1574f5bdf8b
Reviewed-on: https://dart-review.googlesource.com/c/85176
Reviewed-by: Erik Ernst <eernst@google.com>
2018-11-22 15:31:29 +00:00
Erik Ernst
614ae7f362 Integrated covariant parameter feature specs.
Also updated spec on the static and dynamic types of functions literals
and static functions along with the function objects obtained from
closurizations of them.

Introduced a separate notion of what it means to be a correct override
relation (where the old text used subtyping, which won't suffice, for
several reasons).

Introduced the notion of interfaces as a separate kind of entity that
contains method signatures (again, a new kind of entity), thus
clarifying exactly which pieces of information is available during
static analysis of member accesses, e.g., instance method invocations.

Introduced 'combined' interfaces; they are needed for `mixin`
declarations, and we will specify them soon (so it should be OK to
have them now, even though they are unused).

Change-Id: I6347df49b1aa7a81d74e25904ee75c19e8ac6930
Reviewed-on: https://dart-review.googlesource.com/c/81263
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-11-22 13:07:59 +00:00
Erik Ernst
30c5b39d4e Integrated dynamic-members.md
Change-Id: Ic99a5def446c6d97d2e561f61c32f24bd80a9dd2
Reviewed-on: https://dart-review.googlesource.com/c/81640
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-11-14 16:02:48 +00:00
Erik Ernst
207f06ca47 Typo fix in spec, just one spurious { removed.
Change-Id: I11c468d59fc69b901a5947d06f1798984c7040c7
Reviewed-on: https://dart-review.googlesource.com/c/84429
Reviewed-by: Erik Ernst <eernst@google.com>
2018-11-14 14:46:09 +00:00
Lasse R.H. Nielsen
38d92ddb6c Allow Type objects as case expressions and constant map keys.
This is already implemented by all platforms and may be in use.

Also clean up redundant requirements for constant literals and
object expressions. There is no need to check whether `x` is constant
in order to allow `const [x]` as a potentially constant expression.
We will get a compile-time error anyway if it isn't, because that is
written explicitly for constant map literals.
Similarly for map literals and constant object expressions.

Change-Id: I425489ff3c0063fa59937978267b13ee68aa039d
Reviewed-on: https://dart-review.googlesource.com/c/81274
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2018-11-06 07:28:13 +00:00
Erik Ernst
09a44b8da2 Fixed a typo level problem with an Index and a spurious comment.
Change-Id: Ie48f7ee835fbff29e00b57424816f193141d37fd
Reviewed-on: https://dart-review.googlesource.com/c/82641
Reviewed-by: Erik Ernst <eernst@google.com>
2018-11-02 16:30:43 +00:00
Michael Thomsen
4324bd1fd1 Fix dead link in mixin-declaration
Closes #35033
https://github.com/dart-lang/sdk/pull/35033

GitOrigin-RevId: cd896d93a94bbc3ea299de98084b5390be3379a7
Change-Id: I40b9f2fc9ffca03ea0a11093d8b7314443cfc8a0
Reviewed-on: https://dart-review.googlesource.com/c/82620
Reviewed-by: Michael Thomsen <mit@google.com>
2018-11-02 14:16:10 +00:00
Erik Ernst
33c321892c Cleaned up some terminology, whitespace, and added index.
Changed "compile-time warning" to "static warning"; eliminated spurious
space at the beginning of each normative paragraph; added index and
changed all `{\em ..}` containing defining occurrences of words and
phrases such that they are added to the index and marked with a
diamond in the margin (to make it easy to spot definitions).

Change-Id: I688561a24d2b9955f383d6c8db2c913353d41b4b
Reviewed-on: https://dart-review.googlesource.com/c/82501
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-11-02 12:11:41 +00:00
Jonas Termansen
c0db4903cf Merge remote-tracking branch 'github/master'
Close unpaired opening parenthese and fix mispelling (#30406)


Create experimental flags documentation (#34921)

* Create experimental-flags.md

* 80 cols

* Review feedback from Devon

* Update experimental-flags.md

* Remove short form (-e)

Change-Id: I808296c4517e621ba21520bb94cb9b9778e6fd1e
Reviewed-on: https://dart-review.googlesource.com/c/82582
Reviewed-by: Michael Thomsen <mit@google.com>
2018-11-02 10:15:26 +00:00
Erik Ernst
117c23fddb Corrected nSM forwarder rules cf. #34962
Change-Id: Ic1b6bb8fb1bbc18df3840d4af30878fd3be7aa98
Reviewed-on: https://dart-review.googlesource.com/c/82042
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-10-30 10:42:34 +00:00
Erik Ernst
57f895c7a4 Bounds of a generic type alias ensure the body is regular-bounded
The analyzer enforces the rule that when a generic type alias F has
formal type parameters X1..Xm with bounds B1..Bm, if we assume that
X1..Xm are types satisfying the corresponding bounds then it must be
the case that every type which occurs in the body of F must be
regular-bounded.

In other words, the bounds on the left hand side of `=` must imply
the bounds applicable to every type on the right hand side.

---------- NEW TEXT ----------

I just discovered that it is _not_ possible to skip the check on
every super-bounded parameterized type based on a generic type
alias: It is certainly possible to have a type which is correctly
super-bounded according to the type parameter bounds on the left
hand side of `=` in the type alias declaration, and still have a
right hand side where some types are not well-bounded. Consider the
following declarations:

  class B<Y1 extends Y2, Y2, Y3 extends num> {}
  typedef F<X extends num> = B<num, Object, X> Function();

According to the declarations to the left of `=`, `F<Object>`
is a correct super-bounded type, because it is not
regular-bounded (`Object <\: num`), and `F<Null>` is regular-bounded
(`Null <: num`).

Also, when the declared bound of `X` is satisfied, we are
guaranteed that each type on the right hand side is regular-bounded
(if parameterized, it receives type arguments that satisfy all
the specified bounds).

But consider the result of applying `F` to `Object`:

  B<num, Object, Object> Function();

That's not a type where all subterms which are types are
well-bounded:

  B<num, Object, Object> is not regular-bounded because
  `Object <\: num` (third type argument).

  B<num, Object, Object> is not super-bounded because
  B<num, Null, Null> is not regular-bounded because
  `num <\: Null` (violating `Y1 extends Y2`).

So there is no way we can prove that this check can be skipped,
because we have a pretty simple counter-example!

I'm currently adjusting the text to re-introduce the check.

---------- OLD TEXT, NOT VALID ----------

This must be specified, because it justifies the _removal_ of a
requirement that we had in the feature specification
super-bounded-types.md: It was required for every application of a
generic type alias F to a list of actual type arguments <T1..Tk>
such that the resulting parameterized type F<T1..Tk> was
super-bounded that both the parameterized type F<T1..Tk> and every
type in the resulting type [T1/X1..Tk/Xk]U (where U is the body of
F and X1..Xk are its formal type parameters) be well-bounded.

But when the bounds of F imply satisfaction of the bounds of all
types that occur in the body of F, it's trivially true that all
types in the resulting type are regular-bounded for the result
of substituting Null for covariant top types and Object for
contravariant Null for every super-bounded F<T1..Tk>. I'm looking
into a proof sketch for the result that this implies that any
well-bounded generic type alias application yields a type that
contains only well-bounded types.

This would be a very welcome simplification (because it was an
inconvenient complication that we had to check both the left hand
side and the right hand side of a type alias whenever we
encountered a super-bounded type expressed via a type alias), and
I believe that it will also make the tools run faster (because they
can now skip all those checks of every type that occurs in the body
for every super-bounded usage of a type alias.

Change-Id: Icd70649ebaed41b193aeb0cb6f08d06aed0ee5bd
Reviewed-on: https://dart-review.googlesource.com/c/79743
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-10-24 10:32:38 +00:00
Lasse R.H. Nielsen
d693742648 Specify for all literals whether the object overrides Object.==.
Also mention it in the `external const factory Symbol` constructor.

This only relevant for constant expressions that may be used as
switch case expressions or constant map keys.

See #32557.

Bug: http://dartbug.com/32557
Change-Id: Ie82799f3f0d39c21c10765338a7dfeb74a582add
Reviewed-on: https://dart-review.googlesource.com/c/81242
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2018-10-24 09:07:50 +00:00
Erik Ernst
e4e82da85d Changed dartLangSpec errors to warnings
Partially resolves issue #34349.
Also note that #34365 and #34319 are affected by this change.

Change-Id: I1d9023464090ff2c07f9dc062353202ddb82ba25
Reviewed-on: https://dart-review.googlesource.com/c/78121
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-10-24 07:13:32 +00:00
Lasse R.H. Nielsen
af8e29142b Respecify where type promotion happens.
This makes some parts of the specification explicit,
and rephrases it so that it is easier to recognize the separate cases.

Change-Id: Ifdbb5c11ec3b3fe80737642f230ee291a18a5841
Reviewed-on: https://dart-review.googlesource.com/c/80824
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2018-10-22 12:33:56 +00:00
Erik Ernst
ade528c4e6 Fixed the type alias omission in the def. of simple bounds
Cf. SDK issue 34722, where the need for this clarification arose.

Change-Id: I3b1692931506410e77c59004b1ed1981a17a6f3d
Reviewed-on: https://dart-review.googlesource.com/c/78982
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-10-12 08:10:45 +00:00
Erik Ernst
7c7df7bfa4 Add initial version of feature specification on interface conflicts.
This feature specification is intended to resolve bullet item 2 in
the issue https://github.com/dart-lang/sdk/issues/31228.

A rendered version corresponding to patch set 16 is available at
https://gist.github.com/eernstg/a55c8000610a506bf0ca70b028d9f1eb.

Change-Id: I7d3e67bd7dd2d2cfc73fbd491bcfbea1814421e0
Reviewed-on: https://dart-review.googlesource.com/c/40080
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-10-11 13:32:00 +00:00
Lasse R.H. Nielsen
23c36ed029 Elaborate that -0 means -0.0 in double context or when compiled to JS.
Also fix some typos.

Change-Id: Id8ed6d22c9e7c900c4062b2cbc5b68abf93d11ba
Reviewed-on: https://dart-review.googlesource.com/c/77080
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2018-10-11 10:24:29 +00:00
Erik Ernst
a9b47bd0b1 Integrated nosuchmethod-forwarding.md into dartLangSpec.tex
Change-Id: I7a29b83a69f43cb695b4305442808fa45b745faa
Reviewed-on: https://dart-review.googlesource.com/c/77440
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-10-10 13:35:50 +00:00
Erik Ernst
6e561b75a1 Corrected several near-typo errors in Redirecting Factory Constructors
Change-Id: I0a09a55e3f0941309a107669513895911c18d27a
Reviewed-on: https://dart-review.googlesource.com/c/78463
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-10-08 11:19:50 +00:00
Erik Ernst
62e67d7277 Adjusted instantiate-to-bound.md such that it covers type aliases
The existing version covers generic classes only, but we should
use exactly the same rules for parameterized type aliases, which was
actually already specified in all the nested cases (e.g., `A` would mean
`A<F<dynamic>>` with the declarations `typedef F<X> = X Function();` and
`class A<X extends F<X>> {}`, but there were no rules for a plain `F`).

A rendered version corresponding to patchset 3 is available here:
https://gist.github.com/eernstg/6deffcde2cbe79f8ba499b3aac950900

Change-Id: Ic265ccc736c65361919e860b1ab7ecb947c2c066
Reviewed-on: https://dart-review.googlesource.com/c/76660
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-10-03 10:49:32 +00:00
Erik Ernst
0a2659942e Adjusted terminology to emphasize "compile-time constant" in commentary
.. and always use a plain `constant` in normative text. Also fixed a few
LaTeX issues.

Change-Id: I5682f5c5b22120691c620144318f0670c4ba0a24
Reviewed-on: https://dart-review.googlesource.com/76980
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-09-28 12:54:23 +00:00
Lasse R.H. Nielsen
0808d29b4e Update spec of potentially constant and compile-time constant expressions.
The existing specification was underspecifying potentially constant expressions,
effectively relying on evaluation to determine whether an expression was
potentially constant.

This change specifies potentially constant recursively using only the syntax
of the expressions.

Adds short-circuting to `?:`, `??`, `||` and `&&` expressions,
so for `String x`, the expression `x != null && x.length > 0`
is compile-time constant.
The original specification requred evaluation of the latter half
even when `x` is null. We can now avoid this because we can require that the
unused expression is a potentially constant expression without having to
check if it, or any part of it, is a compile-time constant expression.

Allows `x == null` and `x != null` as compile-time constant expression
independently of the type of `x`.

Allows `e as T` as a compile-time constant expression. Types are more
important in Dart 2, so you need a way to adjust typing in some cases,
even in compile-time constant expressions.

Change-Id: I02bf0b77013c3b3ced8cd46334db378787cc2d57
Reviewed-on: https://dart-review.googlesource.com/36220
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-09-26 14:17:39 +00:00
Erik Ernst
e05f1fc32d Adjusted superclasses to make a mixin application superclass abstract
We should avoid the situation where `class C extends A with M {}`
requires generation of noSuchMethod forwarders _in the superclass
`A with M`_ when neither `A` nor `M` has an implementation of
`foo`, but `A with M` has a non-trivial noSuchMethod.

If we _do_ generate those nSM forwarders, that will just obscure that
any attempt to invoke `super.foo()` in `C` should be an error.

Note that this is about generating forwarders _in the mixin application
which is the superclass_, it is not about copy-down of forwards from
the class `M` that was used to obtain the mixin in the first place.

Also note that it would be inconvenient to require all methods to be
implemented in `A with M` as used in `abstract C extends A with M {}`,
and it would also be rather funny if we were to say that `A with M` is
abstract when `C` is abstract, and concrete when `C` is concrete.

So I think the only reasonable choice is to make those superclasses
which are mixin applications abstract.

Note that dart:mirrors ought to reflect this, in a separate issue,
if it is not already the case.

Change-Id: If221b2c73b17bd55017d4d5ee4fdb8daf203e195
Reviewed-on: https://dart-review.googlesource.com/76640
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-09-26 13:44:28 +00:00
Erik Ernst
4816b607a5 Eliminate checked mode and production mode
Also update type dynamic and other sections especially affected.

Change-Id: I432992b8190f13b2aea73d524fc9b17d3ef24b41
Reviewed-on: https://dart-review.googlesource.com/75340
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-09-26 13:13:26 +00:00
Erik Ernst
f4dfb6176f Corrected the "reusing part" error to take exports into account.
Also corrected some "includes" to "has" when talking about members of
an interface.

Change-Id: Ib8917c2a9f40fce82ab1e41e0e766c87065b168a
Reviewed-on: https://dart-review.googlesource.com/75880
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-09-24 10:07:46 +00:00
Erik Ernst
c3c4e63ce4 Adjusted spec to use package syntax, thus eliminating bnf.sty
Also fixed many syntax related glitches.

Change-Id: I926b93a54ad28d05389a44c969fc2288933f8584
Reviewed-on: https://dart-review.googlesource.com/75580
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-09-20 11:12:14 +00:00