Commit graph

7221 commits

Author SHA1 Message Date
Chloe Stefantsova a46de1c30c [cfe] Add implicit null-check on throw
Throwing `null` is not supported in sound null safety. This change
inserts an implicit `as Object` cast that result in a TypeError, rather
than a NullThrownError, in sound mode.

Closes https://github.com/dart-lang/sdk/issues/49198

TEST=Covered by the existing tests

Change-Id: I041baf95becd2df1b940fdff7cde398a4e391ee7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/247546
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-12-12 00:48:13 +00:00
Paul Berry 966aed6bd1 Shared pattern analysis: add support for pattern variable assignment.
Bug: https://github.com/dart-lang/sdk/issues/50585
Change-Id: I1939c6fd8fac205abeac5b0a9b3da9b3b4adca01
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274604
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-09 17:16:38 +00:00
Michael Thomsen 9f2a622d79 [3.0 alpha] Update CFE messages for Dart 3 sound null safety by-default
Fixes https://github.com/dart-lang/sdk/issues/50638

Change-Id: I511c5337099ae9576377ac8a82ef1bb78f6d34b1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273844
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Michael Thomsen <mit@google.com>
2022-12-09 16:55:03 +00:00
Johnni Winther 6b73869b96 [cfe] Initial support for view constructors
Change-Id: I646c8e00cb819b5759f5df2b602f49a570d7f959
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274220
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-09 15:21:47 +00:00
Johnni Winther 64fd5139e2 [3.0 alpha] Remove error for use of the List default constructor
Contributes to https://github.com/dart-lang/sdk/issues/49529

Change-Id: I65d147aa8f5f692df00663f5fac024351da7aaa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272161
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-12-09 13:13:14 +00:00
Daco Harkes 56e581aa34 [3.0 alpha] Move AbstractClassInstantiationError to dart:mirrors
Split off https://dart-review.googlesource.com/c/sdk/+/259041 so that
the VM changes can be landed separately.

TEST=tests/lib/mirrors/instantiate_abstract_class_test.dart

Bug: https://github.com/dart-lang/sdk/issues/49529
Change-Id: Ic06dee0dfeaea64d9d9ffd9511ec66d9d0837e7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274383
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-09 12:53:28 +00:00
Kallen Tu b58f1b4ef3 [analyzer] Report error when mixing in a sealed mixin outside of its library.
Change-Id: I62be6c21bc2bf2a5af35203137aa75c7fd1ba934
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274142
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-08 21:18:24 +00:00
Paul Berry 38cab10852 Patterns parsing: track when variable patterns are in an assignment context.
Variable patterns behave so differently inside a patternAssignment
that we may want to represent them using different AST nodes inside
the analyzer/CFE.  This change adds a boolean flag allowing the
implementation to know what kind of variable pattern it's looking at
when parsing occurs.

Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I60adf2865bbe24f85b72a79b1360833bf823bd67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273829
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-12-07 22:45:40 +00:00
Kallen Tu 7ff20a67ca [analyzer] Report error when subtyping a sealed class outside of its library.
Change-Id: Iee6c9120d096ed49592ca3d155c81c876ceb5c34
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273832
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-07 22:00:28 +00:00
asiva 606a64a743 [3.0 alpha][VM/Runtime] - Flip flag to make strong null safety the default.
- Flip flag to make strong null safety the default
- Remove code that auto detects null safety mode from source files,
  it is necessary to specify --no-strong-null-safety to opt out.
- Retains sniffing of AOT/JIT snapshots and kernel files to determine
  null safety mode, the opt out has to be done when generating these
  file.

TEST=ci

Change-Id: If2c9608eedb7c46d9c3cd85e261ee9640e0d28eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261140
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2022-12-06 04:04:23 +00:00
Alexander Thomas 7e0d92d69d [3.0 alpha] Bump version to 3.0.0
Tested: Standard CQ.
Bug: https://github.com/dart-lang/sdk/issues/49529
Change-Id: I329b9940db7309c7e48f17eecd7a66d5b853a484
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271922
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-12-06 02:40:36 +00:00
Anna Gringauze 3bb1323b92 Reland "Cache expression compilers in incremental DDC mode"
- Fix ddc null dereference while generating symbols with mixins
- Fix incremental compiler failure on non-SCC components
- Reworked expression compiler worker tests for effiiciency
- Create module configuration in tests only once
- Add test case of compiling expression in an non-SCC module
- Add test case of compiling expression in an SCC module

This is a reland of commit e6f779bcdd

Original change's description:
> Cache expression compilers in incremental DDC mode
>
> - cache expression compilers in expression compiler worker
>   to improve performance of exression compilation.
> - pass module format in expression compiler worker
>   (the ddc format tests were not running!)
> - fix an issue where the same library was imported twice
>   in module_builder.dart
> - add verbose mode timeline logging to ProgramCompiler.
> - update tests.
>
> Closes: https://github.com/dart-lang/sdk/issues/49944
> Change-Id: Ie7408dcd42e757b1eb5e7f5ccbc1b078b6417011
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268361
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Mark Zhou <markzipan@google.com>
> Commit-Queue: Anna Gringauze <annagrin@google.com>
> Reviewed-by: Nicholas Shahan <nshahan@google.com>

Change-Id: I80546773d957f37ec5b2353ea060b50f3fba0aa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271801
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2022-12-05 18:39:17 +00:00
Paul Berry c02a050721 Add handleMergedStatementCase.isTerminating boolean.
This can be used by the front end to detect when to add synthetic
break statements to switches involving patterns.

Bug: https://github.com/dart-lang/sdk/issues/50624
Change-Id: I783b0920b8dc6ccbc7af8062fba7bfdeaa9dd9cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273800
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-05 17:10:50 +00:00
Paul Berry 7a3aa5c7f5 CFE parser test cases for metadata in for-in loops with patterns.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I336b391c9102e4e6dd3eabce1051763e3bc797d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273621
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-05 14:56:41 +00:00
Johnni Winther a392d30e1d [cfe] Handle direct access to instance methods and getters in views
Change-Id: I63fbdf31b225ea503f35b85601b8f9718431d6cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273380
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-05 10:13:22 +00:00
Paul Berry eb827958a4 Remove support for & and | in patterns.
Logical-and and logical-or patterns must now use `&&` and `||`,
respectively.

Change-Id: I87774016da46a21c90a50581e7ed843160159c80
Bug: https://github.com/dart-lang/language/issues/2501
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272743
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-02 23:53:40 +00:00
Kallen Tu 6c9873bf42 [cfe] Report error when using a class as a mixin when sealed-class is enabled.
From the changes in dart-lang/language#2674 that specify from a certain language version, we would like classes to not be used as mixins unless specified as a 'mixin class'.

Currently, this behaviour is under the sealed-class flag. May be subject to change as the other modifiers are added, but I'd at least like to make sure this works for sealed classes.

Change-Id: I5754b383327dde06d49175fe2d05c8ba7462145f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273082
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-12-02 22:31:58 +00:00
Paul Berry e9a1248fc2 Add parser support for patterns in for-in statements and collection elements.
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I9eda03c1501cf3164cfb09cf9084576a5d1141cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273122
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-02 15:22:38 +00:00
Jens Johansen ff87b5ea8e [CFE] Replace 'first' with 'roots'
Before we could get into a situation where we didn't produce the entire
class hierarchy when we loaded from dill even though we set up the
entry points correctly.
This might not be perfect, but seems better.

Change-Id: Ifc56930da7ccad52e96ae32d6a8ab509421b37b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273381
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2022-12-02 15:18:27 +00:00
Paul Berry c381425bd3 Parser: additional fixes to mayParseFunctionExpressions for patterns.
Expressions can also occur in patterns, either after an equality or
relational operator (e.g. `== e`), or after `const` (though what's
allowed after `const` is heavily restricted).  We need to make sure
that the expression parser doesn't greedily treat `=>` as introducing
a function expression when parsing these constructs inside a switch
expression.

But it's ok to allow function expressions inside list patterns, map
patterns, parenthesized patterns, and in the argument part of object
patterns.  (These will be rejected by a later stage of analysis
because expressions inside of patterns must be const, and a function
expression can't be const.  But the parser should still accept them so
that we can give useful error messages).

Fixes #50591.

Bug: https://github.com/dart-lang/sdk/issues/50591
Change-Id: I828555782f5bc8cb8aae8a3948849b7a75bdec57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273286
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-02 15:04:09 +00:00
Paul Berry 882941caf4 _fe_analyzer_shared: add support for rest patterns with subpatterns in maps.
The parser now handles maps that contain rest patterns with
subpatterns (e.g. `{'foo': _, ...var rest}`).  Even though this is
invalid Dart, it still makes sense for the parser to handle it so that
we can generate higher quality error messages.

The shared type analyzer now generates an error,
`restPatternWithSubPatternInMap`, if it encounters this error
condition.

Change-Id: I7f447bde28e646593aa432e3e5ad1f5e415bdd30
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273283
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-12-02 13:50:38 +00:00
Johnni Winther 999c9b5e19 [cfe] Add (rudimentary) subtype implementation for ViewType
Change-Id: I7b102de842a828bb2c49b347d045d5919a4a5ae5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273241
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-02 11:17:34 +00:00
Johnni Winther 8bda08227d [cfe] Handle access to 'this' and parameters in view instance methods
Change-Id: I033ba603cb9f289e3ab4b39977b68e0c4641c61b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273182
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-02 08:40:26 +00:00
Paul Berry 599911d197 Add parser support for for (var pattern = expression; ...; ...)
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I5f07b848ba06be403e56538a4cc64f6de51bd668
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273005
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-01 21:49:47 +00:00
Paul Berry 9221f34648 Update analyzer and CFE unit tests to use && and || in patterns.
In a follow-up CL I'll remove support for logical-and and logical-or
patterns using `&` and `|`.

Bug: https://github.com/dart-lang/language/issues/2501
Change-Id: I2627cd9999ac703dd0ab63cd6be3d0d883860674
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272920
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-12-01 19:41:43 +00:00
Paul Berry b0c705e4bd Set mayParseFunctionExpressions properly during switch expression parsing.
We need to prohibit function expressions during guard clauses in
switch expressions, otherwise the `=>` might be misinterpreted.

Fixes #50591.

Bug: https://github.com/dart-lang/sdk/issues/50591, https://github.com/dart-lang/language/issues/2672
Change-Id: Ie5703ac7049557798b19778281429e8a591cf09f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273020
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-12-01 18:57:33 +00:00
Johnni Winther 05c0f5ca9a [cfe] Add synthesized this to view instance methods
+ generate getters.

Change-Id: Id873e8e6c3f8d64a845b211f18616d807302f180
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273180
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-01 11:53:17 +00:00
Johnni Winther 5994c04ef4 [cfe] Initial support for view methods
TEST=pkg/front_end/testcases/views/procedures.dart

Change-Id: I62c26183d8160a3841b74381a256d0a4b5bb9365
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272624
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-01 09:54:40 +00:00
Johnni Winther b7aa26710a [cfe] Remove the need for transform/visitChildren on internal nodes
These were previously only needed to support calling 'replaceWith' on
TypeAliasedConstructorInvocation, TypeAliasedFactoryInvocation and
FactoryConstructorInvocation. Instead of calling 'replaceWith' on the
nodes themselves, we call 'replaceChild' on the parent, if present.

The 'replaceChild' method on the internal node is overridden to be a
no-op. Since all these internal nodes are not supported in the
external AST and therefore must be replaced during inference, these
can only be found in subtrees that have been removed, typically in
erroneous code, and it is therefore safe to make the replacement a
no-op.

Change-Id: I597d955075dfae51b04bce08b1d499c90dd4d673
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272621
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-12-01 08:09:08 +00:00
Kallen Tu 1c0cb35a87 [cfe] Allow mixin 'on' behaviour for sealed supertypes.
Implements the behaviour discussed in dart-lang/language#2600. All other mixin application or implementing behaviour for sealed families should be unaffected.

Change-Id: I95577d8b2bc69e6c1a365ec43fb156f5d5d9a259
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272461
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-12-01 01:18:40 +00:00
Paul Berry 43c68f90ed Add parser support for && and || in patterns.
Previously, the implementation used `&` and `|` for logical-and and
logical-or patterns.  That is being changed to `&&` and `||`.

As a first step, we add support for `&&` and `||`, without removing
support for `&` and `|`.  In a follow-up CL I'll update existing
tests, and then after a day or two I'll remove support for `&` and
`|`.  This should avoid conflicts with other patterns work that's in
progress.

Bug: https://github.com/dart-lang/language/issues/2501
Change-Id: I2d5dc158248160d84e9f0889f5de390b999cbc7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272861
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-11-30 23:16:45 +00:00
Johnni Winther be7779ae7f [cfe] Handle switch expression in BodyBuilder
Change-Id: Idf987e8bb59a11d1628fc866d677267f439ed5cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272300
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-11-30 16:21:28 +00:00
Paul Berry 701a0d289f Add support for expression statements beginning with a map pattern.
Bug: https://github.com/dart-lang/sdk/issues/50035, https://github.com/dart-lang/language/issues/2662
Change-Id: Ifb141cf563848fc0035423a625e27585cce2ea57
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272523
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-11-30 15:18:43 +00:00
Johnni Winther a9823cdb8a [cfe] Handle views in NameScheme
Change-Id: I529e47ebfda8d1c89f80c02706b5bdf4bcfed00d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272661
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-11-30 13:14:48 +00:00
Johnni Winther 4758d03a4c [cfe] Remove InternalExpressionKind
This enum is no longer used.

Change-Id: I13af962bb95b0359fc979cb8c5e56753a7841563
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272780
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-11-30 10:29:37 +00:00
Paul Berry 9d0bca98e9 Rework computation of precedence for patterns.
Previously, we boosted the precedence of `as` inside patterns, to make
it higher than `|` and `&`.  Now, we reduce the precedence of `|` and
`&` to match that of `||` and `&&`.

The new approach should make it easier to transition to using `||` and
`&&` in patterns.

Bug: https://github.com/dart-lang/language/issues/2501
Change-Id: I6658484860ef809bc9029fa75747fdd7ce986836
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272700
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-11-30 05:12:47 +00:00
Paul Berry 7b41b6215b Add parser support for patternAssignment.
Bug: https://github.com/dart-lang/sdk/issues/50035, https://github.com/dart-lang/sdk/issues/50502, https://github.com/dart-lang/sdk/issues/50575
Change-Id: Idd3bdcae7cbb95c6f2016bb5d3efc638867f52af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272383
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-29 20:16:29 +00:00
Srujan Gaddam ed0ac1936a Reland "[pkg:js] Disallow using @staticInterop synthetic constructors"
This reverts commit aa252e907e.

Reason for revert: Flutter engine is migrated to not use synthetic constructors.

Original change's description:
> Revert "[pkg:js] Disallow using @staticInterop synthetic constructors"
>
> This reverts commit aab6ab8b84.
>
> Reason for revert: Broke Flutter roll https://github.com/flutter/engine/pull/37838
>
> Original change's description:
> > [pkg:js] Disallow using @staticInterop synthetic constructors
> >
> > Change-Id: I5c74369ee8ae97fcc21032464fcb8fea987022d9
> > Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268107
> > Reviewed-by: Joshua Litt <joshualitt@google.com>
> > Reviewed-by: Riley Porter <rileyporter@google.com>
> > Reviewed-by: Sigmund Cherem <sigmund@google.com>
>
> TBR=sigmund@google.com,joshualitt@google.com,rileyporter@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com,srujzs@google.com
>
> Change-Id: I6caf4b776191e8eed9877c43f900ae6300f1f5c2
> No-Presubmit: true
> No-Tree-Checks: true
> No-Try: true
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271440
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Commit-Queue: Srujan Gaddam <srujzs@google.com>
> Reviewed-by: Srujan Gaddam <srujzs@google.com>

# Not skipping CQ checks because this is a reland.

Change-Id: Iaa538bb5f309a46c320bf1781c3d1a7148ec7be7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271500
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-11-28 23:41:02 +00:00
Paul Berry 2a9491b613 Rename looksLikePatternVariableDeclaration.
The new name, `looksLikeOuterPatternEquals`, is a more precise
description of what it does.

This helps prepare for adding parser support for pattern assignments,
which require the same functionality.

Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: Ibfcc4c37faac1770c98a427facdffda5c40e6d08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272344
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-28 21:33:41 +00:00
Kallen Tu f12fa86c45 [cfe] Make named mixin applications non-constructable and abstract if sealed.
Special syntax for mixin applications should be also abstract if we add the sealed modifier.

Change-Id: I3af3e997734f4bc762dc29bfc3f61f2e691ca41b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271840
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-11-28 19:44:58 +00:00
Paul Berry a3befd399a Add support for ... inside map patterns
Bug: https://github.com/dart-lang/sdk/issues/50035
Change-Id: I350eb526e67e4cc42c94b4776e5d38315932ddc5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272382
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-28 18:34:58 +00:00
Paul Berry f22c4580e4 Fix patterns parsing when EOF encountered during potential pattern variable declaration.
Fixes #50563.

Bug: https://github.com/dart-lang/sdk/issues/50563
Change-Id: Icc1e38c0775bd1fab7ed717f24932dea47dd2990
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272342
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-11-28 16:36:08 +00:00
Johnni Winther 076c85682d [cfe] Update patterns expectations
Change-Id: I08de1fff9096b64d1e838c975a1659f4a960fc9f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272181
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2022-11-25 14:55:36 +00:00
Johnni Winther f85185aaa0 [cfe] Handle patterns in switch cases in BodyBuilder
Change-Id: Ib52a0cd077e1cd056cd5150b8b1fddf867aef3ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271706
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-11-25 12:33:40 +00:00
Chloe Stefantsova 8b12c0c6fb [cfe] Desugar BinaryPattern
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: I98dd7d63c560eb4c48350c32826e51df1491d9d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271708
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-11-24 17:45:05 +00:00
Johnni Winther c251133418 [cfe] Handle record constant equality
Closes #50514
Closes #50515

Change-Id: I942867b3a1fc331428108f63e2b97b8b008c1d55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271921
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-11-24 16:38:53 +00:00
Chloe Stefantsova 1a8b1370a0 [cfe] Don't emit throw of AbstractClassInstantiationError
Change-Id: I4e464bdf1decf8484cd042e973e916b5aa3b8d1c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271960
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-11-24 16:35:51 +00:00
Chloe Stefantsova 88a23c1c57 [cfe] Desugar RecordPattern
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: Ibe09a7de3a664323afd18e27fc8902fb6c3f4842
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271361
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-11-24 14:56:56 +00:00
Johnni Winther bf3e520203 [cfe] Add test for issue 50182
Change-Id: I6b596e46f929c95cf79bdd784a99e0fcc591852d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271707
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-11-24 14:19:58 +00:00
Chloe Stefantsova 563ef79195 [cfe] Desugar MapPattern
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: Ic2b555a4384187b358e001ea29755ca14588decd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271366
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-11-24 13:00:09 +00:00