Commit Graph

2268 Commits

Author SHA1 Message Date
Dan Rubel d26c310a27 Rework parsing of local const declarations
Similar to earlier work that reworked parsing of variable declarations,
this CL reworks parsing of local constant declarations to use
TypeInfo rather than parseType. This simplifies and improves recovery,
and reduces the number of error messages in some recovery situations.

Change-Id: I32705bdba20a0cb7aee41c64510c4c2896a5ae68
Reviewed-on: https://dart-review.googlesource.com/47241
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-20 22:50:20 +00:00
danrubel 08d305bbd7 Inline modifiers into endTopLevelFields and endFields events
Change-Id: I9681e22ae96c43626558ff567cbf4a12117095fa
Reviewed-on: https://dart-review.googlesource.com/47240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-20 15:00:35 +00:00
Dan Rubel adb9f8cc0b Inline modifiers into beginClassDeclaration and beginNamedMixinApplication
Change-Id: I0d95029c203a77d4a9e9dc2d8f1b40bced7535c5
Reviewed-on: https://dart-review.googlesource.com/47186
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-20 13:28:17 +00:00
Dan Rubel fd005e17bc Rework parsing of local function declarations
This CL reworks parsing local variable and local function
declarations to improve recovery and error messages.
In addition, the fasta parser properly parses metadata
before a local function declaration.

Change-Id: Ia43c8bab3f3ce3b824390a4aa36d50b85f1ea9af
Reviewed-on: https://dart-review.googlesource.com/46952
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-20 12:01:26 +00:00
Sigmund Cherem 031ef989ac Provide better error message when a linked dependency doesn't exist
This comes up for dart2js when the location for dart2js_platform.dill is invalid
or when the file was not provided. Today dart2js produces a bad crash message in
that scenario, instead of a readable error.

I wanted to provide a better message, but I'm not sure I can. For example, I
wanted to say "SDK Platform file not found", but I can't because linked
dependencies can be used for other puposes.

Change-Id: I1739ec36dab16b2fd72552e5e7716cd573a8ebd0
Reviewed-on: https://dart-review.googlesource.com/46943
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-20 01:03:37 +00:00
Dan Rubel 06949dc985 Inline modifiers into beginFactoryMethod event
Change-Id: Ibc1053126b020577625279f4fab0bcff71aa5d15
Reviewed-on: https://dart-review.googlesource.com/47182
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-19 22:04:37 +00:00
Dan Rubel 8fde515354 Inline modifiers into beginTopLevelMethod event
Change-Id: I40423fcd53dc6a374a1c5be280d1806c31f34a6d
Reviewed-on: https://dart-review.googlesource.com/47120
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-19 20:20:37 +00:00
Dan Rubel b2dd274e08 Remove modifiers from local function event structures
This removes pushing and popping modifiers when parsing a local function
declaration since they cannot have modifiers.

Change-Id: Iabbc6bb050d7006d07d4ec5d2220947593d62fd6
Reviewed-on: https://dart-review.googlesource.com/46880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-16 16:05:07 +00:00
Peter von der Ahé e5c84938f2 Update names derived from Program
Change-Id: Ifdb072506fef909ccf5ad2e5270b1976ae61e3cc
Reviewed-on: https://dart-review.googlesource.com/31143
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-16 09:33:07 +00:00
danrubel f1ebe2bd5c Inline utility method closeBraceTokenFor
Now that Token implements endGroup, there is no need for a type check
and the associated utility method can be inlined.

Change-Id: Ibb7b54837e4b459dbfa35b987c67794b05e0d579
Reviewed-on: https://dart-review.googlesource.com/46576
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-15 23:29:35 +00:00
danrubel 236c8dae8d Remove unnecessary typeContinuation variable
Change-Id: I1a78007491598b3a2d17091e96519182bd921f8d
Reviewed-on: https://dart-review.googlesource.com/46569
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-15 19:32:35 +00:00
Samir Jindel 34cfabff5d Add expectation.
Change-Id: I1b07ece35aece7cd2de57065529209635721144b
Reviewed-on: https://dart-review.googlesource.com/46760
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-15 13:50:57 +00:00
Peter von der Ahé 4f2bdff90b Rename Program to Component
Change-Id: I1a3cc03fba9783807fa637a9d42fdbad68ee7686
Reviewed-on: https://dart-review.googlesource.com/31040
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-15 12:22:23 +00:00
Samir Jindel 4289a9967b Check expected outputs of transforms.
Change-Id: I56ff4d4391b7a22d709dc60b696646895928e34c
Reviewed-on: https://dart-review.googlesource.com/46100
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-03-15 12:11:13 +00:00
Dan Rubel 71e16622cd Improve for statement errors and recovery
This CL updates fasta parsing of `for` statements
to detect additional errors and improve recovery.

The parser originally called parseType when parsing `for` statements
which committed the parser down a particular path
and limited the ability of the caller to gracefully recovery.
Now the parser calls computeType, which parses and caches
the type information, so that the caller has more opportunity
to recover gracefully.

Change-Id: I6296ffb1f75e77a87a7533bfca77dae18cfcf60d
Reviewed-on: https://dart-review.googlesource.com/46383
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-15 11:43:13 +00:00
Dan Rubel 0175f24b25 Assert errors during TypeInfo.parseType
... and Address comments in
https://dart-review.googlesource.com/c/sdk/+/46561

Change-Id: Ic3a183d83a4afea2e759e371306b6eb2b3c6ba6a
Reviewed-on: https://dart-review.googlesource.com/46600
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-14 21:00:41 +00:00
Dan Rubel 3be356e96d Improve TypeInfo recovery when missing a comma
Change-Id: Iac7093e7ac71e20f15ece29a4cda75630b167253
Reviewed-on: https://dart-review.googlesource.com/46561
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-14 18:13:48 +00:00
Martin Kustermann 846d18414c Use platform.dill for more fasta tests, skip shaker test
Issue https://github.com/dart-lang/sdk/issues/32530
Issue https://github.com/dart-lang/sdk/issues/32531

Change-Id: Ie31a9e4d82fb942e48aa9a9c89c45eefb132702f
Reviewed-on: https://dart-review.googlesource.com/46520
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-14 16:27:37 +00:00
Dan Rubel 107e279b2d Cleanup parseTypeVariables and parseTypeArguments
Change-Id: Iab34c0516202b9f4512001217f21c8dc293d5bb7
Reviewed-on: https://dart-review.googlesource.com/46500
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-14 15:20:54 +00:00
Dan Rubel 983e7b3662 Update TypeInfo to correctly parse "T<void>"
Change-Id: I2fe4d1c36c52a599d9d80809d88562657100dcdf
Reviewed-on: https://dart-review.googlesource.com/46480
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-14 14:54:35 +00:00
Martin Kustermann 27bc090ca5 Replace default dill file in the sdk-summary to use from vm_outline.dill to vm_platform.dill
Change-Id: I5e406c2fb91a0772f2dd768cc2e95b8c148efbc4
Reviewed-on: https://dart-review.googlesource.com/46441
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-14 13:01:54 +00:00
danrubel f5ec1143ab Reorganize TypeInfo tests
Change-Id: I03306fcb2a91546931aef3056be36a43e983822a
Reviewed-on: https://dart-review.googlesource.com/46380
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-13 23:54:10 +00:00
Dmitry Stefantsov 8c82c3b5fe Fix instantiate-to-bound algorithm implementation
Change-Id: Ia13867b0ffab9fab527d8dba6d4f10cc90c002c2
Reviewed-on: https://dart-review.googlesource.com/43061
Reviewed-by: Samir Jindel <sjindel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2018-03-13 19:18:34 +00:00
Dmitry Stefantsov f8995da6aa Report a compile-time error on magic const
When inferring const or new for expressions that aren't required to be const,
Fasta always choses new. That's not correct, and this is a short-term work
around to avoid introducing a breaking change in the future. The plan is to
implement this feature correctly, but that will require more time than we have
right now.

Originally submitted by ahe@google.com.  Added: status file fixes.

Change-Id: I2d70bd2488de6b69fcd5546c1f4654dfbbb30b7f
Reviewed-on: https://dart-review.googlesource.com/46340
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2018-03-13 19:07:12 +00:00
Brian Wilkerson f66854a700 Fix a type issue found when running analyzer with a VM flag of --preview-dart-2
Change-Id: I36954eb08b9d9a7cb24e6cb24baa51ef0a608a36
Reviewed-on: https://dart-review.googlesource.com/46123
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-13 16:39:19 +00:00
Dan Rubel ff9591d2d3 Extract computeType from parseType for better recovery
This CL extracts the core logic out of parseType into a new computeType
function. This enables the TypeContinuation logic in parseType to be
moved into the callers of parseType so that recovery can be improved.

Change-Id: Ibded6f5eacfeaccdc6c56e234b305596d9582a92
Reviewed-on: https://dart-review.googlesource.com/45760
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Dan Rubel <danrubel@google.com>
2018-03-13 14:49:59 +00:00
Peter von der Ahé 856c582383 Introduce an enum to track constant context
Change-Id: I862654e07028290f1856dc7548fa39673d8c4ac8
Reviewed-on: https://dart-review.googlesource.com/46243
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-03-13 14:23:10 +00:00
Lasse R.H. Nielsen 6f13072739 Add toString to MapEntry.
Fixes #32464

BUG: http://dartbug.com/32464

Change-Id: I1462452c3f6a7838aeaaa84e3fb0e092a3f85338
Reviewed-on: https://dart-review.googlesource.com/45704
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2018-03-13 13:57:59 +00:00
Paul Berry 424ae0f5e4 Check contravariance of property gets that resolve to fields.
Fixes #32501

Change-Id: Ic3c5aca1d12b73e40e63c6cdd8304b95f54e5497
Reviewed-on: https://dart-review.googlesource.com/46002
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2018-03-13 10:37:09 +00:00
Jens Johansen 5e629d24ac Hot reload test that demonstrated a hot reload failure before fix
Fix was given in 66af0113de

Change-Id: I5209d4951cc00a5656e852c7c418dd198a317a5a
Reviewed-on: https://dart-review.googlesource.com/46041
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2018-03-13 08:44:42 +00:00
Mike Fairhurst 6f3b6bfb62 Do the rounds for new analyzer publish + fix analyzer_plugin.
I'm not sure -- I ticked analyzer to 0.32 from 0.31-alpha.

I think because of the new methods, this is the right call (though it
leaves us in the weird place where there was no stable publish of
0.31.2?)

Also not sure if I need to update any other downstream packages (args?
dart_style?). Seems like if so, those are all in other repos.

Change-Id: I512e6674549a99fdafe47f2138738463f4e66e37
Reviewed-on: https://dart-review.googlesource.com/46126
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Mike Fairhurst <mfairhurst@google.com>
2018-03-12 23:02:29 +00:00
Samir Jindel 290c576264 Remove inherited setters for mixed-in fields and copy their covariance-bits.
Currently the transformed expectations are not checked.
This will be implemented shortly.

Mixin code from kmillikin@ (https://dart-review.googlesource.com/c/sdk/+/46060).
Test from jensjoha@.

Change-Id: If8abe4950b80bbec993833700bfeeb8be15f9585
Reviewed-on: https://dart-review.googlesource.com/46061
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Samir Jindel <sjindel@google.com>
2018-03-12 14:25:01 +00:00
Peter von der Ahé 52b66e17fe Make fasta command line work on Windows
Change-Id: I2c3f5fea5948074c9dee138c387065edbe08b644
Reviewed-on: https://dart-review.googlesource.com/45509
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Peter von der Ahé <ahe@google.com>
2018-03-12 14:00:39 +00:00
Dmitry Stefantsov cb2e4b183e [fasta] Rename some methods in Forest API
Change-Id: Ic12bee4d3ff139135b1738bfb52485b26884c68b
Reviewed-on: https://dart-review.googlesource.com/45720
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2018-03-12 13:24:08 +00:00
Dmitry Stefantsov f820555d19 Add test of type checks on redirecting initializer arguments
Bug: http://dartbug.com/32343
Change-Id: I863e370a3148f7a7da7a4c4599e005b381ceffa7
Reviewed-on: https://dart-review.googlesource.com/44465
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2018-03-12 08:49:37 +00:00
Dmitry Stefantsov c31e628c4c Check types of arguments passed to redirecting initializers
Fixes #32343

Bug: http://dartbug.com/32343
Change-Id: I3f04d5a11e17541b7318c3721657c28928e7a634
Reviewed-on: https://dart-review.googlesource.com/44463
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-12 08:49:37 +00:00
Lasse Reichstein Holst Nielsen b3c12d4e3a Dart 2 Libraries Wave 3
Add `typeArguments` to Invocation.
Add constructors to Invocation, making it less necessary for users to create their own implementations.
Add tests.
Add Symbol.unaryMinus and Symbol.empty constants.

Change-Id: I70cb3265f9413617cf57fce1297e393a29eeb26a
Reviewed-on: https://dart-review.googlesource.com/40741
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2018-03-08 16:36:07 +00:00
Aske Simon Christensen b457d71713 Canonicalize representation of a message without location.
This simplifies formatting and reporting logic.

Also move the noLength constant to fasta_codes.dart, where it more
rightly belongs. This avoids loads of bogus imports of the parser.

Change-Id: I2720df0e6ff627fba8f4bdd9ed03ee87bc0db0bd
Reviewed-on: https://dart-review.googlesource.com/44424
Commit-Queue: Peter von der Ahé <ahe@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-08 12:58:17 +00:00
Paul Berry db08061424 Handle implicit tear-off of .call when an implicit downcast is required
Previously, we were setting `expression` incorrectly after generating
the implicit tear-off of .call, so if an implicit downcast was needed
as well, it was not attached to the proper kernel node, and the
resulting kernel representation was invalid.

Addresses the front end manifestation of #32426.

Change-Id: Ibd86b75c54a53db1fc4606b7583910c57e1c4aae
Reviewed-on: https://dart-review.googlesource.com/45522
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2018-03-07 13:59:39 +00:00
Dan Rubel 83c8c21abe Gracefully handle local function modifiers
Change-Id: I23f5ab9c9aaaee595ab6c552a6dddf9522ee17cd
Reviewed-on: https://dart-review.googlesource.com/45400
Commit-Queue: Dan Rubel <danrubel@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2018-03-07 12:47:31 +00:00
Paul Berry d17db1d5f3 Pass type inference context down to field initializer when type inferred via override
Fixes #32412.

Change-Id: I52660ffd5a6eadd10c6d62a17c64872946aa2a4a
Reviewed-on: https://dart-review.googlesource.com/45520
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-07 11:45:34 +00:00
Paul Berry 615f40bc1d Ensure that null is not used as a context in more places.
This CL changes the handling of writeContext (for complex
assignments), returnOrYieldContext (for closures), expectedType (for
ensureAssignable), and receiverType (for findInterfaceMember) so that
they no longer use `null` to represent a context; they use UnknownType
or DynamicType as appropriate.

It also changes the handling of expectedType (for ensureAssignable) so
that it does not require the type to be known.  That makes this CL
simpler and paves the way for fixing #31792.

Change-Id: Ib1be06182f9a9e9f77a9eb81f5daf2364de0f3a7
Reviewed-on: https://dart-review.googlesource.com/44800
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-07 09:30:33 +00:00
Peter von der Ahé 9f56e28372 Mixin Applications with a Vengeance
Change-Id: I213f99234f29abd7e2ec03dc8451ed6dd16f3d03
Reviewed-on: https://dart-review.googlesource.com/45021
Reviewed-by: Kevin Millikin <kmillikin@google.com>
2018-03-06 15:15:57 +00:00
Jens Johansen 17d5c44d40 [fasta] Invalidate part file when init from dill
This CL adds a test that invalidates a part file after initializing from
a dill file. It futher more fixes the found issue so the part file (and
subsequent entire library it is a part of) is invalidated. Previously
invalidating a part file had no effect.

Change-Id: I0e76998d0ce2247b58c4a0e6cd691062b3069a2b
Reviewed-on: https://dart-review.googlesource.com/45181
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-06 10:19:01 +00:00
Jens Johansen e047586a0e Fix bad merge after 2181119d87
Change-Id: I1e8131ae2ad8f5ac2e86a6590d303f69161d092a
Reviewed-on: https://dart-review.googlesource.com/45180
Reviewed-by: Jens Johansen <jensj@google.com>
2018-03-06 07:52:30 +00:00
Jens Johansen 2181119d87 Test and fix invalidating file exporting main
In the incremental compiler, invalidating a file that exports other
libraries (among them one containing main) will fail to have a main set
in the resulting dill file.

This CL fixes the issue and introduces a test.

Change-Id: Ib7fe5ca46a44017eba6c5fcd39c358fe1b857a26
Reviewed-on: https://dart-review.googlesource.com/45000
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-03-06 07:24:12 +00:00
Leaf Petersen 4066804e5f Remove hint suppression now that MapEntry has landed
Change-Id: I35d9c7105c2a5278b5b9558af9fe0570839fc51f
Reviewed-on: https://dart-review.googlesource.com/44882
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Peter von der Ahé <ahe@google.com>
2018-03-05 18:45:51 +00:00
Jens Johansen d1203a382f [fasta] Use platform as outline in incremental test; assert non-empty mixin bodies
Change-Id: I6dba18b8202b24ee3a87df5f18b1989bc62ef465
Reviewed-on: https://dart-review.googlesource.com/44431
Reviewed-by: Peter von der Ahé <ahe@google.com>
Reviewed-by: Kevin Millikin <kmillikin@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-03-05 14:30:07 +00:00
Jens Johansen 14c1834334 [fasta] Add mixin test to incremental compiler test
This CL adds another incremental compilation test extracted from flutter
that currently fails.

Change-Id: I03c7cf48933b3a6608e93ec34e5c27941b7d1ecb
Reviewed-on: https://dart-review.googlesource.com/44940
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-03-05 12:32:03 +00:00
Jens Johansen e5295eb6d1 [fasta] Small changes to the incremental compiler
Fixes based on remarks in https://dart-review.googlesource.com/44720.

Change-Id: I455f8e62508c888873ae776af2d0a19e4ca49123
Reviewed-on: https://dart-review.googlesource.com/44941
Reviewed-by: Peter von der Ahé <ahe@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2018-03-05 11:58:23 +00:00