Commit Graph

28 Commits

Author SHA1 Message Date
Johnni Winther 938d9c0dc8 [cfe] Create synthesized super classes late
This moves the creation of class builders for anonymous mixin application to after the creation of the normal class builders.

A ClassDeclaration interface is added to support class builders from different fragments. This is also a step towards creating class builders fully through fragments.

TEST=existing

Change-Id: Ia6b4a17648bdc89b89fd3cfdfe39d24d347b6341
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/407420
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2025-02-04 07:08:41 -08:00
Johnni Winther 81b669dc45 [cfe] Create enum elements through SourcePropertyBuilder
TEST=existing

Change-Id: I94ffff0ca5d891b43e0bc7b64d78eb0c03e3dd12
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/404103
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2025-01-16 01:17:42 -08:00
Johnni Winther 30e4861d9b [cfe] Run weak suite only on dart2js
Change-Id: I96aa868dd9ac5cf8c7c5592607c0d87e3f2d9bc7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366620
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-05-15 11:33:06 +00:00
Johnni Winther 4bf22f41f3 [cfe] Use sound null safety for outline and modular suites
Change-Id: Ideee9917b2e5b819672c7e441d051f9bc57c86c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366342
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-05-15 08:27:25 +00:00
Jens Johansen 01a27372e2 [CFE] Textual outline suite doesn't remove empty lines before formatting
Change-Id: I8b7d9fdb5e2562914b66ccd748a8f417895658a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/344705
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-01-08 13:11:52 +00:00
Johnni Winther 54b588a373 [cfe] Mark implicit enum constructors as synthetic
Closes #53615

TEST=existing

Change-Id: Ic2ad21787e62c8051dc2020cc15d61195f512b80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330440
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-10-13 15:28:46 +00:00
Johnni Winther 1683fd5c16 [_fe_analyzer_shared] Ensure beginToken on class, enum, mixin, extension and extension type
This passes the first token of these top level declaration directly
to the endX listener method.

In the CFE this is used to ensure that can handle the new modifiers in
the textual outline. Furthermore, support for extension types is added
and having an "unknown chunk" now results in an error. The latter should
help us keep the textual outline up-to-date wrt new features.

Change-Id: I813d6162b6cba0a2bf550ed33a6091abf9bf49f8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324702
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-09-15 13:01:10 +00:00
Johnni Winther 952b7232c3 [cfe] Enable inline-class feature by default in testing
Change-Id: I4e0c22e0cb2f568dd2792a8f5a60c60605628d08
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/324440
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-09-06 12:33:44 +00:00
Kallen Tu 0b03e711bf [cfe] Change error message for mixin subtype restriction.
Make better error message for mixins since they can't be final nor
sealed.

Bug: https://github.com/dart-lang/sdk/issues/52697
Change-Id: I56a9cb66131c0a47ea1c91b95dcf70d12835134e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308964
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-06-14 14:28:48 +00:00
Johnni Winther 36641368bb [cfe] Treat NonNullableByDefault as default in ast-to-text
This changes ast-to-text to mark legacy libraries instead of
non-nullable-by-default libraries.

TEST=existing

Change-Id: Ib01147e4ef48c2c5b2ffc6b23547998344dfdf2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307121
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-06-08 06:28:50 +00:00
Kallen Tu f7bc72fce6 [analyzer/cfe] Remove interface mixin, final mixin and sealed mixin.
Added error messages for when users try to use invalid mixins + a language test that tests that (and tests in each of the front ends).

Removed the tokens from the parser listeners.

Removed all behaviours and error reporting related to these invalid mixins.

Change-Id: I558595826dae7e2c176bd1929e97caa2335c167c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290614
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-30 11:56:08 +00:00
Kallen Tu f76f84c850 [cfe] Report error when sealed or final used in on type outside of library.
Then when using a final class in an on clause outside of its library, we don't produce a base/final subtype error.

Change-Id: Ib96efefb04639496daeee0de98c5711e73709ac5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291591
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-03-29 12:09:23 +00:00
Kallen Tu 6779635eb0 [cfe] Only report base/final subtype errors on the nearest problematic subtype.
To match up with analyzer behaviour, we want to only report subtype errors
on the first erroneous subtype instead of every subtype down the tree.

Change-Id: Ifb93ef39498e93d075a475fff8939017b563414e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291344
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-28 19:07:57 +00:00
Kallen Tu 0936bceaa0 [cfe] Remove tests that use interface mixins, final mixins and sealed mixins.
Remove/change some frontend tests to make for easier removal of these invalid
mixins in https://dart-review.googlesource.com/c/sdk/+/290614.

Change-Id: I50325b8275704eb2542c5871bb6326356bd9b020
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291053
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-03-27 18:56:46 +00:00
Robert Nystrom 5d858f01de Roll dart_style into the SDK.
This has two changes:

- Hide "--fix" in the help. The command is still fully supported, we
  just don't show it because we want to gradually migrate users to
  "dart fix".

- Remove support for the "interface", "final", and "sealed" modifiers
  on mixin declarations, since the proposal no longer supports those
  (and we need to remove them from the analyzer AST API).

There are no meaningful style changes, so there's no need to update the
pre-build SDK for this change.

Change-Id: I2357970e298a9be8f6f26efb5b922d40ee4fbb7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290020
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
2023-03-21 19:05:06 +00:00
Kallen Tu 26311db0b5 [cfe] Avoid reporting subtype modifier errors on final supertypes outside of library.
Change-Id: Ib923df6e9fcfb48e3c16a3edd4e308547cdb4348
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/288607
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-16 19:01:17 +00:00
Robert Nystrom c33ece3515 Roll dart_style into the SDK.
This contains support for all of the 3.0 language features. It also
contains a couple of very minor style changes. Unlike the previous
reverted roll (https://dart-review.googlesource.com/c/sdk/+/285460),
this does *not* contain the style change to support compact switch
statements. This should eliminate most of the style churn.

Change-Id: I95dd73a3a921b4a0cd278a7abb86daf8eea21397
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286701
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2023-03-03 18:53:20 +00:00
Kallen Tu b1e3d73304 [cfe] Fix textual outlines for class modifiers and subtyping base/final.
Forward fix test outcomes instead of the revert here: https://dart-review.googlesource.com/c/sdk/+/286460

Change-Id: Ie940cf8baa2e2abb6eab212329a58e24a1e85138
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286521
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-03-02 17:47:49 +00:00
Oleh Prypin 88ac4a27a1 Revert "Roll the latest dart_style into the SDK."
This reverts commit bbba3c9788.

Reason for revert: latest dart_style has a few bugs and overall the changes should be discussed more

Original change's description:
> Roll the latest dart_style into the SDK.
>
> This includes support for records, patterns, sealed classes, and class
> modifiers. It also includes a fairly small number of style changes. The
> one that will be most noticeable is more compact switch statements.
>
> Change-Id: I9e89ba82d52bfa451fc54f9dd59048d72db48377
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285460
> Reviewed-by: Alexander Thomas <athom@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Bob Nystrom <rnystrom@google.com>
> Auto-Submit: Bob Nystrom <rnystrom@google.com>

Change-Id: I12fad53bdc75dda349b9362aeb84e798983bfa25
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286420
Reviewed-by: Alexander Thomas <athom@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Oleh Prypin <oprypin@google.com>
Commit-Queue: Oleh Prypin <oprypin@google.com>
2023-03-02 13:16:36 +00:00
Kallen Tu 22de5b34f2 [cfe] Report an error when a subtype of a base or final type is not base, final or sealed.
Change-Id: I54c9e3edcc0ae7e61f48ff7e3b42d83e0556af7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286101
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-03-01 19:10:56 +00:00
Robert Nystrom bbba3c9788 Roll the latest dart_style into the SDK.
This includes support for records, patterns, sealed classes, and class
modifiers. It also includes a fairly small number of style changes. The
one that will be most noticeable is more compact switch statements.

Change-Id: I9e89ba82d52bfa451fc54f9dd59048d72db48377
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285460
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2023-03-01 16:08:40 +00:00
Kallen Tu dbd6401865 [cfe] Anonymous mixins -- propagate class modifiers and fix with base on clause
Implements the proposed spec for dart-lang/language#2830 and along the way, fixes another change with anonymous mixins erroring in on-clauses.

Change-Id: I15ed7370f9099d9de89d80f5844db76f58fbd216
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284481
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-02-22 22:44:26 +00:00
Konstantin Shcheglov 67e7c96962 Fix parser to use correct begin token, to get documentation comments from it.
Change-Id: I9505353c9c6c00082e588aced34e8151c7ab22b7
Bug: https://github.com/dart-lang/sdk/issues/51447
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284441
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-02-22 17:03:38 +00:00
Kallen Tu b7d0a982b6 [cfe] Report errors for final class and mixin subtyping outside of its library.
Change-Id: I958fd30e2ed37ae3ca4311967575c8176ca2cd48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/280249
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-02-03 01:17:41 +00:00
Kallen Tu 1cdd496a51 [cfe] Add class modifiers to AST and dill files.
TEST=pkg/front_end/testcases/class_modifiers/...

Change-Id: I8befd64c359eb33a6acf003525b0c8cc6096df3d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279331
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-01-19 22:55:20 +00:00
Kallen Tu ca974e5c4f [analyzer/cfe] Reland: Parse final class modifier.
Reland same files as https://dart-review.googlesource.com/c/sdk/+/278090
The only major change is parser_impl.dart parsing changes for 'final'

This change should allow 'final' for classes and mixins and maintain prior final behaviour for other constructs such as enums, typedefs, or the breaking line which was 'final library = ...;'

Change-Id: I3d84fc47479f39df6d5b0dcbe8f92d1fb78a826a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279076
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-01-19 16:08:28 +00:00
Kallen Tu ed1157acc4 Revert "[analyzer/cfe] Parse final class modifier."
This reverts commit 2f1372b460.

Reason for revert: Breaks the build. Unsure if there are other affected failures.

Original change's description:
> [analyzer/cfe] Parse final class modifier.
>
> Change-Id: Ia554c4f8f9617cc883a472eeb819aab2fd849077
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278090
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Commit-Queue: Kallen Tu <kallentu@google.com>

TBR=scheglov@google.com,johnniwinther@google.com,kallentu@google.com,dart-scoped@luci-project-accounts.iam.gserviceaccount.com

Change-Id: I5dd74202bd46d69b7261d6d30d8cf3b1a40dbc99
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/279040
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-01-13 21:04:01 +00:00
Kallen Tu 2f1372b460 [analyzer/cfe] Parse final class modifier.
Change-Id: Ia554c4f8f9617cc883a472eeb819aab2fd849077
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/278090
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-01-13 19:16:20 +00:00