Commit graph

324 commits

Author SHA1 Message Date
Erik Ernst
bfa8be887a Extending dartLangSpec.tex with super-bounded types and variance.
Change-Id: I09d01a21f8b227d46ddafedea223b1c765a1d29c
Reviewed-on: https://dart-review.googlesource.com/56981
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-06-05 15:23:06 +00:00
Erik Ernst
6f68bec1bc TBR: Typos fixed
Change-Id: I8c48953541a36f516d7a9bd27de85193bf189930
Reviewed-on: https://dart-review.googlesource.com/57825
Reviewed-by: Erik Ernst <eernst@google.com>
2018-06-01 15:15:32 +00:00
Lasse R.H. Nielsen
dd83e698d8 Add 64-bit integer semantics to the specification.
Change-Id: I4dd2dfece2a78a4f96074886771036ee2942470f
Reviewed-on: https://dart-review.googlesource.com/38020
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2018-06-01 08:49:57 +00:00
Erik Ernst
715c14c967 Added changelog entry for member conflict updates
TBR: This CL only adds a missing changelog entry for the commit
08c893d55b.
Change-Id: I4963dbebc090e95b26ce043586cfa2db0df95f3c
Reviewed-on: https://dart-review.googlesource.com/57502
Reviewed-by: Erik Ernst <eernst@google.com>
2018-05-31 07:14:39 +00:00
Erik Ernst
08c893d55b Simplify class member conflict rules.
As of patchset 5: The ruleset concerning class member conflicts
(apart from simple name clashes) has now been simplified
considerably, and it's expressed in one location, in a new section
(the locations where we previously had such rules are now
`\commentary{}` with a reference to the new section).

The old rules and the new simplified rules specify the same set
of conflicts (in that sense, patchset 4 == patchset 5).

The old description below gives details about what was changed
from the start of this CL until patchset 4.

------------------------------- OLD description:

Added conflict for constructor and setter with "the same name".

Discussed the inconsistent approach to conflicts between named
constructors and instance members with Lasse; we agreed that it
is confusing if we allow the constructor `C.n` to coexist with the
instance method/getter `n` and instance setter `n=`, except that
they must be inherited rather than declared in the enclosing class
`C`, so I adjusted the wording such that only _static_ members
conflict with named constructors.

One more reason why there is no conflict between `C.n` and an instance
member named `n` or `n=` is that the latter can _never_ be denoted
by `C.n` (but static members can be denoted by `C.n`, also in `C`).

Change-Id: I012e772ae6473fddd8f9944553d69e6a6ceeb2f9
Reviewed-on: https://dart-review.googlesource.com/56800
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-05-31 06:54:58 +00:00
Erik Ernst
e20189ecf5 Adjusted the instantiate-to-bound algorithm to break cycles at
every member, not just one.

Note that a fresh copy of this document with rendering is available
at https://gist.github.com/eernstg/6deffcde2cbe79f8ba499b3aac950900.

Change-Id: Ia7e3d8e2c36b254102e2c1cc5dafc4572746079d
Reviewed-on: https://dart-review.googlesource.com/43100
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-05-28 16:01:45 +00:00
Erik Ernst
640791c922 Add example to docs/language/informal/super-bounded-types.md.
This CL adds an example to super-bounded-types.md in order to motivate
the definition of what it means for a parameterized type based on a
type alias to be super-bounded. The definition says that we must check
the actual type arguments relative to the formal type parameter
list of the given `typedef` as well as the right hand side, replacing
the formals by the given actual type arguments. The example shows that
the right hand side can be ill-bounded even though the check that we
apply based on the formal type parameter bounds (that is, the check
that we apply to class types) succeeds.

A rendered version of super-bounded-types.md corresponding to patchset
6 is available here:
https://gist.github.com/eernstg/fc12eeb23064a2578a936b443461dde4.

Change-Id: I33dc6ced592f53160bc6f933558bfface46cd329
Reviewed-on: https://dart-review.googlesource.com/56668
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-05-28 10:12:34 +00:00
Erik Ernst
6ed3b162d6 Added feature specification for upper/lower bounds of top/bottom types
A rendered version can be found here, and it was updated to match
patch set 12:
https://gist.github.com/eernstg/df0d69c85724e1179835a43bf9e63adc

The issue where this topic was raised is
https://github.com/dart-lang/sdk/issues/28513.

Change-Id: I21e4df42348a51f482c42d1c29595e475823e5dc
Reviewed-on: https://dart-review.googlesource.com/53211
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-05-25 16:05:20 +00:00
Erik Ernst
e8bb129816 Adjusted setter conflict specification, cf. #33077
Change-Id: I76b709a3ef4b7c542f83912b0bdeddb1bbf34448
Reviewed-on: https://dart-review.googlesource.com/54410
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-05-24 13:54:09 +00:00
Lasse R.H. Nielsen
43635d3372 Update spec on interface, mixin and async.
Change-Id: If445e1c154fc5b99b59d96ec3338f4273ee431dc
Reviewed-on: https://dart-review.googlesource.com/55282
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2018-05-16 19:09:52 +00:00
Erik Ernst
2f781e46b0 Introduced support for metadata on enum values
Change-Id: Ib39a11356f0c356cdca609da0392c168d1c0f20c
Reviewed-on: https://dart-review.googlesource.com/54242
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2018-05-09 08:27:08 +00:00
Erik Ernst
543d8775e3 Clarify that global/local/static functions can also be closurized
This CL changes dartLangSpec.tex to say that 'closurization' takes
place (rather than just saying that it's a 'function') when a
global/local/static function is torn off, just like it always did
for instance methods. Also, it standardizes on using the phrase
'function object' to denote the run-time entity obtained from such
a closurization.

This addresses the non-generic parts of the request in #31665.

Change-Id: I6967a74df178fbb26af0f572b0471219d3169e4f
Reviewed-on: https://dart-review.googlesource.com/46860
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-05-04 13:57:15 +00:00
Erik Ernst
46a9ed0617 Added example about calling a tear-off with a wrong-shape argument list
The rendered version has been updated: https://gist.github.com/eernstg/683310d8de99089ec3d05f3f4954c151

Change-Id: Id556e6d4dcd30c2da3f434049242bfbed6363341
Reviewed-on: https://dart-review.googlesource.com/47800
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-05-03 11:57:17 +00:00
Erik Ernst
6802746ad7 Fixed a couple of typos in subtyping.md
Sergey pointed out a couple of name clashes, and I renamed some indices
in order to avoid them. At the same time, I fixed a couple of typos
and adjusted the whitespace to be more similar to other *.md files.

Finally, I adjusted the wording involving 'algorithmic' and 'syntax
directed' in order to make it explicit that they stand for the same
thing.

Change-Id: Ic03b907f4bdc722d9ba218d38077addf9cc4a777
Reviewed-on: https://dart-review.googlesource.com/50981
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-04-13 05:59:02 +00:00
Erik Ernst
cf93009caf Removed the magic const feature from implicit-creation.md
Here is a rendered version of the document which was
updated to match patch set 7:
https://gist.github.com/eernstg/cc2e6bc384fc722416a5fb58a1166034.

Change-Id: I2902fe4fcb86d01b4fe70ba1aab0d749f833ff39
Reviewed-on: https://dart-review.googlesource.com/49903
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-04-10 14:33:56 +00:00
Erik Ernst
4b2b15f53e Clarify that mixin application drops static members
Change-Id: If0adcdb9423d856d629dd8002ba843697dafb770
Reviewed-on: https://dart-review.googlesource.com/49360
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-04-04 12:26:51 +00:00
Lasse R.H. Nielsen
289a3d2799 Remove ~/ special casing in static type system.
The "special case" text just says that the return type of `~/` on `int` is `int`, which is also its declared type, so the text isn't necessary.

Bug: http://dartbug/com/15650
Change-Id: Iba7fcc621e27dcba24dfdede2a0960f2f5ecd2f9
Reviewed-on: https://dart-review.googlesource.com/48144
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2018-03-23 22:39:29 +00:00
Erik Ernst
472ec7780f Added first draft spec of dynamic-members.md
In response to the discussions in SDK issue 32414 about the typing of
members of `Object` when the receiver type is `dynamic`.

A rendered version of this document is available at
https://gist.github.com/eernstg/fc0094b0230ea18b9507092e50dab537
(uploaded as of patchset 6).

Change-Id: I3a74ecd5e7c9c9c05fadda5b1fa0d644561796e9
Reviewed-on: https://dart-review.googlesource.com/46247
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Jenny Messerly <jmesserly@google.com>
2018-03-14 16:50:03 +00:00
Erik Ernst
7d07f8d68b Add new allowed placements of void expressions for void-to-void flow.
As an example of a void-to-void data flow, consider `void x = foo();`,
where `foo` has return type `void`. In general, a void-to-void data
flow is a computation which is trivial (we may select one of two
branches in a conditional expression and otherwise only pass the value
on without any computation) where the expression being evaluated has
type void, and the target that receives the value is also of type
void.

This CL makes adjustments to generalized-void.md such that void-to-void
data flows are allowed.

Change-Id: Ia1722cd399c77c57cc5c61e9c10b7a84a18fe107
Reviewed-on: https://dart-review.googlesource.com/38060
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2018-03-14 16:46:40 +00:00
Leaf Petersen
c8ee601268 Add feature specification draft for Dart 2.0 subtyping
This is a draft of a feature specification for the Dart 2.0 subtyping
relation.

See https://github.com/dart-lang/sdk/blob/2_0_subtyping/docs/language/informal/subtyping.md
to preview the markdown during review.

Bug:
Change-Id: Ib67fdb22b68a45e8dc1c1831326c82e735c89404
Reviewed-on: https://dart-review.googlesource.com/30927
Reviewed-by: Erik Ernst <eernst@google.com>
2018-03-06 00:02:38 +00:00
Leaf Petersen
fdaaa874a0 Draft feature specification for mixin inference
Change-Id: I0c1aa6877cc4b33adcd0be15800d93667d149545
Reviewed-on: https://dart-review.googlesource.com/38940
Reviewed-by: Erik Ernst <eernst@google.com>
2018-02-23 05:56:03 +00:00
Erik Ernst
f5a00ae3a8 Removed references to FutureOr<void> from generalized-void.md
It turns out that the special case for FutureOr<void> that I added in
https://dart-review.googlesource.com/c/sdk/+/35920 was misunderstood,
nobody really wanted it.

This CL removes all references to `FutureOr` in generalized-void.md,
which removes that special case and also the concept of types that are
"void equivalent" (because such types are not used any more).

The message here is that we are now more consistent in our protection
of developers against accidentally discarding a value which is
meaningful (just like `void foo() { return 42; }`), because they've
forgotten that the return type is `void`.

Change-Id: Ia4e6e00b2d33ff434923de7eb78d000cd7cc1c3e
Reviewed-on: https://dart-review.googlesource.com/41822
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-02-22 07:58:19 +00:00
Erik Ernst
38698fcf90 Fixed two typos (=> LaTeX failures) in dartLangSpec.tex
Change-Id: Ie3a711790d56cad9b2a5c21c35aae38956a69f41
Reviewed-on: https://dart-review.googlesource.com/42243
Reviewed-by: Erik Ernst <eernst@google.com>
2018-02-19 16:24:07 +00:00
Erik Ernst
cec672c793 Modified description of \CALL{} for new treatment of callable objects
Change-Id: I6cc412bcdeb9772af598fbb1309cafaf490c487f
Reviewed-on: https://dart-review.googlesource.com/41360
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-02-19 14:47:48 +00:00
Lasse R.H. Nielsen
63c6851dd0 Update induced mixin application constructor definition.
Change-Id: Ic6eeffd2e3d348f636af5ab4644cc60b87e85506
Reviewed-on: https://dart-review.googlesource.com/29060
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2018-02-19 10:47:19 +00:00
Erik Ernst
c01d59bc7e Adjusted generalized-void.md to make for-in on a void iterator an error, except when the iteration variable has type void.
A similar rule applies to asynchronous for-in loops.

Change-Id: I88ba234c27a38167eaac0350d269e88894a0fe9e
Reviewed-on: https://dart-review.googlesource.com/35920
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2018-02-14 18:44:03 +00:00
Erik Ernst
9f9987f709 It is now an error to have void foo() { return 42; }
The language team several times agreed to make it an error when a
non-void expression `e` is used in `return e;` in the body of a
function whose return type is `void`.

When `void` is changed from a near-bottom type to a top type, the
wording in the language specification (dartLangSpec.tex) does _not_
ensure that this is an error, because all types are assignable to
`void`, so we need a specific rule saying that it is an error.

This CL adds such a rule to the feature spec for generalized void.
It also adds a rule that makes it an error to have return type `void`
in a function marked `async*` or `sync*`, based on the reasoning
that they "are returning a Future/Stream/Iterable semantically",
and it would now be an error if they did that explicitly.

Change-Id: I22fed9e9fc6097bb50100a151b964045e41ef173
Reviewed-on: https://dart-review.googlesource.com/35680
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2018-02-14 11:15:12 +00:00
Erik Ernst
6e3a274c5f "Magic" implicit creation.
Description which is relevant as of January 2018:

The more aggressive approach where `const` is inserted whenever
possible (for instance creation expressions) and whenever required
(for composite literals), and `new` is inserted otherwise, is now
the agreed policy. This means that the remaining discussion is on
the specification of this policy, not the policy itself. This has
been true approximately since Dec 1st, 2017.

Here is a brief overview of the feature which is specified in the
document added by this CL:

The introduction of 'implicit creation' adjusts the grammar such
that instance creation expressions (such as `new C()`) can always
omit the keyword (`new` or `const`). The semantics is that these
expressions will still invoke the same constructor (which may
produce a fresh instance in case of a generative constructor, and
some object that may or may not be new in case of a factory),
as if `new` or `const` had been added implicitly. The choice of
whether to add `new` or `const` is made according to the policy
described above.

----------------------------------------------------------------------
Original description, FYI:

Copy of Rietveld 3012703002: magic optional const

Adjusted informal spec optional-new to insert `const` whenever possible

The current version of optional-new.md specifies that `const` should be
inserted into certain syntactic phrases (when specific identifiers
satisfy some constraints), but only when these phrases occur in a const
context.

This CL changes that approach and specifies that `const` should also be
inserted outside const contexts, if the resulting expression is a
correct constant expression.

We haven't yet decided on whether we want the current (predictable)
model or we want the more "magic" one specified in this CL; this CL
is intended to be landed if we choose the latter, and discarded if we
choose the former.

Change-Id: I602e7eaf3d4c7904277af45c6f62089c77bd5117
Reviewed-on: https://dart-review.googlesource.com/3160
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-02-12 09:03:00 +00:00
Erik Ernst
b70145b56a Adjust covariant-from-class.md to specify strict overriding.
The covariant parameter related feature specs were written to specify
that overriding admits a type annotation `T` on a formal parameter as
long as `T <: S` or `S <: T` for every type annotation `S` on a
corresponding formal parameter in an overridden declaration (directly
or indirectly).

This CL changes the rules such that a covariant-from-class parameter
must satisfy the standard constraints (contravariance) instead, which
is needed in order to ensure that an important optimization (on self-
sends) is valid.

This makes the spec follow the actual implementation, i.e., the change
will not break any existing software.

Change-Id: Ic871cc16c09220a385d68d9ec32c7a06683db87b
Reviewed-on: https://dart-review.googlesource.com/37664
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2018-02-07 17:43:29 +00:00
Erik Ernst
9f803a36eb Adjusted status indications on feature specs
The Dart 1 specification of 'generic method syntax' had no status
indicator, it is now marked as 'background material' because generic
methods (in full) have been integrated into the language specification.
Several other changes of a similar nature.

Implication: It should now be possible for readers of these documents
to trust their status indication. As we go, we will need to update them
again, especially when something is integrated into the language
specification.

Do we want to migrate background material to another directory? Do we
want to rename the directory `informal` to `feature` or somesuch?

Change-Id: Ia3851bdbe7b5a46d71848c376906f95feb4db349
Reviewed-on: https://dart-review.googlesource.com/34663
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-01-16 13:22:28 +00:00
Lasse R.H. Nielsen
c0d2671872 Make it clear that you are not allowed to have spaces in operator-names.
Remove places where you were technically allowed to add spaces between
individual characters, but no implementation actually allowed it.

Change-Id: I0a13c9e3995b897135cd578a7d8c114f7746f991
Reviewed-on: https://dart-review.googlesource.com/34640
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2018-01-16 09:34:41 +00:00
Erik Ernst
d830c8ba3c Removed merge conflict markers.
Change-Id: I1feda4f3104ca100425233fb7f339a412a885f9f
Reviewed-on: https://dart-review.googlesource.com/34743
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2018-01-15 21:21:20 +00:00
Lasse R.H. Nielsen
3727e4d28b Update specification of system/non-system import conflict to not cause warning.
Change-Id: I089561ce2770a12549476687bb0ef3d78f9cc1e1
Reviewed-on: https://dart-review.googlesource.com/33840
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-01-15 15:21:51 +00:00
Erik Ernst
673d5f0a66 Adding generic methods to the language specification.
Change-Id: I49404e81258fc688caef5c044ff70e52508a4423
Reviewed-on: https://dart-review.googlesource.com/14525
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2018-01-11 16:15:58 +00:00
Erik Ernst
38dcb10543 Clarified that non-abstract noSuchMethod counts more than abstract.
Change-Id: Ic8e6fc0c43267239d385b451c571c8a4ce9340b3
Reviewed-on: https://dart-review.googlesource.com/32763
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-01-11 13:13:38 +00:00
Erik Ernst
af430f37a8 Added informal specification of super-bounded types.
Change-Id: I4764faa8250af61bf8cda9cf6a854e2bd7d726f2
Reviewed-on: https://dart-review.googlesource.com/14042
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2018-01-11 09:16:11 +00:00
Erik Ernst
dd3f935cf5 Now specifying void return type for setters and operator []=
Change-Id: Id2e8b3314eb5bba4ebf82286c0f8228db2235af0
Reviewed-on: https://dart-review.googlesource.com/32603
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
2018-01-08 12:38:22 +00:00
Lasse Reichstein Holst Nielsen
d7e50427b3 Change wording on main functions.
Change-Id: Ib61178a8b3c4f2adfa994d00e24b3320fd7f9cfc
Reviewed-on: https://dart-review.googlesource.com/25400
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2017-12-19 11:54:22 +00:00
Lasse Reichstein Holst Nielsen
90dc2101a6 Update FutureOr for Dart 2.
Change-Id: Ic12f3dfa558ff34f90a64724658c572942e77c9f
Reviewed-on: https://dart-review.googlesource.com/25301
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2017-12-07 19:36:42 +00:00
Erik Ernst
a6d422957d Adjusted nosuchmethod-forwarding.md
This CL changes said document to drop support for requested generation
of forwarder in case of a conflict. Developers must then write a
disambiguating method implementation themselves.

Note that this is what we already agreed during discussions about
this feature, but I noted that it hadn't yet been written into the
document.

Also changes the status to 'under implementation'.

Change-Id: I31b3dd8d65438484824225ad7067d36462d26aa7
Reviewed-on: https://dart-review.googlesource.com/22421
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2017-12-01 12:39:19 +00:00
Erik Ernst
db383f64ad Fixed many whitespace issues in dartLangSpec.tex
In dartLangSpec.tex there used to be many white space anomalies, e.g.,
double  spaces  between words with no apparent justification


or multiple empty lines
  or lines starting with indentation that wasn't justified by any
consistent rule that I could spot.

This CL fixes that.

It also adjusts the grammar rules to be formatted in a systematic way
which will be helpful for an update to use something else than
bnf.sty (that we can't distribute due to license problems).
In particular, when a right hand side is too long for one line it used
to flow into the next line just like text (so non-terminals would have
`-` inserted at locations where a natural language algorithm thought
the "word" could be split in two, and the indentation on the next line
was nonsensical). So now it uses `\gnewline{}` ("grammar newline") to
switch to a new line and indent somewhat. It also uses `\gcomma{}` to
produce a quoted comma (which otherwise looks funny, because the `,'
becomes more like `,  ' because the comma has a sort of built-in space
after it).

The command `\cd{...}` is gone and `\code{...}` is used everywhere.

Every sentence is now terminated by a newline. This doesn't mean that
every line is <80 chars, but it is at least much more readable (in
an editor whose window is really big), and it's consistent with the
more radical changes that we have made whenever we have made bigger
changes to a paragraph.

Finally, all comments on interface injection and all comments on
spread and rest arguments have been deleted. These comments contained
considerations about said features, but they did not contribute to
the discussions that we have had about the same or similar topics
(in particular because the comments relied on assumptions that do
not hold any more).

So it's a big diff, but a huge portion of it is white space fixes,
and the rest is very systematic. So it should be bearable, and we
would surely need to do the same things over time, otherwise.

Change-Id: Ia5922c22cb496792d394e76ce8c7bca7df1b4cc8
Reviewed-on: https://dart-review.googlesource.com/25000
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2017-12-01 09:44:18 +00:00
Lasse Reichstein Holst Nielsen
7f89be22aa Make the *flatten* function not be recursive.
Update `return e;` in `async` function to do an implicit await if the value is async.
(We can make it an explicit await that also waits if it's not a future).

Make it explicit that we don't allow two different instantiations of the same interfaces.

Change-Id: I66de9ec55c1d55523d91e6d2bbebcb7d02ef301f
Reviewed-on: https://dart-review.googlesource.com/23663
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2017-11-30 22:10:26 +00:00
Erik Ernst
062e5d6db3 Now explicitly defines variant occurrences of type parameters.
The discussion about SDK issue 31305 showed that the definition of
covariant/contravariant/invariant occurrences need to be given
somewhere, and also that covariant-from-class.md is a reasonable place
to put it.

This CL adds those definitions there, based on Leaf's proposal in the
above-mentioned issue, and adjusts the definition of what it means to
be a covariant parameter such that the case where the relevant type
parameter occurs in the bound of a formal type parameter in a function
type is taken into account.

(It also reformats the document to stay within 80 columns and follow
the style of newer informal specs more closely, but that should be
easy to skip over because Gerrit colors white space changes
differently from "real" changes).

Change-Id: I0b0a688c616d0bb56755ceea08e1792abfa7936d
Reviewed-on: https://dart-review.googlesource.com/23422
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2017-11-24 09:21:47 +00:00
Kevin Millikin
9f19d1e30a Be consistent about use of null in the spec
The spec would sometimes use the reserved word (boldface) null, which
is an expression, when it really meant the value of that expression.
Since that value has a defined name, "the null object", use it
correctly and consistently.

The spec would also use the phrase "the null value", which presumably
just meant the null object.  Replace occurrences of this phrase with
"the null object".

Bug:
Change-Id: Ibadeb97fe3bec67cd77d6a8d6c57e922cea265d3
Reviewed-on: https://dart-review.googlesource.com/22461
Commit-Queue: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2017-11-21 15:42:48 +00:00
Erik Ernst
9bd60376ef Clarified examples in covariant-from-class.
Change-Id: I6bbf51b7f3c5fd46d8ce59e860cf615e26308560
Reviewed-on: https://dart-review.googlesource.com/21346
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2017-11-16 13:25:52 +00:00
Erik Ernst
ba77483022 Adjusted def. of "a superclass" in the language specification.
Cf. SDK issue 25839.

Change-Id: I41aaecdb206c599f0deca6facb074c8d4f960529
Reviewed-on: https://dart-review.googlesource.com/21347
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2017-11-16 13:01:42 +00:00
Erik Ernst
f68e5231b4 Renewed tests from built_in_identifier_prefix
The test language_2/built_in_identifier_prefix_test stated 'it is not
illegal to use a built-in identifier as a library prefix', which has
been untrue for quite a while, and then proceeded to check a number of
cases where said situation was used in practice. All of that is now
obsolete, so that test was split into several tests, each of which was
adjusted to test something which is relevant today.

The new tests include checks for the use of "known" identifiers (such
as `of`, `show`, `on` and a few more) which are mentioned explicitly
in the grammar, but which are neither built-in identifiers nor
reserved words.

The new tests gave rise to a number of status entries, including 25
crashes (so it is not just "expect `MissingCompileTimeError` here
because it's not strong mode").

Note that `Function` is considered to be a built-in identifier.
This makes no difference for the grammar, but it means that there
are no cases where `Function` is used as a library prefix.

If we insist that `Function` cannot be a built-in identifier then
we just need to add a few more grammar rules to all such things as
`import .. as Function;`, but I considered it less confusing to
include `Function` among the built-in identifiers and avoid adding
support for this.

Note that we haven't said anywhere that `Function` is a built-in
identifier, so we would need to adjust an informal/*.md file to say
that, to finish this off.

Change-Id: Ifa5bbd95022498480b7ee2e94605f81cd11d9696
Reviewed-on: https://dart-review.googlesource.com/21080
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2017-11-16 12:34:14 +00:00
Kevin Millikin
d66ee882d3 Be consistent about run time and compile time
The spec was not self-consistent with respect to the usage of various forms
of 'run time' and 'compile time', even when using them as formally defined
terms (e.g., compile-time error).

Consistently follow the conventions: that 'run-time' and 'compile-time' are
adjectives and not nouns; that 'run time' and 'compile time' are noun
phrases containing an adjective and not adjectives themselves; and that
'runtime' and 'compiletime' are nonsense or at least jargon and are avoided.

Fixes https://github.com/dart-lang/sdk/issues/25883

Bug:
Change-Id: I0a9eb524bb43ed6c3a74e6ef038184bcbe979966
Reviewed-on: https://dart-review.googlesource.com/21345
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Kevin Millikin <kmillikin@google.com>
2017-11-16 12:01:42 +00:00
Erik Ernst
1c4358d459 Adjusted spec to not warn if instance method "overrides" static method
Addresses SDK issue #31201.

Change-Id: I545004b5e6e20b82ae4db879bb8f07adae1ecd23
Reviewed-on: https://dart-review.googlesource.com/18801
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2017-11-10 14:52:09 +00:00
Erik Ernst
57d00dfcb2 Made namedParameterTypes in the spec grammar more strict
In the specification grammar docs/language/Dart.g, named parameters in
a new style `Function` type must now have a type. They used to support
a plain `identifier` form, which means that the type was omitted and
only the name given, but the informal spec did not allow this (and this
was a decision taken because we wanted to take a step towards the kind
of function types where it is always the name which is omitted if
anything is omitted, and this means that nothing can be omitted for a
named parameter).

Change-Id: Ib2538f5bafd1e044f0b4f22ea0a6b9a339f81501
Reviewed-on: https://dart-review.googlesource.com/19567
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2017-11-10 11:08:17 +00:00
Erik Ernst
40b6741778 Adds support for syntax error in tests to test.py.
This CL modifies the Dart source used from test.py such that it takes
`syntax error` into account as an expected outcome in test files (so
that we can have `//# 01: syntax error` with a similar meaning as
`//# 01: compile-time error`).

For all tools except the spec_parser, `syntax error` is the same
outcome as `compile-time error`; that is, nobody else will see the
difference.

For the spec_parser, `syntax error` is the outcome where parsing has
failed; `compile-time error` is taken to mean some other compile-time
error, i.e., the spec_parser is expected to _succeed_ when the
expected outcome is `compile-time error`.

Test files in language and language_2 have been adjusted to use the
outcome `syntax error` where appropriate.

The status files in language and language_2 for the spec_parser have
been adjusted such that they fit all the new `syntax error` outcomes
in test files.

Other status files have been adjusted in a few cases where tests were
corrected (because a compile-time error which was clearly not intended
to be a syntax error turned out to be caused by a typo, which means
that the actual compile-time error has never been tested).

The spec grammar Dart.g was adjusted in a few cases, when some bugs
were discovered. In particular, the treatment of Function has been
changed: It is now known by the parser that Function does not take
any type arguments. This makes no difference for developers, because
they cannot declare a type named Function anyway, but it means that
a number of tricky parsing issues were resolved.

Dart.g was also adjusted to allow `qualified` to contain three
identifiers, which is an old bug (preventing things like metadata on
the form `@p.C.myConst`).

Change-Id: Ie420887d45c882ef97c84143365219f8aa0d2933
Reviewed-on: https://dart-review.googlesource.com/18262
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2017-11-06 08:56:09 +00:00
Lasse R.H. Nielsen
f11f2ed2bd Fix spec to allow x == null in const expression where x is not num/string/bool/null.
See issue #31140

Bug: http://dartbug.com/31140
Change-Id: I141cc3856a1758313de102084f74f4fa41412586
Reviewed-on: https://dart-review.googlesource.com/15100
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2017-10-26 09:47:50 +00:00
Erik Ernst
1e25e4814b Clarified semantics of transformation in optional-new.md.
Change-Id: Ieb8e323a37f66713067f8a33a5d3a8596e840458
Reviewed-on: https://dart-review.googlesource.com/14401
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2017-10-20 13:46:22 +00:00
Erik Ernst
338b070178 Added informal specification of instantiate to bound.
Change-Id: Ie4b05f16006743207be76e26195ff345bf2efc6b
Reviewed-on: https://dart-review.googlesource.com/5765
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2017-10-13 10:03:43 +00:00
Erik Ernst
63de49ccde test.py will now run the spec parser.
This CL modifies tools/test.py such that it can run the spec parser
(after doing `make parser` in tools/spec_parser, and assuming that the
ANTLR 3 library is available at /usr/share/java/antlr3-runtime.jar)
with a command line like

  `tools/test.py -c spec_parser -r none language/callable_test`

It also changes status files to have a name which follows the expected
patterns (e.g., `language/language_spec_parser.status`). Finally, it
adds/changes many entries in status files, such that parsing of the
directories `language` and `language_2` run successfully.

Change-Id: I82a22e32ac4fecd23ac0d4434bcac08f75dd8ffe
Reviewed-on: https://dart-review.googlesource.com/12680
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2017-10-12 09:22:28 +00:00
Erik Ernst
4cf0e65814 Adjusted optional-{new,const}.md according to feedback by mail.
Eliminated the imprecise notion of an immediate subexpression.
Included missing rule for transformation of composite literals
(lists and maps). Some smaller fixes according to feedback by
mail.

Change-Id: I03e58dd24b370b797cda084bd064c6f0db22f8fb
Reviewed-on: https://dart-review.googlesource.com/4383
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2017-10-11 15:49:06 +00:00
Erik Ernst
5f713bdd19 It is now a static warning if we call an Object.
This CL updates section 'Function Expression Invocation' in
dartLangSpec.tex to specify that it is a static warning to use the
value of an expression of type `Object` as a function.

We still _allow_ using a `Function` and a `dynamic` value as a function
by means of `assignable`, because these two things together are rather
concise, and they say the right thing.

It is a bit convoluted, though, because `Object` seems to be OK
according to the first sentence, and then it's ambushed by the second
sentence. Proposals for a more elegant wording welcome! ;-)

Change-Id: I997399b9e10da339df359e9c6a339249ab97acf9
Reviewed-on: https://dart-review.googlesource.com/11480
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2017-10-11 14:39:40 +00:00
Erik Ernst
b61f1047d5 Add a tools/spec_parse.py script.
This makes it possible to run the spec parser in a way which is a bit
more like the other tools that we have (e.g., tools/test.py):

  > tools/spec_parse.py tests/language/callable_test.dart

It still requires the developer to run `make parser` in
tools/spec_parser and hence does not run on a buildbot, but it's one
step forward.

Change-Id: I68ad6cea55bc02dddac21558acec33fc4bfc1981
Reviewed-on: https://dart-review.googlesource.com/9620
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2017-10-10 16:03:36 +00:00
Erik Ernst
1ba7ba01ff Added informal spec of "no such method forwarding".
Change-Id: Ifa3bb120566daf0963dbb88db380fbb0e0db26c1
Reviewed-on: https://dart-review.googlesource.com/6500
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Florian Loitsch <floitsch@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2017-10-10 15:38:42 +00:00
Erik Ernst
83e8cf3d0b Added language on covariant fields to covariant-overrides.md.
Change-Id: I2c2857f5e32328bfe4693038e7ef376f8633758e
Reviewed-on: https://dart-review.googlesource.com/12296
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2017-10-10 15:01:11 +00:00
Florian Loitsch
76031341af Fix whitespace in int64 proposal.
Change-Id: I241552b790ce6672dc5456e78a70165ef08a9394
Reviewed-on: https://dart-review.googlesource.com/9661
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2017-09-29 19:46:18 +00:00
Florian Loitsch
71bd158704 Add public Vipunen results link.
Change-Id: Ib39bb812204b08b8de8f4b9c2aa0e3de43d85ece
Reviewed-on: https://dart-review.googlesource.com/9680
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Vyacheslav Egorov <vegorov@google.com>
2017-09-29 16:37:22 +00:00
Erik Ernst
df42be789b Fixed several grammar bugs, updated status file for language_2.
The spec parser now parses all of language_2; many files are skipped,
but that is because they are multi-tests or because they contain
intentional syntax errors (negative tests).

Change-Id: I7061f0512702f3cb9631b32c79c3c1c1e2b7b0a6
Reviewed-on: https://dart-review.googlesource.com/8641
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2017-09-29 11:34:52 +00:00
Florian Loitsch
7c1af28ddb Add Int 64 proposal.
Change-Id: I4e9b4dc72efe9159dbe5f922893776fc282cf7ef
Reviewed-on: https://dart-review.googlesource.com/8560
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2017-09-28 09:14:04 +00:00
Erik Ernst
c49cbae7f0 Rietveld 2688903004 (spec_parser) migrated to Gerrit.
Change-Id: Iddd1e8a795bfaed0092a30bb9d83070fe62d4a60
Reviewed-on: https://dart-review.googlesource.com/7261
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2017-09-21 09:36:10 +00:00
Erik Ernst
8562c8ff1b Adjusted spec of initializing formal type annotation
During migration of lib/mirrors/initializing_formals_test.dart to lib_2
it became apparent that strong mode makes it an error to have different
type annotations on an initializing formal and the corresponding field.
The language team discussed this and decided that we will take a middle
way: These type annotations can differ, but the initializing formal
must have a subtype.

This CL adjusts the spec to say that. In line with the rest of the
spec it is still a static warning (we will migrate all the static
warnings to errors as a separate step).

Change-Id: I66656c2933b7f86b78f0b06eadbf5edc0f58a3c6
Reviewed-on: https://dart-review.googlesource.com/7264
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2017-09-20 11:38:26 +00:00
Lasse R.H. Nielsen
1d9ed20e06 Add >>> operator to specification.
Change-Id: Icade60331f708f895906dad9445878c6f32f9131
Reviewed-on: https://dart-review.googlesource.com/6621
Reviewed-by: Florian Loitsch <floitsch@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2017-09-20 07:51:46 +00:00
Erik Ernst
c15eed1269 Added metadata to new function type syntax parameter specifications
In https://github.com/dart-lang/sdk/issues/30732 the concern was raised
that the new Function type syntax does not support metadata on
parameter specifications (i.e., on normalParameterTypes and on
namedParameterTypes).

The implication of adding support for metadata in these locations is
that `@required` can be used on function types, which is the motivation
for submitting 30732.

We have always had support on parameter declarations in function typed
parameter declarations (`void foo(@A() int f(@A() String s))`), so in
this sense there is no new semantics to worry about (Lasse: "it doesn't
mean anything anyway!").

This CL modifies the generic-function-type-alias.md informal spec to
include this kind of metadata support.

Change-Id: I4520d330458242b31c991f62c03ca2f34f9c5e54
Reviewed-on: https://dart-review.googlesource.com/5762
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2017-09-18 09:31:08 +00:00
Lasse R.H. Nielsen
c620e827b7 Don't say that the Invocation object of setters/getters returns const map/list.
Currently the spec says that namedArguments of, say, a setter Invocation must
return the `const{}` map. That's badly typed for Dart 2(it should at least
be `const <Symbol,Object>{}`) and unnecessarily specific.
This change just requires the object to be empty and unmodifiable.

Also remove the spec handling invalidly overridden noSuchMethod.
That's not longer possible in Dart 2.

Change-Id: I3a983a44dd5939e42c85a53e9769f5961e03b986
Reviewed-on: https://dart-review.googlesource.com/6462
Reviewed-by: Erik Ernst <eernst@google.com>
2017-09-18 08:06:28 +00:00
Lasse Reichstein Holst Nielsen
06f2a2eead Remove @proxy from the specification. Deprecate the annotation.
R=floitsch@google.com

Review-Url: https://codereview.chromium.org/3007853003 .
2017-09-04 07:56:53 +02:00
Erik Ernst
839c321608 Generalized void informal spec clarified in several locations.
R=lrn@google.com

Review-Url: https://codereview.chromium.org/2994363003 .
2017-08-31 12:10:06 +02:00
Erik Ernst
00e98af7ef Adjusted the optional-const/new specs.
The informal specifications of optional-const and optional-new used to
be incomplete, and this CL adds missing parts (transformation rules for
lists and maps, and for `assignableExpression`).

This version of the documents preserves the property that no `const` is
added without immediate syntactic justification.

The alternative (where `const` is used also in other contexts where
either `const` or `new` must be added, just because we can do that)
is not specified here, that'll be another CL. The corrections done in
this CL will be needed, anyway, so I separated the two.

R=lrn@google.com

Review-Url: https://codereview.chromium.org/3005833002 .
2017-08-30 18:53:43 +02:00
Lasse Reichstein Holst Nielsen
3744197e3c Specify what "is equivalent to" means.
R=eernst@google.com

Review-Url: https://codereview.chromium.org/2998173002 .
2017-08-22 07:35:23 +02:00
Erik Ernst
6ef388db9d Added static warning on assignment to final locals; adjusted for-in.
Addresses spec omission which was brought up in SDK issue #30483.

The following issue was created specifically on this topic: #30489.

R=lrn@google.com

Review-Url: https://codereview.chromium.org/2998073002 .
2017-08-21 09:29:17 +02:00
Lasse R.H. Nielsen
2170830a9e Specify that async functions start executing synchronously.
R=eernst@google.com

Review-Url: https://codereview.chromium.org/3000063002 .
2017-08-18 13:00:40 +02:00
Erik Ernst
6fc097670c Added informal spec of optional const/new to docs/language/informal.
R=lrn@google.com

Review-Url: https://codereview.chromium.org/3000133002 .
2017-08-17 11:33:04 +02:00
Erik Ernst
8514557c5a Removed permission to do voidExpression is T and .. is! T.
The informal spec of generalized void used to allow a `typeTest` on
an expression of type void. This CL removes that permission, thus
leaving only `as` as a narrow escape hatch from void, as decided at the
language team meeting on 2017-08-15.

R=lrn@google.com

Review-Url: https://codereview.chromium.org/3001063002 .
2017-08-17 11:31:31 +02:00
Lasse Reichstein Holst Nielsen
e329e1ce29 Don't allow function values in assert tests.
Currently you can write
  assert(() { ... });
and the function will be called and the return value used as the assert test.
This feature isn't really worth its own complexity - if you want to get the same effect, you can just write all the function:
  assert(() { ... }());
With asserts in const initializer lists, where the function call is not possible anyway, the feature went from being not very useful to being actual an complication and exception for users to remember.

R=eernst@google.com, rnystrom@google.com

Review-Url: https://codereview.chromium.org/2974763002 .
2017-08-10 15:29:55 +02:00
Erik Ernst
db092ff2fc Transferred the generalized void informal spec to docs/language/informal
R=lrn@google.com

Review-Url: https://codereview.chromium.org/2994003002 .
2017-08-09 16:30:59 +02:00
Erik Ernst
5904409d50 Added informal generic method syntax and generic function type specs.
R=lrn@google.com

Review-Url: https://codereview.chromium.org/2841483003 .
2017-07-14 13:17:30 +02:00
Erik Ernst
52e1372454 Fixes several typos as reported by Alexander Aprelev in
https://codereview.chromium.org/2844003002/, plus other typos.

R=lrn@google.com

Review-Url: https://codereview.chromium.org/2975283002 .
2017-07-14 12:51:28 +02:00
Lasse R.H. Nielsen
a72f46def8 The actual change to the wording of assert that I intended in the previous CL.
R=eernst@google.com

Review-Url: https://codereview.chromium.org/2979523002 .
2017-07-11 11:52:21 +02:00
Lasse R.H. Nielsen
609d26a227 Add assert-in-initializer-list to formal specification.
Add tests for new syntax.
Not dart-formatted yet since the formatter doesn't accept the new syntax.

R=eernst@google.com, floitsch@google.com

Review-Url: https://codereview.chromium.org/2962153002 .
2017-07-10 13:59:38 +02:00
Florian Loitsch
4207a070f1 Fix indented ```. 2017-06-30 20:39:56 +02:00
Lasse R.H. Nielsen
aeacff4f2b Add proposal for new mixin declaration syntax.
R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2954653002 .
2017-06-30 14:16:57 +02:00
Lasse Reichstein Holst Nielsen
380461e61a Improve wording of break/continue.
R=eernst@google.com, kmillikin@google.com

Review-Url: https://codereview.chromium.org/2963533002 .
2017-06-28 07:37:14 +02:00
Lasse Reichstein Holst Nielsen
82a97d8b46 Fix wording for break and continue.
Fixes #30011
BUG= http://dartbug.com/30011
R=eernst@google.com, paulberry@google.com

Review-Url: https://codereview.chromium.org/2961603002 .
2017-06-27 10:33:24 +02:00
Lasse R.H. Nielsen
c68e5cc67d Allow trailing comma in assert statements.
Fixes #28786
BUG= http://dartbug.com/28786
R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2953223002 .
2017-06-23 14:45:25 +02:00
Lasse R.H. Nielsen
52691c6937 Add informal specification for optional-new/const, constructor tearoffs.
R=floitsch@google.com

Status: under discussion
Review-Url: https://codereview.chromium.org/2929753003 .
2017-06-20 13:21:36 +02:00
Lasse R.H. Nielsen
c4da9198c1 Add informal specification of asserts in initializer lists.
R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2927933002 .
2017-06-08 13:45:46 +02:00
Erik Ernst
0603b1872c Fixed typo in spec.
R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2916263003 .
2017-06-02 11:14:53 +02:00
Lasse R.H. Nielsen
13f3df7e0c Change specification of main.
R=eernst@google.com, rnystrom@google.com

Review-Url: https://codereview.chromium.org/2852533003 .
2017-06-01 13:51:30 +02:00
Erik Ernst
539e463fe8 Removes spurious brace in dartLangSpec.tex
R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2895263002 .
2017-05-22 16:50:24 +02:00
Lasse Reichstein Holst Nielsen
26d6e3596d Make void-arrow-functions statically accept any expression type.
R=eernst@google.com

Review-Url: https://codereview.chromium.org/2873313003 .
2017-05-22 16:19:53 +02:00
Erik Ernst
3b5874a332 Adjusted initializer rules, changing a run-time error to compile-time.
R=lrn@google.com

Review-Url: https://codereview.chromium.org/2843733002 .
2017-05-19 14:22:35 +02:00
Peter von der Ahé
5e040f1abf Add comment about metadata syntax problem in static methods.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2882173002 .
2017-05-15 13:55:06 +02:00
Lasse R.H. Nielsen
122345e356 Specify that a void return type doesn't cause errors in checked mode.
R=eernst@google.com

Review-Url: https://codereview.chromium.org/2875643002 .
2017-05-11 14:17:57 +02:00
Peter von der Ahé
4880a2876e Rewrite mixin application handling in Fasta.
R=johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2862223002 .
2017-05-09 09:22:57 +02:00
Erik Ernst
ae1091805d Fixed typo: "keyword parameter" changed to "named parameter".
Resolves https://github.com/dart-lang/sdk/issues/29464.

R=lrn@google.com

Review-Url: https://codereview.chromium.org/2838853003 .
2017-04-26 16:11:59 +02:00
Erik Corry
2fb5d08102 Spelling a
R=ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2841543002 .
2017-04-24 14:53:51 +02:00
Erik Corry
4b9bba55b4 Stoppp using trippple consonants
R=ahe@google.com
BUG=

Review-Url: https://codereview.chromium.org/2833073002 .
2017-04-21 17:50:13 +02:00
Lasse R.H. Nielsen
94b23d3b12 Fix text around least upper bound.
R=eernst@google.com

Review-Url: https://codereview.chromium.org/2802633002 .
2017-04-05 14:09:07 +02:00
Kevin Millikin
74c576911b Ignore LaTeX output files in docs/language.
BUG=
R=eernst@google.com, zhivkag@google.com

Review-Url: https://codereview.chromium.org/2763393006 .
2017-03-24 15:45:15 +01:00
Erik Ernst
1e483f0bcc Specification adjustments for covariant overrides in Dart 1.
Addresses the 1.50 bullet in sdk issue #28164.

R=lrn@google.com

Review-Url: https://codereview.chromium.org/2678003002 .
2017-03-02 13:41:37 +01:00
Lasse R.H. Nielsen
6a77f268bb Revert "Add bnf.sty to github, since it is referenced by the latex language spec file."
R=eernst@google.com

Review-Url: https://codereview.chromium.org/2723623003 .
2017-02-28 11:35:35 +01:00
Regis Crelier
3d4fce91e2 Add bnf.sty to github, since it is referenced by the latex language spec file.
R=gbracha@google.com

Review-Url: https://codereview.chromium.org/2705323003 .
2017-02-22 10:40:23 -08:00
Erik Ernst
5de9108c16 Adjusted spec to outlaw built-in identifiers in type annotations.
Addresses issue https://github.com/dart-lang/sdk/issues/28817.

R=lrn@google.com

Review-Url: https://codereview.chromium.org/2704573004 .
2017-02-20 09:27:37 +01:00
Erik Ernst
170ba4aa32 Added covariant-from-class informal spec file for broader access.
Review-Url: https://codereview.chromium.org/2700533004 .
2017-02-16 13:11:15 +01:00
Lasse Reichstein Holst Nielsen
c41ae15713 Specify FutureOr.
R=eernst@google.com, floitsch@google.com

Review-Url: https://codereview.chromium.org/2664263002 .
2017-02-03 08:02:09 +01:00
Lasse R.H. Nielsen
ef31637857 Fix specification of multiline strings.
Now say that NEWLINE is one of CR, LF or CR+LF, and that all of these
contribute a single LF to the string value.

Fixes issue #14073
BUG= http://dartbug.com/14073
R=eernst@google.com, johnniwinther@google.com

Review-Url: https://codereview.chromium.org/2665613003 .
2017-01-31 10:26:01 +01:00
Lasse R.H. Nielsen
c77a4a92b2 Add changelog to dart spec file.
R=eernst@google.com, floitsch@google.com

Review-Url: https://codereview.chromium.org/2650693002 .
2017-01-23 14:00:28 +01:00
Lasse R.H. Nielsen
2f2508470b Spec tweak. Fix semicolon escape-grammar where it doesn't match the rest.
R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2638403006 .
2017-01-20 14:32:11 +01:00
Lasse R.H. Nielsen
fcff3fe4e7 Make it more explicit that Null doesn't extend anything but Object.
Fix dart.sty
Address new comments on https://codereview.chromium.org/2555343004/

R=eernst@google.com

Review-Url: https://codereview.chromium.org/2641873003 .
2017-01-20 09:03:43 +01:00
Bob Nystrom
13f71634b0 Informal proposal for covariant overrides. (#28176)
Added informal specification of covariant overrides.

It is available as a new file, docs/language/informal/covariant-overrides.md.
2017-01-19 06:22:54 -08:00
Lasse R.H. Nielsen
6904227a56 Fix bug in dart.sty.
R=floitsch@google.com

Review-Url: https://codereview.chromium.org/2644513003 .
2017-01-19 12:09:17 +01:00
Erik Ernst
473f2c9a60 Eliminated usages of "field" in the spec.
It turned out to be "instance variable" or "static or instance
variable" in all cases. I considered writing "member variable" for the
latter, but we would then need to introduce that phrase somewhere, and
maybe refer to it at each usage, which would be more verbose.

Fixes #24333.

BUG=
R=lrn@google.com

Review-Url: https://codereview.chromium.org/2613293002 .
2017-01-09 11:29:01 +01:00
Erik Ernst
c63f8010df Performed some keyword related clean-ups.
R=lrn@google.com

Review-Url: https://codereview.chromium.org/2609413006 .
2017-01-06 13:53:28 +01:00
Bob Nystrom
376b9a31c5 Add README for informal specs directory.
R=eernst@google.com, leafp@google.com

Review-Url: https://codereview.chromium.org/2596933002 .
2016-12-21 15:52:54 -08:00
Erik Ernst
88037f0a64 Added compile-time errors for supertypes: Type alias missing, and more.
R=lrn@google.com

Review-Url: https://codereview.chromium.org/2585723002 .
2016-12-16 14:02:56 +01:00
Lasse R.H. Nielsen
10abaf89fd Make Null act like the bottom type for all the (default nullable) types.
BUG= http://dartbug.com/28024
R=eernst@google.com

Review URL: https://codereview.chromium.org/2555343004 .
2016-12-09 12:59:46 +01:00
Lasse R.H. Nielsen
81f8ea0a0a Fix unintended spec change: Final fields not being initialized is only a warning.
A recent spec change made it an error, but the existing spec didn't actually
say that - it's one of the few warnings that do not correspond to e runtime
error.

R=eernst@google.com

Review URL: https://codereview.chromium.org/2542253003 .
2016-12-05 10:48:39 +01:00
Lasse R.H. Nielsen
c05eb97461 Add message to assert in specification.
R=eernst@google.com

Review URL: https://codereview.chromium.org/2530083002 .
2016-11-28 09:19:28 +01:00
Lasse Reichstein Holst Nielsen
843bb96813 Change how the language specification describes control flow.
Changed to compositionally describing how an expression or statement can
complete (normally, throw, return, break, continue), and propagating the
completion to the surrounding statements handling those behaviors.

This should not change the current behavior except in a few cases where
the existing specification was vague, misleading or just wrong.

Actual changes:
- The super call in an initializer list is now always called at the end,
  even if it is allowed to be written earlier. This matches existing
  VM behavior.
  Initialization of initializer expressions are specified
  as part of constructor execution, not something happening
  at the `new` operator.
- The cancel call to a stream subscription when exiting an async for-in
  loop is now made explicit, and its returned future is explicitly
  awaited for.
  Previously it was unclear what happened with that future.
- Pausing a surrounding async-for loop has been added everywhere
  the body of the loop can suspend, just before the suspension.
  The loop subscription is not resumed until reaching the end of the body,
  which is equivalent to resuming it after each suspend
  and then pausing it again when the synchronous execution reaches
  the next suspend.
  So, easier and doesn't change the behavior of the loop itself,
  but it's a visible change if you check the onPause/onResume
  of the loop stream.
  Spec now recognizes that the pause call may throw on an invalid
  implementation of StreamSubscription.

Addresses issues #25859, #25856, #25850, #25848, #25847, #25749, #25634, #25539, #25421, #25412, #25381, #25234, #25005, #24859, #24748, #23779, #23700, #23628, #22908, #21858 (and likely more).

BUG= http://dartbug.com/25859 http://dartbug.com/25856 http://dartbug.com/25850 http://dartbug.com/25848 http://dartbug.com/25847 http://dartbug.com/25749 http://dartbug.com/25634 http://dartbug.com/25539 http://dartbug.com/25421 http://dartbug.com/25412 http://dartbug.com/25381 http://dartbug.com/25234 http://dartbug.com/25005 http://dartbug.com/24859 http://dartbug.com/24748 http://dartbug.com/23779 http://dartbug.com/23700 http://dartbug.com/23628 http://dartbug.com/22908 http://dartbug.com/21858
R=eernst@google.com

Review URL: https://codereview.chromium.org/2399343002 .
2016-11-25 09:30:17 +01:00
Lasse R.H. Nielsen
de8e04d76a Make C(), where C is a class name, a compile-time error.
Fixers issue #27651
BUG= http://dartbug.com/27651
R=eernst@google.com, floitsch@google.com, fschneider@google.com

Review URL: https://codereview.chromium.org/2444843002 .
2016-11-17 09:56:54 +01:00
Lasse R.H. Nielsen
2e56c7b8fa Spec: Make fontenc understand that greater than is not an inverse question mark.
No longer using a 7-bit font. Welcome to the 21th century.

R=eernst@google.com

Review URL: https://codereview.chromium.org/2487193002 .
2016-11-09 14:31:28 +01:00
Lasse R.H. Nielsen
f3288982de Spec: Rewrite lambdas to simpler semantics instead.
This is instead of introducing a let-construct.

R=eernst@google.com

Review URL: https://codereview.chromium.org/2433943002 .
2016-11-09 13:21:39 +01:00
Erik Ernst
5bf3c1fa4d Fixed erroneously commented-out \end{itemize}
Commit 4cb61407a8, CL
https://codereview.chromium.org/2476613002 introduced a spurious `%`
which causes `latex dartLangSpec.tex` to fail. This CL fixes it.

Review URL: https://codereview.chromium.org/2487113003 .
2016-11-09 12:30:34 +01:00
Lasse Reichstein Holst Nielsen
4cb61407a8 Remove generalized tear-offs from the specification.
Fixes issue #27519
BUG= http://dartbug.com/27519
R=eernst@google.com

Review URL: https://codereview.chromium.org/2476613002 .
2016-11-07 14:53:27 +01:00
Erik Ernst
06416e404b Fixed typo in spec: REHTROW --> RETHROW
Review URL: https://codereview.chromium.org/2462993002 .
2016-10-31 10:15:03 +01:00
Lasse R.H. Nielsen
6e6ff496ed Allow rethrow to end a switch case. Allow braces around switch cases.
Add `rethrow` as one of the statements that are allowed to end a switch case
without a warning.
Change wording to not claim that `throw` is a statement.
Also allow wrapping case statements in a block statement without causing
more warnings. Currently, a `case 4: { break; }` is required to warn because
the last statement is a block statement, not a break statement.

Fixes issue #27650
BUG= http://dartbug.com/27650
R=eernst@google.com, floitsch@google.com, rnystrom@google.com

Review URL: https://codereview.chromium.org/2447613003 .
2016-10-25 13:04:36 +02:00
Lasse R.H. Nielsen
efb9a12811 Add = as default-value separator for named parameters.
Fixes issue #27559.

BUG= http://dartbug.com/27559
R=asiva@google.com, eernst@google.com, floitsch@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org/2411633002 .
2016-10-14 11:25:25 +02:00
Lasse R.H. Nielsen
cc6d93b57c Make it a compile-time error if a library has part "uri"; twice for the same uri.
If the part declaration is non-empty, it will always cause a compile-time error anyway due to duplicate declarations in the library scope. This just makes it explicit that it's an error in all cases, and avoids the special case of the empty part file being silently accepted until you put something in it.

R=eernst@google.com

Review URL: https://codereview.chromium.org/2371743002 .
2016-10-05 11:12:22 +02:00
Lasse R.H. Nielsen
16d806b0aa Make the spec specific about the return type of sync*/async/async* function.
Now requires the type to be a supertype of `Iterable<T>`/`Future<T>`/`Stream<T>`
for some `T`. This allows, say, all `Future<T>` return types for `async` but
disallows using a different class implementing `Future`:
```
MyFuture foo() async {}
```
gives a static warning (error in Dart 2) because the return type is statically
known to be unsatisfied.

Fixes issue #27470
BUG= http://dartbugcom/27470
R=eernst@google.com, floitsch@google.com

Review URL: https://codereview.chromium.org/2392513002 .
2016-10-05 10:24:10 +02:00
Lasse R.H. Nielsen
9e032f493d Add documentation to the mixin superclass requirement description.
Fixes issue #25312
BUG= http://dartbug.com/25312
R=eernst@google.com

Review URL: https://codereview.chromium.org/2375913002 .
2016-09-29 10:24:35 +02:00
Lasse R.H. Nielsen
b98484fbc1 Fix spec reference to non-existing mirrors method.
Fixes #25549
BUG= https://dartbug.com/25549
R=eernst@google.com

Review URL: https://codereview.chromium.org/2381483002 .
2016-09-28 13:38:14 +02:00
Lasse R.H. Nielsen
debbf68223 Fix bug effectively stating that 1e8 is an integer literal, not a double.
Fix typo in spec - uses `/` when intending division by zero error.

Fixes issues #26053, #27279

BUG= http://dartbug.com/26053, http://dartbug.com/27279
R=eernst@google.com, floitsch@google.com

Review URL: https://codereview.chromium.org/2370853004 .
2016-09-28 09:51:10 +02:00
Lasse R.H. Nielsen
574ae435f3 Allow surrogates in string literals.
Fixes issue #26620
BUG: http://dartbug.com/26620

R=asiva@google.com, brianwilkerson@google.com, floitsch@google.com, hausner@google.com, sigmund@google.com

Review URL: https://codereview.chromium.org/2304923002 .
2016-09-26 13:23:41 +02:00
Erik Ernst
9a1e050a85 Adjusts the spec to include access to initializing formals.
Adresses https://github.com/dart-lang/sdk/issues/26659.

R=lrn@google.com

Review URL: https://codereview.chromium.org/2190373002 .
2016-08-23 18:28:40 +02:00
Lasse R.H. Nielsen
04a470e636 Spec: Allow any expression in assert statements.
Fixes issue #26866

BUG= http://dartbug.com/26866
R=eernst@google.com, floitsch@google.com

Review URL: https://codereview.chromium.org/2143363002 .
2016-08-15 11:57:51 +02:00
Lasse R.H. Nielsen
4f9645c406 Add trailing commas to argument and parameter lists.
R=eernst@google.com

Review URL: https://codereview.chromium.org/2060163002.
2016-07-06 15:17:46 +02:00
Lasse R.H. Nielsen
65421fb2bf Various fixes to wording and typos.
R=eernst@google.com

Review URL: https://codereview.chromium.org/2060773002.
2016-06-14 15:55:06 +02:00
Harry Terkelsen
1745ba77f5 fix all instances of "the the"
BUG=
R=sigmund@google.com

Review URL: https://codereview.chromium.org/1980573003 .
2016-05-13 12:38:25 -07:00
Lasse R.H. Nielsen
2a0cc74db1 Expand the definition of potentially constant expression.
The current definition requires the expression to be valid and
compile-time constant if constructor parameters are considered
compile-time constants with types appropriate for their context.

This is necessary but not sufficient, so this CL adds the further
requirement that the expression must also be a valid (not necessarily
constant) expession if the parameters are considered non-constant
variables.

This rules out the case:

    const C(x) : y = const [x];

where the current specification would, technically, allow it as a
potentially constant expression and therefore be a valid const
constructor. In practice it would never work if the constructor is
used with "new" instead of "const".

This is not really a specification *change* - existing implementations has this restriction anyway.

Addressed the concern of #24970.
BUG= http://dartbug.com/24970
R=eernst@google.com, gbracha@google.com

Review URL: https://codereview.chromium.org/1465473002 .
2016-01-20 13:21:39 +01:00
Lasse R.H. Nielsen
fd59c87146 Make ?? a compile-time constant operator.
Update specification, change analyzer, VM and dart2js.

Fixes issue #25054.
BUG= http://dartbug.com/25054
R=floitsch@google.com, gbracha@google.com

Review URL: https://codereview.chromium.org/1493693002 .
2016-01-12 12:30:07 +01:00
Gilad Bracha
a0e4f28160 Unnamed libraries do not cause warnings.
BUG=
R=brianwilkerson@google.com

Review URL: https://codereview.chromium.org//1299283002 .
2015-08-19 13:21:29 -07:00
Gilad Bracha
b11670f899 Ensure null aware ops on statics are unsurprising.
BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org//1218483004.
2015-06-29 15:33:06 -07:00
Gilad Bracha
4fb7507c3e Remove mixin DEP annotation from header
BUG=

Review URL: https://codereview.chromium.org//1202733006.
2015-06-24 12:40:08 -07:00
Gilad Bracha
2c7234bd61 Mixin DEP changes
BUG=
R=eernst@google.com, lrn@google.com

Review URL: https://codereview.chromium.org//1190453003.
2015-06-24 12:33:18 -07:00
Gilad Bracha
d8b47ad0a6 Added language spelling out static type of prefix objects
BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org//1195133002.
2015-06-23 11:41:35 -07:00
Kevin Millikin
2e5a132fe1 Fix a typo in the specification of switch cases.
In the grammar, labels must before the word 'case'.  However, in the
description the labels come between the word 'case' and the comparison
expression.  Closes #22127.

BUG=
R=gbracha@google.com

Review URL: https://codereview.chromium.org//1189523004.
2015-06-16 12:02:16 +02:00