Commit graph

103 commits

Author SHA1 Message Date
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
Gilad Bracha
f71b48a041 Revise static typecheck rules for for-in.
BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org//1184183010.
2015-06-15 17:50:37 -07:00
Gilad Bracha
b34c19d0ce Add missing clause for LUB(Bottom, T)
BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org//1179113010.
2015-06-15 16:20:30 -07:00
Gilad Bracha
1ab7736b57 Added type rules for e++ and friends
BUG=
R=paulberry@google.com

Review URL: https://codereview.chromium.org//1183493005.
2015-06-15 15:00:55 -07:00
Gilad Bracha
2b95ed1ae1 Make use of call on Function exempt from warnings,
BUG=
R=lrn@google.com

Review URL: https://codereview.chromium.org//1176853003.
2015-06-15 13:24:10 -07:00
Gilad Bracha
67b99e4b33 Make sure we use lexical scope consistently when dealing with prefixes.
BUG=
R=lrn@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org//1184583002.
2015-06-12 17:38:42 -07:00
Gilad Bracha
58708e3ad1 Specify behavior of e?.v++ and e?.v--
BUG=
R=hausner@google.com

Review URL: https://codereview.chromium.org//1181733003.
2015-06-11 15:01:06 -07:00
Gilad Bracha
c448d7fb0b Make package: URI schema implementation dependent per latest DEP.
BUG=
R=lrn@google.com

Review URL: https://codereview.chromium.org//1170393002.
2015-06-10 12:36:31 -07:00
Gilad Bracha
89607f06e9 Updates for 1.10: warnings when for-in uses an expression that has no iterator; assorted typos.
BUG=
R=rmacnak@google.com

Review URL: https://codereview.chromium.org//1171283002.
2015-06-09 15:44:31 -07:00
gbracha@google.com
099e37e003 Changes for TC52 3rd edition
R=eernst@google.com

Review URL: https://codereview.chromium.org//1031323002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44726 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-27 01:45:31 +00:00
gbracha@google.com
ae83a06400 Assorted fixes to async: yield may suspend in async* methods; yield* skips emptysequences; definition of flatten.
R=hausner@google.com, paulberry@google.com

Review URL: https://codereview.chromium.org//1010433002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44569 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-18 23:18:06 +00:00
gbracha@google.com
e259e8f86f Correct reference to definition of flatten
Review URL: https://codereview.chromium.org//993213002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@44391 260f80e4-7a28-3924-810f-c04153c831b5
2015-03-11 00:59:51 +00:00
gbracha@google.com
c82a633c65 Strengthen warnings for return types of async/async*/sync* functions.
R=paulberry@google.com

Review URL: https://codereview.chromium.org//891303004

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43420 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-03 19:06:09 +00:00
gbracha@google.com
609e6ebb66 Clarify behavior of iterables and iterators with sync*.
R=lrn@google.com

Review URL: https://codereview.chromium.org//858063002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@43415 260f80e4-7a28-3924-810f-c04153c831b5
2015-02-03 18:19:11 +00:00
gbracha@google.com
dff3b74a05 Remove restrictions on scope of doc comments.
R=sethladd@google.com

Review URL: https://codereview.chromium.org//843013003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42940 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-15 23:51:50 +00:00
gbracha@google.com
1bc0e8dc1d insure type vars are bound properly when executing field initializers. Also correct assoc tablefor ?:
R=lrn@google.com

Review URL: https://codereview.chromium.org//811953006

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42785 260f80e4-7a28-3924-810f-c04153c831b5
2015-01-12 18:52:14 +00:00
gbracha@google.com
8672603473 Fix name of spawnIsolate to spawn.
Review URL: https://codereview.chromium.org//808373003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42560 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-23 00:23:31 +00:00
gbracha@google.com
73de52110f Correct last revision
Review URL: https://codereview.chromium.org//825463002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42554 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-22 19:51:21 +00:00
gbracha@google.com
509c16c9cb Fix error in grammar for assignableExpression
Review URL: https://codereview.chromium.org//817723003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42553 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-22 19:06:55 +00:00
gbracha@google.com
0faaa550d1 Fix circular dependency between null equality and identity.
R=kmillikin@google.com

Review URL: https://codereview.chromium.org//804993005

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42552 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-22 18:58:06 +00:00
gbracha@google.com
38606de2a5 Change static typing so that inherited noSuchMethod silences errors,
including undefined abstract members.

R=justinfagnani@google.com

Review URL: https://codereview.chromium.org//818463002

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42521 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-19 18:44:39 +00:00
gbracha@google.com
11db20e680 Main function of a script can be function valued getter.
R=lrn@google.com

Review URL: https://codereview.chromium.org//800413003

git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@42464 260f80e4-7a28-3924-810f-c04153c831b5
2014-12-18 18:55:30 +00:00