Commit Graph

101 Commits

Author SHA1 Message Date
Jens Johansen ac9b4aab8d [parser] More specific error messages when recovering new/const/Map/Set/List with said literals
Follow-up to https://dart-review.googlesource.com/c/sdk/+/190022

Change-Id: Id42336216267dcbf481ae6e111177e6296ea6779
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190881
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-03-25 13:27:03 +00:00
Jens Johansen fd89f1176b [parser] Test for (already fixed) issue 45327
The crash reported in #45327 was already fixed, but for good measure
we'll add the provided examples as tests.

Change-Id: I74f3b78b8644712322d0fb582bbbbde291a8994e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/191366
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-03-16 14:45:00 +00:00
Jens Johansen b5da327ed9 [parser] Parse and skip metadata according to spec
Make the parser handle metadata properly according to the spec.

There has been some confusion in regards to metadata because
https://github.com/dart-lang/language/blob/master/accepted/future-releases/small-features-21Q1/feature-specification.md
(used to) say we needed a spec update.

That was done in the parser in
https://dart-review.googlesource.com/c/sdk/+/182668
but really that made the parser adhere to the spec as it was which is
also correct (as the spec change wasn't needed at all).

The parser also needs to be able to skip metadata, though, and that
wasn't done it that CL which caused the issues in
https://github.com/dart-lang/sdk/issues/45120

The work directly in this CL is:
* Add lots of comments to parseMetadata to make them more up-to-date with
  the spec.
* Fix skipMetadata to correspond to parseMetadata.
* Tests verifying that 45120 is fixed in the parser and that metadata in
  general works as expected in the parser.

(In working on this, the future specification was corrected to say that the
spec did not need updating. Thanks to Erik for the quick turn-around
there).

Bug: #45120
Change-Id: Id1e4912cac7e5d9113efe083b3ecd06e6834a16e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190880
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-03-15 08:40:40 +00:00
Jens Johansen 31acdc9d92 [parser] Recovery of of new/const/Map/Set/List with said literals
E.g. recover `Map<int, int>{}` by ignoring the map (i.e. it's
just a literal map), recover `new {}` as just `{}` etc.

Fixes #45251.

Change-Id: I44e67ca6d3b9b068014b8e28822a61063c794d57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/190022
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-03-12 10:41:06 +00:00
Jens Johansen 1392263ecc [parser] Non-crashing recovery of in-progress generification of typedef
Fixes #43090

Change-Id: I1377ebf08a8c561e4f15abbf458c5bb0d8c61494
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182040
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-04 08:01:07 +00:00
Jens Johansen 16a66c8902 [parser] Don't crash, try to recover from written out logical operators and and or
Fixes #44785

Change-Id: I4c7198ea1c223900a58039c032ee303d7da2c14f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181580
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-01 09:30:48 +00:00
Johnni Winther 63373b9e9c [cfe,analyzer] Pass message arguments directly to AnalysisError
This allows for supporting customized message for scanner/parser
errors.

Change-Id: Ib9470c3d8231de69611bc672570ae8902e9c0e6e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/177940
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-01-11 16:45:26 +00:00
Jens Johansen f7052cfbbc [parser] Better handling of eof when parsing 'Stream<List<>>'
This CL avoids the infinite loop created by allowing the parser
to parse it as a complex type (despite no actual name after it) and
adds a few asserts in an attempt to catch rewriting on eof (setting a
token after eof).

Fixes #42229
Fixes #44477

Change-Id: Ie2da0957894067a3d4748cb6384bc9d6cf32c215
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150521
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-01-11 09:55:06 +00:00
Jens Johansen c60398400e [parser] Recover better from 'required' parameter declaration in non-nnbd
Natural follow-up to https://github.com/dart-lang/sdk/issues/44379.

Change-Id: Idf73df0c9e8ce1f477d05aa73caf8975d2ffb9f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175307
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-12-09 13:47:19 +00:00
Jens Johansen a8b372057e [parser] Recover better from 'late' field/variable declaration in non-nnbd
Fixes #44379
(https://github.com/dart-lang/sdk/issues/44379)

Change-Id: If97d0d57b1fe16777f6208b49a8b472420ac526a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175306
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-12-09 13:01:39 +00:00
Jens Johansen c36d4d65af [parser] Give errors when 'external' comes in wrong order
Fixes https://github.com/dart-lang/sdk/issues/43851
Fixes https://github.com/dart-lang/sdk/issues/43858
Fixes https://github.com/dart-lang/sdk/issues/43859

Change-Id: I33c9cde01a0843efba3ca0d0a679f4e31b06237c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168650
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-23 09:19:01 +00:00
Jens Johansen 553230ffb4 [parser] Give errors when 'abstract' comes in wrong order
Fixes https://github.com/dart-lang/sdk/issues/43855
Fixes https://github.com/dart-lang/sdk/issues/43856
Fixes https://github.com/dart-lang/sdk/issues/43857

Change-Id: I83ee716288741d2d84a1993e9743ad4b82af22ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168646
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-23 08:05:31 +00:00
Jens Johansen 5a6129406f [parser] Consistently disallow 'late' without 'var', 'final' or type
Fixes https://github.com/dart-lang/sdk/issues/43811
Fixes https://github.com/dart-lang/sdk/issues/43812
Fixes https://github.com/dart-lang/sdk/issues/43813

Change-Id: I39de527883d33459694ec0f91b769676eb52d54b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168641
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-23 06:28:51 +00:00
Jens Johansen e6ffc0b285 [parser] Issue different warnings for missing identifier based on whether the token is used or not.
E.g. "var = 42;" now has a different error message than "var default = 42;".

Fixes #22553

Change-Id: I58affe988569d8e79190b63f7267b471a1b0ebc8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162182
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-14 08:55:18 +00:00
Jens Johansen b0acaea1e5 [parser] Recover written out binary operators
* Add mechanisms to try out a recovery and only perform it if is
  successful.
* Recover written out binary operators, e.g. "a xor b", "a or b" etc.
  This fixes #26810 and is also how these operators are written in e.g.
  Kotlin. This might be somewhat controversial though.
* Adds a mechanism to _replace_ a token by another token.
  This might be controversial.
  It is done because just inserting the operator causes the same rewrite
  to be attempted on the same token stream several times (at least with
  the way the token stream is parsed via the CFE) in turn causing it to
  be recovered *sometimes*. This is now avoided by actually replacing
  the token.

Change-Id: Icfa806045575d2aa2e5f35126708651b275bcf84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/162003
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-09-10 06:23:33 +00:00
Jens Johansen a06e53b557 [parser] Set forIn = true when recovering 'in' written as ':'
Before this change the CFE crashed with an assert error.

Change-Id: Ide486388fbba8c6cda4bb75e5339ae3c10623351
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161949
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-09-09 06:41:14 +00:00
Jens Johansen b4673b58b9 [parser] Better recovery of typedefs with missing 'Function' keyword
This CL improves recovery in situations like this:

typedef c = foo(int x);
 => recovers like typedef c = foo Function(int x);

typedef d = (int x);
 => recovers like typedef d = Function(int x);

typedef e = foo<F>(int x);
 => recovers like typedef e = foo<F> Function(int x);

typedef f = <F>(int x);
 => recovers like Function<F>(int x);

typedef g = foo<F, G, H, I, J>(int x);
 => recovers like typedef g = foo<F, G, H, I, J> Function(int x);

typedef h = <F, G, H, I, J>(int x);
 => recovers like typedef h = Function<F, G, H, I, J>(int x);

typedef i = <F, G, H, I, J>;
 => recovers like typedef i = Function<F, G, H, I, J>();

And appropriate error messages are given:
"Expected 'Function' before this." and (when inserting parenthesis)
"A typedef needs an explicit list of parameters.".

Fixes #26073.

Change-Id: I368f36f2993033d62b36315198bc993eed74bc92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161485
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-08 11:43:14 +00:00
Jens Johansen 3a1f732c0f [parser] Make begin/end events always come in pairs
This CL:
* Changes the events so beginX and endX events always comes in pairs
  (though technically not right as some specific events can be beginX
  endY --- but in those cases it is at least documented and used in code
  that actually tests it).
  -> This entails adding some events and converting something from
    "beginX" to "handleX" instead.
* Adds a utility that can generate an AST of sorts directly from the
  parser via a listener using the begin/end matching (and knowing of the
  specific ones that doesn't match directly).
* Adds a test that checks that - at least for all tested (50,000+) files
  - the AST actually generate "correctly", i.e. matches up begin/ends
  and ends up with a single top entry "CompilationUnit".
* Adds a different visualization to the parser listener events by
  displaying the "AST directly from the parser" in a UI that can be
  navigated. The visualization may not be the best, but it's certainly
  a stepping stone.

Change-Id: I9b27f7bbf3be442adc92f357c7b3c46da6f84cf7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/159664
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-09-01 09:30:43 +00:00
Jens Johansen 0967d19156 [parser] Fix assert error in scanner
If an identifier starts with a non-ascii-character and has a comment
an assert was triggered about the comment not being attached to the
token. This CL attaches the comment to the token (which it should be)
and thus avoiding the assert trigger.

Change-Id: Id261970b88ca721d4b3a996abfb8ff43f0ec8341
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/161102
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-08-31 14:19:48 +00:00
Jens Johansen 8bca93872a [parser] Better error message for annotations on type arguments
This CL changes the message given in the situation identified in
https://github.com/dart-lang/sdk/issues/22314

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

Change-Id: Ibd47dd419d52673ae0d9e32039e0a635c1e09543
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158388
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-08-17 07:43:52 +00:00
Jens Johansen 7e42cbf582 [parser] Change recovery of multiple extends with comma
E.g. class Foo extends Bar, Baz {} would before have parsed weirdly,
but it will parse as you'd (probably) expect with an error saying
you cannot do that. For now at least both CFE and Analyzer will
pretend like you just specified the first one but I suppose Analyzer
could for instance use the extra information to propose converting
other ones to implements clauses or similar.

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

Change-Id: I180cdd8ab07143dd74fd21c9976ec2a46c428d8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158261
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-08-13 08:49:53 +00:00
Jens Johansen b6423f1f81 [CFE] Make parser_test_listener up-to-date
This also changes lots of expect files.
I don't know how it got out-of-date --- I actually thought that was
tested. It seems it's not...

Change-Id: I6dd524908b8735a5889ed6fdb59be5383e4e8237
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/158301
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-08-12 14:28:54 +00:00
Jens Johansen 4c0cab024e [parser] No longer support ?.[ syntax
Update CFE tests (and a few analyzer tests) to match the new world
of the syntax being unsupported.

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

Change-Id: I71bc973f36dfb978ddb825edb68530d8e260a58a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/157980
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-08-11 08:09:59 +00:00
Johnni Winther a021b99fc3 [cfe] Fix scope setup for generic function types
Closes #36870
Closes #41951
Closes #42364

Change-Id: Id323bfdc26c688bfeb756ef8c1e0530283b44e34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/156028
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-29 09:04:24 +00:00
Johnni Winther 92f4eb58c8 [cfe] Support abstract fields
Only positive implementation, no error states are checked yet.

Change-Id: Iad79da1dd7e8be9229ee9d47c5301d39ebc3debc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154003
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-07-16 10:13:23 +00:00
Paul Berry 8cb7dfa70f Modify parser to handle abstract fields.
There is no functional change to the analyzer or CFE yet; we simply
report the error in the parser listeners now rather than the parser
itself.  In follow up CLs when we add full support for the feature, we
will want to keep the error reporting logic, but only report the
errors in pre-NNBD code.

Change-Id: Ifd14dd97d7d1d57586a8e14a25103356d54f0ea1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154364
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-07-15 22:48:01 +00:00
Jens Johansen 01ac35b844 [parser] Allow '..' as something following a nullable type
Fixes https://github.com/dart-lang/sdk/issues/42621

Change-Id: I56fd9475ffb3821592a6917949e858c6e48bdf20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153773
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-07-09 15:03:17 +00:00
Johnni Winther 9ab7a5edef [cfe] Use variable name in error message for missing initializer
Closes #42610

Change-Id: I70a5ac9302bd6545cd5e73f2dab61a29bc6a3000
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153462
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-08 12:45:15 +00:00
Jens Johansen 50836c171e [parser] Fix parsing of empty index in cascade
Fixes #42267

Change-Id: Ia09fd9e564bc0b04cdd99d3aac5093a12ab10d96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150926
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-06-12 06:36:58 +00:00
Jens Johansen c800b8d19c [parser] Parser tests reproducing bad recovery of 'Stream<List<>>'
Reproduction of issue #42229.

Change-Id: I0c70f04663e37d4ed35a70501024cd3cead8c849
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150520
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-06-10 07:10:50 +00:00
Jens Johansen cbbbc09b3e [parser] Better recovery of typedefs with bad name
Note that this leaves differences in errors issued between
"typedef void void();" and "typedef void = void Function();" though.

Fixes #42158

Change-Id: I0785f99234c87bdeadbb2865e089b1389851333e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149599
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-06-04 14:21:11 +00:00
Jens Johansen 1b5197e55f [parser] Update parser tests for using keywords as methods/fields/typedefs
The previous tests only tested out reserved keywords (here updated to all
keywords) and forgot about typedefs altogether (added here).

Change-Id: Ibb98ef5e3342077343484640c9ebf6bc239164dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/149597
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-06-03 10:12:29 +00:00
Paul Berry 3ca37fb66e Re-apply some recent parser fixes.
My recent revert (275b922ee8) mistakenly
reverted too much (I incorrectly attributed the angular failure to
1f9b5c1996 when it was actually due to
96df1f9e6c).  Reapply the commits that
are ok.

This re-applies commit 1f9b5c1996.
This re-applies commit c40b24da48.

Change-Id: I4d64b1511b92d87197a5e939903a31e01f0b2e70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147920
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-05-13 16:00:01 +00:00
Paul Berry 275b922ee8 Revert recent parser fixes
Commit 1f9b5c1996 causes tests to fail
in angular when rolled into internal sources; the other two commits
need to be reverted as well to avoid merge conflicts.

This reverts commit 1f9b5c1996.
This reverts commit c40b24da48.
This reverts commit 96df1f9e6c.

Change-Id: Ic4e55181ef60e825ce4409a9a9528ecbf19c39c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147822
Reviewed-by: Mike Fairhurst <mfairhurst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-05-12 22:02:09 +00:00
Johnni Winther d5650235a2 [cfe] Handle ProblemBuilder in binary expression
Closes #41787

Change-Id: I81fcf0aee975b58b3b44d0de94054ae87bdd265d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/147140
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-05-12 11:44:19 +00:00
Jens Johansen 96df1f9e6c [parser] Add ErrorToken for ignored (unmatched) end parenthesis, brackets etc
Change-Id: Idb57295700988d71321743af9782134b02562311
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146240
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-11 14:46:47 +00:00
Jens Johansen c40b24da48 [parser] Show errors from 'handleErrorToken' in parser suite tests
Change-Id: I3528136b6c220f0fe72d9d7b2aa591737c4c7096
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146225
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-07 11:23:48 +00:00
Jens Johansen 1f9b5c1996 [parser] Recovery of unbalanced parenthesis, brackets etc.
Bug: https://github.com/dart-lang/sdk/issues/41000

Change-Id: I8d1d8ff5d3f832f9b6b5e5880b59a485a7ff9b96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/146224
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-07 10:04:08 +00:00
Jens Johansen 5b76fc2172 [parser] Better recovery of methods/fields called 'const', 'final', 'var' or 'void'
Change-Id: I370089a6de8c585a60785fe069de5da869ae23f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145820
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-05-06 11:56:24 +00:00
Jens Johansen 497bdc5226 [parser] Some recovery from using reserved words as method/field names
Change-Id: I9795ecc28f06d1f9410066ded73405019052947d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145586
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-05-05 07:56:33 +00:00
Jens Johansen a840da4617 [parser] Tests of using build in identifier and reserved keywords as method/field names
Bug: https://github.com/dart-lang/sdk/issues/40419
Change-Id: Ide0fabc4466714a7f9bb9a4474c80a3dfafde56f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/145584
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-05-01 07:40:46 +00:00
Johnni Winther 712efa2a49 [cfe] Handle problems and recovery in non-null check
Closes #41597

Change-Id: I781d70d7cd720ab09d68a22ead1639bf37953955
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144941
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-28 08:06:48 +00:00
Jens Johansen 676c2df9a2 [CFE] Fix parser expect output when there's errorTokens all over the place
Change-Id: I5509f866bb33e91f49d873678761e00ce8601654
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/144284
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-04-21 13:03:43 +00:00
Jens Johansen 97e0983094 [parser] Fix NP in scanner caused by never setting eof
This e.g. happends on input that's UTF-16 LE.

Also see https://github.com/flutter/flutter/issues/54840.

Note that this doesn't really fix much, because the scanner still
tries to read the input as utf8 (which it potentially isn't, and isn't
in the test cases added) and it thus basically outputs garbage.

Change-Id: I7198928dc6f0dd16728c1c04ccd4286faae8dd20
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143586
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-04-20 13:21:46 +00:00
Johnni Winther 594f77715b [cfe] Handle potentially constant type expression in is expression
Closes #41385

Change-Id: Ia2fa829621931d52c5e41ac0414d12b9caa1256d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142860
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-16 09:07:21 +00:00
Jens Johansen 9f06c32b45 [CFE] Fix crash when implementing or mixing in a functionType
Bug: 41265
Change-Id: Idf4fbc44c210008c3c94639c138adbd3afec2cef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/143522
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-04-16 06:35:50 +00:00
Johnni Winther fae35fca47 [cfe] Handle potentially constant type expressions in CFE
Closes #41305

Change-Id: Ibb839c5b6619ae2f7e90cc956c7de20d8c76ae3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/142120
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-04-02 13:23:04 +00:00
Jens Johansen 43079207d4 [parser] Parse a!?[0]
Fixes #41177.

Change-Id: I135f0b7aedbcb320ab0d1a1806b2ad3bedcda307
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/141886
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-04-01 07:33:01 +00:00
Jens Johansen 4ab3bda5db [parser] Change recovery for constructor; report errors in bad constructors
Change-Id: I3d656afce4a3ec14c7c099893a434abba3945ebf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/140862
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-03-27 11:57:56 +00:00
Jens Johansen 13dbe2a815 [parser] Correct precedence on ?[ when it's an index bracket operator
Fixes #40267.

Change-Id: I1929da0500f85f70dc241d969d05590a1e0c277e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/138927
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-03-12 11:25:02 +00:00