Commit Graph

592 Commits

Author SHA1 Message Date
Johnni Winther 44e35b1daa [cfe] Check for misplaced type arguments on implicit creation expression
Change-Id: Ic3436f2bce0369d0efad9946cbbdae7c6bf334b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/218400
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2021-10-28 19:21:39 +00:00
Johnni Winther 1972c11b4e [cfe] Support implicit super call
Closes https://github.com/dart-lang/sdk/issues/47545

Change-Id: I7adc75c574fd6d0be17f2f53066d34efd5d54a08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217922
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-10-26 10:02:54 +00:00
Paul Berry ce8ee6cf03 Check the number of arguments when instantiating AnalysisErrors.
Change-Id: I45fa2a560b7368370fae4a7a94d8f52136e92486
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213821
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-23 14:13:33 +00:00
Konstantin Shcheglov b3a1e96dba Prepare to publish analyzer 2.7.0 and _fe_analyzer_shared 30.0.0
Change-Id: I49b313dcdef2349b811bc853bd54cc57db78379e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217444
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-22 01:05:56 +00:00
Paul Berry 0a39aa7cf6 Make all analyzer message arguments non-nullable.
Cases where `null` was being passed as an argument to formatting a
message have all been fixed in previous CLs; all that remains to do is
change the type system to reflect that, and insert `!`s in a few
places.

This brings us one step closer to being able to make analyzer message
formatting type safe.

Change-Id: Id9e0d0b32f29cde0fdc5227417b7a2e3fc3b443d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216272
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-20 11:31:51 +00:00
Paul Berry b0b1534f3e Make checkUnassigned easier to debug in flow analysis tests.
This change adds a stack trace so that if the check fails, the user
sees the stack trace of the call to `checkUnassigned` prior to the
stack trace from the process of visiting the mini-AST.  Usually teh
stack trace from the call to `checkUnassigned` is much more useful in
debugging, since it allows the user to see the location of the problem
relative to the code being analyzed.

Change-Id: I125b4059ec740850919798cfa66bf7e8c7490213
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217283
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-10-19 19:49:03 +00:00
Paul Berry e5e8f84927 Rework how final and late are represented in flow analysis tests.
The fields `isFinal` and `isLate` are moved to the `Var` class.  This
should allow greater flexibility when experimenting with possible
changes in promotion behavior for final and late variables.

Bug: https://github.com/dart-lang/language/issues/1721
Change-Id: I3a328566b4a55244ca76c41da6e362066118d283
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/217261
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-10-19 18:18:52 +00:00
Chloe Stefantsova a666b5a72b [analyzer,parser] Check for named before positional in analyzer
Since the check or the absence of the check for a named argument
appearing before a positional parameter is feature-specific
considering the language feature that allows placing the named
arguments anywhere, it should be performed by the listeners of the
parser and guarded by an experiment flag, in alignment with other
experimental featuers. This CL moves the check and the reporting of
the error from the parser into the Analyzer, so that later this check
can be skipped if the corresponding experiment flag is enabled.

Part of https://github.com/dart-lang/sdk/issues/47451.

Change-Id: Ib795d418af429ee04ecfff6dfa71ec1e836fe798
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216640
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Chloe Stefantsova <dmitryas@google.com>
2021-10-14 13:25:23 +00:00
Sam Rawlins 20da76f9f8 Update parser to allow unnamed constructor reference in comment reference
Code like `/// See also [List.new].` will be accepted as a valid comment
reference.

Test in front_end, analyzer, analysis_server.

Remove TODOs in analyzer for reporting a reference to an element whose
library is not the library in which the comment is found.

Bug: https://github.com/dart-lang/sdk/issues/47446
Change-Id: Ifa19278f92ac003082b62b121c66f0559c0152e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216583
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-10-13 14:09:26 +00:00
Konstantin Shcheglov 16e3734b14 Prepare to publish analyzer 2.6.0 and _fe_analyzer_shared 29.0.0
Change-Id: Ia7aa32d010597251dfc133fe6eac40ce149a48a5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216360
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-12 20:59:45 +00:00
Clement Skau 998d5f5a9b [vm/ffi] Adds FFI transform FfiNative instance methods.
- Allows FfiNative annotation to be attached to non-static
  methods of classes.
- Transforms non-static instance methods to static, adding
  wrappers with the receiver as an extra, implicit first paramters.
- Transform all parameters and arguments to Pointer if the object
  being passed supports it (i.e. extends NativeFieldWrapperClass1).
- Adds compile time errors for cases where the FfiNative annotation
  doesn't align with the annotated function. Taking into account
  implicit receivers and converted Pointers.
- Adds complimentary Analyzer checks for the above errors as well.
- Adds tests for the transforms, compile time errors and analyzer
  changes.

TEST=Adds new tests for instance methods, analyzer changes.

Change-Id: Idf54430acf2728a650008333b149b254941290ad
Cq-Do-Not-Cancel-Tryjobs: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213773
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2021-10-12 10:58:44 +00:00
Sam Rawlins 228e1062ee Move front_end's libraries.json parser to _fe_analyzer_shared
Bug: https://github.com/dart-lang/sdk/issues/35081
Change-Id: Idd1c68a871ace37e45970e5452a59fd655445fd3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216100
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-10-11 17:59:43 +00:00
Paul Berry 3cb2d38723 Coalesce two more analyzer errors with their front end counterparts.
Change-Id: Iec2e6e67a4c3af1309ee208007008ca595059bd2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/216001
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-10-08 18:30:28 +00:00
Johnni Winther 9603871cfd [cfe] Report error on 'new' used invalidly as selector
Part of https://github.com/dart-lang/sdk/issues/46232

Closes #47075

Change-Id: I6aece2236d6f45ec50bda3622b133c16761dd990
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215764
Reviewed-by: Chloe Stefantsova <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-10-07 13:24:33 +00:00
Srujan Gaddam 67be663490 [pkg:js] Add @staticInterop annotation to package:js
Adds @staticInterop annotation to allow users to declare static interop
classes. Also adds errors for erroneous usage of static interop
classes, like including instance members or using a non-static
supertype.

Change-Id: I21abafbf6ea6c2eb7cd0425f0a54c1ba35d6ec6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215010
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-10-06 19:04:02 +00:00
Johnni Winther 3171c7cc0e [cfe] Remove UnresolvedType
All NamedTypeBuilder objects from user code contain the needed file uri
and char offset.

Change-Id: Ia067c5ef740967302aa207eaf2d46fc2f75c1c8f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215600
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-10-06 07:39:34 +00:00
Konstantin Shcheglov 34b2bcb50d Prepare to publish analyzer 2.5.0 and _fe_analyzer_shared 28.0.0
Change-Id: I72d6b6b6634a949c1b1fb5ff5aa3dfa51ad835e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215644
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-10-05 22:05:32 +00:00
Johnni Winther cf1591f935 [cfe] Refactor detection of instance type variable access in static context
NamedTypeBuilder is now created with a state that determines whether it
can validly be resolved to an instance type variable.

Change-Id: I1e7f5f8e05a5f68ec18a063476b6cda291a1aca8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/214643
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-10-05 11:58:04 +00:00
Paul Berry 757d179380 Update nomenclature in ErrorCode and related classes.
This change standardizes most of the analyzer to refer to problem
messages and correction messages using the names `problemMessage` and
`correctionMessage` (consistent with the naming convention used in the
analyzer and CFE `messages.yaml` files).

Change-Id: I72f078a368c65b346626f560cc721fcff4836452
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215151
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-10-04 19:50:37 +00:00
Paul Berry b2c2acee09 Adjust front end nomenclature for error messages.
This change updates the classes Message, MessageCode, Template,
LocatedMessage, and FormattedMessage so that they uniformly refer to
error message text using the terminology `problemMessage` and to
correction suggestions using the terminology `correctionMessage`.
This brings them into alignment with the names we've decided to use to
unify the structure of front_end and analyzer, and makes them match
the names used in the anlayzer and front end's `messages.yaml` files.

Change-Id: Idcbb7ccfff6bb4e99ca22a3ef3c19d83880cf3c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215154
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-10-04 13:32:46 +00:00
Konstantin Shcheglov 4f80522fe4 Prepare to publish analyzer 2.4.0 and _fe_analyzer_shared 27.0.0
Change-Id: I48d0f8fcd4f966c9c55542ae9d239095b81ea45c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/215007
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-10-01 16:45:23 +00:00
Johnni Winther 2fa89236d7 [cfe] Handle potentially constant types in instantiations
Part of https://github.com/dart-lang/sdk/issues/46232

Closes #47154

Change-Id: I71fe16d26facf29bdae1b98971c4ccfe18f95e80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213772
Reviewed-by: Chloe Stefantsova <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-09-23 09:04:12 +00:00
Paul Berry af18bfacc1 Fix analyzerCode corresponding to CFE error ConstructorWithTypeArguments.
Previously we had identified this error with the analyzer error code
CompileTimeErrorCode.WRONG_NUMBER_OF_TYPE_ARGUMENTS_CONSTRUCTOR, but
they're not the same error at all.  As a result, code like this:

    var x = new a.b.c<C>();

would lead to the bogus analyzer error text "The constructor '{0}.{1}'
doesn't have type parameters." (with the placeholders "{0}" and "{1}"
visible to the user).

With this change, the error text is the same as that from the CFE: "A
constructor invocation can't have type arguments after the constructor
name."

Change-Id: Ib69d1ff8f7089e59b71d2dcd9a8ec51edffd94dc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213621
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-09-17 10:48:59 +00:00
Konstantin Shcheglov 2f75d18626 Prepare to publish analyzer 2.3.0 and _fe_analyzer_shared 26.0.0
Change-Id: I77350acbf48b58cb19e444628643c6743e806eb9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/213285
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-15 22:23:34 +00:00
Jens Johansen 497a331365 [parser] Set 'recovered' in more cases
Fixes https://github.com/dart-lang/sdk/issues/47009
Fixes https://github.com/dart-lang/sdk/issues/47008

Change-Id: I4d00e378ad7cfe3b84fe0f48b11cb83ad7a14fc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212826
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2021-09-10 08:18:17 +00:00
Paul Berry b65a18f54f Add a flow analysis ID test of new constructor-tearoffs behaviors.
These behaviors were introduced during the fix for
https://github.com/dart-lang/language/issues/1785, and at the time
they were tested using both unit tests and language tests.  But it was
not possible to write ID tests for them, because ID tests don't
support turning on experimental language feature flags.

Now that the "constructor-tearoffs" feature has been turned on we can
test these behaviors using ID tests.

Change-Id: I6e1ccda4b5837ab61de80f15d2f31a82a90b4a22
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212265
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-09-07 21:39:46 +00:00
Dmitry Stefantsov ab508bb2d1 [cfe] Add basic parsing support for extension show clause
Change-Id: I63847a06ff7370dd1b92fc6b4b706c684f15638e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209909
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-09-07 10:35:12 +00:00
Johnni Winther 7fb3d36c03 [cfe] End support for dart-ext
https://github.com/dart-lang/sdk/issues/45451

Change-Id: Ieed7c4a200b0480975715a149596b1f5ea733814
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212002
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-09-03 09:18:26 +00:00
Konstantin Shcheglov c88fbeec63 Prepare to publish analyzer 2.2.0 and _fe_analyzer_shared 25.0.0
Change-Id: Ice3a628fe70d88901d9db9de64fd9dd9deaf4ebd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212264
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-09-02 02:15:31 +00:00
Johnni Winther 93c531f1a0 [cfe] Move force* flags from TargetFlags to TestTargetFlags
TEST=existing

Change-Id: I3db6f5bdd72ca6303766b6524df19e66b1ba1cc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/212001
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-09-01 13:29:26 +00:00
Jens Johansen 1231e3dad4 [parser] Better error message for >>> when not enabled in some cases (part 2)
https://github.com/dart-lang/sdk/issues/46886

Change-Id: I6195ad921f5c4b9622c735cb919c2d88f957f374
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211820
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-09-01 11:12:28 +00:00
Konstantin Shcheglov b12724b7c6 Issue 47026. Use simple subtype check for combining signatures.
Bug: https://github.com/dart-lang/sdk/issues/47026
Change-Id: Id6999e0eaab03ffa0caa63c97b708526d22a8d97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211605
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-30 16:38:39 +00:00
Jens Johansen 5caa4365d7 [parser] Add beforeSynthetic to SyntheticStringToken
E.g. if reporting a missing ";" after a SyntheticStringToken (e.g. a
inserted identifier) before this CL it would go to the next token and
say we expected the ";" after that, when really we expected it *before*
that token.

Change-Id: I2c358e017edb2f661e307eba03dddaee889086d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205799
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-08-30 11:56:30 +00:00
Paul Berry 1b18e8f5ac Flow analysis: account for initializers of implicitly typed variables.
Previously, initializers of implicitly typed variables did not
contribute to the SSA tracking performed by flow analysis (see
https://github.com/dart-lang/language/issues/1785).  This change fixes
the bug, however the fix is conditioned on the "constructor tearoffs"
language feature to avoid compatibility issues (we don't want someone
to publish a package taking advantage of the fix, without realizing
that it makes their package unusable on older SDKs).

TEST=standard trybots
Bug: https://github.com/dart-lang/language/issues/1785
Change-Id: I1143440c7a9795b059e8f4b84e3f4125cd80732c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211306
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-08-27 15:01:15 +00:00
Paul Berry 1b4f067e0b Parser: Reduce the set of disambiguation tokens for resolving < ambiguities.
When the parser encounters a `<` after an expression, it must choose
whether to interpret it as a relational operator or a <typeArguments>
selector.  The disambiguation rule is: if the `<` and the tokens
following it *can* be parsed as <typeArguments>, and the token that
follows is a member of a privileged set of tokens, then it is treated
as a <typeArguments> selector; otherwise it is treated as a relational
operator.

This change reduces the privileged set of tokens to the following:

- the "continuation tokens" `(`, `.`, `==`, and `!=`
- the "stop tokens" `)`, `]`, `}`, `;`, `:`, and `,`

The names "continuation tokens" and "stop tokens" reflect the
rationale for choosing these tokens:

- Continuation tokens are tokens that we can reasonably imagine a
  programmer wanting to place after a type argument selector to
  *continue* the expression.  For example, `if (List<int> == T) ...`
  is allowed.

- Stop tokens are tokens that can't possibly follow a `>` that is a
  relational operator, because they *stop* the expression that's in
  progress.  For example, `var x = List<int>;` is allowed.

If a user wants to follow a <typeArguments> selector with a token
other than the ones above, they'll have to parenthesize the
expression.  So for example, if they want to do `List<int> + 1` (which
could be meaningful if an extension method defined `operator +` for
the type `Type`), they will have to use parentheses, and instead write
`(List<int>) + 1`.

Bug: https://github.com/dart-lang/language/issues/1806
Change-Id: I2816cdac24e55eac3cb3e9920e276404c1228d46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210941
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-08-27 14:56:16 +00:00
Paul Berry e1f0d03ec5 Flow analysis: rework analyzer/CFE handling of initialized variables.
Previously, the analyzer and CFE were responsible for two pieces of
logic that arguably should be in the shared flow analysis engine:

- Deciding whether or not it's necessary to tell flow analysis about
  initializer expressions.

- Deciding whether or not to promote the variable at the time of
  initialization (we do this when the variable is implicitly typed,
  and the initializer is a promoted type variable type).

It's better to just always tell flow analysis about the initializer
expression and let it decide what to do about it.

This paves the way for fixing
https://github.com/dart-lang/language/issues/1785 (which results from
initializer expressions sometimes being ignored when they shouldn't
be), by consolidating the broken logic into the flow_analysis library,
where it will be easy to unit test the fix.

Bug: https://github.com/dart-lang/language/issues/1785
Change-Id: Iec832e92995eb4f8d0c1fbd4e9be6c897e0917b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211180
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-08-27 14:53:06 +00:00
Johnni Winther ce4e7705f2 [cfe] Handle explicit instantiation in implicit creation syntax
Closes #46719
Closes #46887

Change-Id: I4ad0f1bb4ab847a44f749113c6446f62a474143c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211260
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-26 11:59:48 +00:00
Jens Johansen 72de10d938 [parser] Better error message for >>> when not enabled in some cases
https://github.com/dart-lang/sdk/issues/46886

Change-Id: Ib204d0c9a7116aaff0f0079be51d551c3f89316d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211003
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-08-26 10:58:20 +00:00
Paul Berry d2b313227d Flow analysis: Pin down initialization behaviors before fixing #1785.
https://github.com/dart-lang/language/issues/1785 has a wide enough
impact that its fix will have to be bundled in with a language version
(i.e. future versions of Dart will have to reproduce the old buggy
behavior for code that's not opted in to the latest language version).
Therefore, we'll have to maintain tests of the behavior both before
and after the fix.  This CL is the first step in that process, adding
tests that validate the current (buggy) behavior.

Bug: https://github.com/dart-lang/language/issues/1785
Change-Id: I78f17999ac1cbc096a312ef977db24654e06a263
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210400
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-08-25 20:32:02 +00:00
Johnni Winther 2a5c85e7cf [parser] Add useImplicitCreationExpression
This flag prepares for the removal of the special case of implicit
creation syntax, `foo<bar>.baz()`, which with constructor-tearoffs
doesn't have to be a creation expression. Since both the analyzer
and the CFE needs to support parsering without special casing
before it can be removed, the flag is added to ensure both
implementations will agree on what the future parser behavior will be.

The CL hard-wires the CFE use of the parser to a single constant value.

Change-Id: I04724f039d2e698f3cf67e8b0b56dfa7e96ed3b4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211000
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2021-08-25 11:44:53 +00:00
Johnni Winther b3af778a38 [cfe] Add UnresolvedKind for fine grained unresolved reporting
- including tests for issues 46719 and 46887

Change-Id: I601fcfcb956e059f502cbece29fb2a6a00f68846
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210464
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-08-25 09:51:54 +00:00
Paul Berry 389740cff9 Flow analysis: Add ID test cases for #46937.
Bug: https://github.com/dart-lang/sdk/issues/46937
Change-Id: Ic1073a4514ab59468881b6b641bf179187103140
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211041
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-08-24 21:00:04 +00:00
Johnni Winther ae4543fcb9 [cfe] Report all compile-time errors found during constant evaluation
Closes #46925

Change-Id: I81e97cae05c39c24b24dae82a222f857d4730ac7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210465
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-24 11:42:53 +00:00
Jens Johansen 7399e4e631 [parser] Recover differently when formal parameter name is keyword
Fixes https://github.com/dart-lang/sdk/issues/46736

Change-Id: Ia8ee921e14ac80934f9d0ec14e0140b23cc7d3bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210725
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-08-23 15:14:47 +00:00
Dmitry Stefantsov d3c3e92740 [cfe] Add error on misplaced type arguments in constructor tear-offs
Closes #46890.

Bug: https://github.com/dart-lang/sdk/issues/46890
Change-Id: Idf0c4e5ef6380541aaccba9f74755572b2fa9549
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210460
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-08-23 14:36:47 +00:00
Jens Johansen 5e00baa329 [parser] Format files and add /* name = */ comments
Change-Id: I701c3b0cc0c4d4210a8d81efe2d3683cec4f7f88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210721
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-08-23 07:27:47 +00:00
Jens Johansen 7bf731a547 [parser] Special-casing of '}' (like eof) wrt. looksLikeName
Change-Id: I55fb4c10931831630f9c1621addef7fbe9d5a9d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205797
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-08-19 06:41:58 +00:00
Konstantin Shcheglov 8b1fefaf85 Prepare to publish analyzer 2.1.0 and _fe_analyzer_shared 24.0.0
Change-Id: Icadf3810221e4b4f0b3b0930abbf98b34218beba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210520
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-19 03:44:27 +00:00
Alexander Thomas d2bd43f43e [python3] Migrate PRESUBMIT.py files
* Force depot_tools to use python3 results (USE_PYTHON3=True).
* Fixes the dart format presubmit check.
* Remove broken DOM tools presubmit check.

TEST=Manually provoked errors and ran git cl presubmit -v -f.

Cq-Include-Trybots: luci.dart.try.shared:presubmit-try
Change-Id: I8ba46e2ae1640f1b2f82e18bc8024e0aa4838b2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210123
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2021-08-16 08:29:54 +00:00
Paul Berry 8dc6c5ecb0 Allow is or as to follow type arguments in constructor tearoff disambiguation.
Fixes #46888.

Bug: https://github.com/dart-lang/sdk/issues/46888
Change-Id: I780a53a2d5a45a8630935c9be5c886d96ef1a2ef
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209881
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-08-13 15:41:31 +00:00