Commit Graph

75 Commits

Author SHA1 Message Date
Johnni Winther a3953f12c7 [cfe] Include Procedure.isSynthetic in ast-to-text
In preparation for fixing #60490

TEST=existing

Change-Id: Iad3448a30de91e62f0d60bbaa9c425bc4706c799
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421100
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-04-10 00:59:49 -07:00
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
Alexander Markov 048df9d706 [vm] Fix tree-shaking of mixin applications when mixin has a member with entry point pragma
Cloned static members of mixins are not used (dead code) and usually
tree shaken in AOT mode. However, if static member is annotated with
@pragma('vm:entry-point'), its clone in the mixin application is
also retained. If such mixin application is not used, tree shaker
drops its supertypes which removes the link from mixin application to
the original mixin. As a result, gen_snapshot crashes when trying
to access original mixin in order to print qualified name of the member.

The first part of the fix is to avoid cloning static members into
mixin applications, which would allow tree shaker to remove unused
mixin applications entirely. This change also reduces size of
the non-AOT kernel binaries.

However, instance members of mixins are cloned
and they could be annotated with entry point pragmas too.

The second part of the fix is to clear isEliminatedMixin flag
in tree shaker when dropping supertypes.

TEST=pkg/front_end/testcases/general/mixin_with_static_member.dart
TEST=pkg/vm/testcases/transformations/type_flow/transformer/regress_flutter160030.dart

Fixes https://github.com/flutter/flutter/issues/160030

Change-Id: I1b36c4a7f64a4530c8b4799ec785f1077ce65de6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/403963
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2025-01-13 07:30:16 -08:00
Chloe Stefantsova d0a2219084 [cfe] Enable 'getter-setter-error' flag in CFE unit tests
Change-Id: I7f7201a26e1ce1b9ba7afab0cb4e56827de76194
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397162
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-11-26 06:29:50 +00:00
Jens Johansen ff7e95dfb5 [CFE] Suite uses same CompilerContext for transform and verify step as used when compiling
Because these steps used a new CompilerContext they didn't have
uriToSources set up correctly and problems issued suffered.

Change-Id: I8d9bed065bc6e9284f6e6921109f927bfc395c48
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/374003
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-07-08 09:15:48 +00:00
Johnni Winther 450ddd82f8 [cfe] Update expectations after change to test suite
Change-Id: Idb88b149576f03a443d8e71f263a443cd32e17d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368562
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2024-05-30 11:25:43 +00:00
Jens Johansen 727796e692 [kernel] Fix uri on some constants
Change-Id: I8b23563df3765bb076c851179bdbb02ad70671bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/368402
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-05-29 14:01:32 +00:00
Johnni Winther a3f83a9e44 [vm] Generate VM platform dill in strong mode
This changes the VM platform dill from agnostic to strong. The
VM no longer supports weak mode, so agnostic is not needed.

TEST=existing

Change-Id: I85defb6aec15262b71b4f1c199e77bd356826332
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/366670
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-05-27 07:52:24 +00: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
Lasse R.H. Nielsen f0aeebd0e7 Make all platforms return null from Error.stackTrace until thrown.
The web platforms used to invent a spurious stack trace when reading
`Error.stackTrace` before the object was thrown.
They now return `null` instead, if there is no underlying JS error object,
matching specified behavior.

Fixed bugs in async error throwing in dart2wasm:
* `throw` in an async function did not set the stack trace on an error.
  Now calls `Error._throw` instead of just a direct Wasm "throw".
* `async*` functions did not capture the stack trace of a throw
  that ended the function body, which means it called
  `StreamController.addError` with only one argument.
  That then resused the stack trace from an `Error` throw instead
  of the correct stack trace.

Added tests.

Change-Id: I1d9fa8d9e18076a7fe28254b60b950866cd550a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/354021
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2024-02-27 23:01:06 +00:00
Johnni Winther c4724e5a89 [cfe] Add Throw.forErrorHandling
This adds a `forErrorHandling` to the `Throw` node. This is used that the `throw` is *not* present in the source code but added to ensure
correctness and/or soundness of the generated code.

This is used for instance in the lowering for handling duplicate writes
to a late final field or for pattern assignments that don't match.

In response to https://github.com/dart-lang/sdk/issues/53519

TEST=updated ast-to-text

Change-Id: Ie103829d98fda9cd7b64e9e3d893e77d1e86d7d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347900
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2024-02-19 12:12:02 +00:00
Johnni Winther e1233c3ccc [cfe] Replace line/column with *
The updates the expectation tests to use * instead of line/column number
for sdk messages.

Change-Id: I882abe6e3b1d88238d87a71d655ca9807869592c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/347901
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2024-01-23 15:34:39 +00:00
Jens Johansen 9abc9fc4d7 [CFE] Strong/weak suites takes error-and-ok-comments into account
A line marked with "// error" should get an error (or it's an error),
and one marked with "// ok" should not get an error (and if it does it's
an error).

Some tests are left unhandled and are programatically ignored in this
first CL. A bug (https://github.com/dart-lang/sdk/issues/54635) has
been filed to sort those out.

Change-Id: I083f62829ceff6ff85121e21cfdb6670bfacb7e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/346301
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-01-18 14:40:08 +00:00
Daco Harkes ac5e3d38c3 [vm/ffi] Introduce SizedNativeType
Both `sizeOf` and `AllocatorAlloc.call` use the new type as bound.
This prevents runtime errors on trying to call these two static
methods with unsized native types. All tests testing for these runtime
errors have been deleted.

The `NativeTypes` implementing `SizedNativeType` are as follows:
* The native integer types, `Float`, and `Double`.
* `AbiSpecificInteger` and it's subtypes.
* `Struct` and `Union` and their subtypes. The

The `NativeTypes` not implementing `SizedNativeType` are as follows:
* `Void` has no size.
* `Opaque` and subtypes have unknown size.
* `Handle` is considered opaque. Cannot be used as field in compounds.
* `Array` does not carry a size in its type. Can be used as fields in
  compounds with an annotation specifying the size.
* `NativeFunction` is considered opaque. Would have variable size.
* `VarArgs` is only a marker in function signatures.

`Struct`s and `Union`s can have only `SizedNativeType`s and `Array`s
as fields. Documentation for these is in flux in another CL, so we
should update it there.

This CL also replaces a bunch of `extends NativeType` with
`implements` clauses and made `NativeType` itself `abstract`.

TEST=Dart SDK build
TEST=ffi test suite

Bug: https://github.com/dart-lang/sdk/issues/54542
CoreLibraryReviewExempt: VM and dart2wasm feature only.
Change-Id: Ib4f6b58f7204bd063ace20133162798d8c9483e8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/345221
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-01-12 10:13:39 +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
Parker Lougheed f49c786443 [cfe/analyzer] Report error on invalid abstract final class modifier combinations
Fixes https://github.com/dart-lang/sdk/issues/54143

Bug: https://github.com/dart-lang/sdk/issues/54143
Change-Id: I5710a8524dfea94b8e42595c8907b1ebf738405c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/342240
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-12-19 08:35:33 +00:00
Lasse R.H. Nielsen 5543293a16 Reland "Expire 3.0.0 experiment flags."
This is a reland of commit 6f29e7fce4

Original change's description:
> Expire 3.0.0 experiment flags.
>
> TEST=Existing tests covers.
> Change-Id: I161eefdc28c74f63ba1ee926800a01eea03d9930
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331960
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

TEST=Existing tests covers.
Change-Id: I384e77744c74774a250be413358a7fa176117167
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332684
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2023-11-17 13:10:01 +00:00
Johnni Winther 446881d53f [cfe] Update ast-to-text
Adds marker for InstanceAccessKind.Object and renames
'inline-class-member' to 'extension-type-member'.

TEST=existing

Change-Id: I087b48445e2794686c2f3db3d56dfbf7045f19fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/334225
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-11-09 10:13:13 +00:00
Alexander Aprelev 6a464c9dee Revert "Expire 3.0.0 experiment flags."
This reverts commit 6f29e7fce4.

Reason for revert: broke g3 bot

Original change's description:
> Expire 3.0.0 experiment flags.
>
> TEST=Existing tests covers.
> Change-Id: I161eefdc28c74f63ba1ee926800a01eea03d9930
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331960
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Alexander Thomas <athom@google.com>

Change-Id: Ied6f612dc922824ffdadc4660898f3b859922ff5
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332582
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Auto-Submit: Alexander Aprelev <aam@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2023-10-27 16:50:09 +00:00
Lasse R.H. Nielsen 6f29e7fce4 Expire 3.0.0 experiment flags.
TEST=Existing tests covers.
Change-Id: I161eefdc28c74f63ba1ee926800a01eea03d9930
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331960
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-10-27 13:57:00 +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 545b7c02f7 [cfe] Support redirecting factories in inline classes
Closes #52525

TEST=inline_class/issue52525

Change-Id: Ia2f6e3aa92ddd053f5736150713d9267b89f401c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/308621
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-06-14 10:31:42 +00:00
Johnni Winther 90d5a99c15 [cfe] Remove redirecting factory field
TEST=existing

Change-Id: Ic9f51693d0cc75cbe745dcaa0f4feb26d7005a9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/307941
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-06-13 09:24:28 +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 e155e4d515 [cfe] Add tests for pre-feature and a post-feature declaration interactions.
Just adding a few tests to make sure there's no regressions.

Bug: https://github.com/dart-lang/sdk/issues/52259
Change-Id: I6aad2d0040736462117a0ce60e3001725923e242
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/302445
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-05-11 17:44:27 +00:00
Kallen Tu ea21df9dbe [cfe] Disallow implementing a legacy library subclass of a final/base class in the core libraries.
This behaviour should only happen when a post-feature library implements
a pre-feature library declaration that has a final/base core library class as a super declaration.

Bug: https://github.com/dart-lang/sdk/issues/52115
Change-Id: If42129ba3ba7e337cc6ffc21604c6d0f2976344c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/301503
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-05-10 14:31:50 +00:00
Johnni Winther 2a82ba0f48 [cfe] Report error on indirect implementation of base class
Closes #52161

Change-Id: I9e2f441036cfeeb904a3e3ec5aeff2e5c45cb8a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/298160
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2023-04-26 08:16:34 +00:00
Kallen Tu 2954986a7e [parser] Add errors for using class modifiers on enums.
Otherwise, in its current state, there's no clear error for any modifiers when used before an enum declaration.
This follows the same format to FINAL_MIXIN_CLASS and those groups of errors.

Bug: https://github.com/dart-lang/sdk/issues/51935
Change-Id: I8174b6894c95fef5c0f4704927b161942c19d3ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294122
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2023-04-13 14:59:57 +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
Daco Harkes 7a90dd0c4f [cfe/ffi] Remove custom FFI checks covered by class modifiers
Tests are in the following files 3.0 and pre-3.0 respectively.
TEST=tests/ffi/vmspecific_static_checks_test.dart
TEST=tests/ffi_2/vmspecific_static_checks_test.dart

Bug: https://github.com/dart-lang/sdk/issues/51683
Change-Id: Ib0b27590748ef788c5475929fde585c790f64e63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291064
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2023-03-27 12:15:22 +00:00
Kallen Tu 2e19faaec9 [cfe] Report an error when implementing a base class through a sealed class.
Bug: https://github.com/dart-lang/sdk/issues/51811
Change-Id: Ifad0519332965d79719173702293b48e94231024
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291040
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-03-24 17:09:09 +00:00
Kallen Tu 0fd1b672c5 [cfe/ffi] Don't ignore modifiers in dart:ffi when used in pre-feature code.
In pre-feature libraries, don't ignore the class modifier errors except for the base/final subtyping error. Otherwise, we can't even extend `base` types in older pre-feature versions.

Bug: #51683

Change-Id: I32ead106fc8d99a0dd72781368c41afefcfd8f53
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289120
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-03-23 17:20:39 +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
Kallen Tu 08c492f119 [cfe] Allowing pre-feature libraries to mix in classes in core libraries.
Also, quickly fixes sealed error along the way.

Change-Id: Id40e86a434d2d3930ae69d9ee2c7ffe6fc4cb0e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287921
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-14 18:28:42 +00:00
Kallen Tu 7bae7294c9 [cfe/flip-modifiers] Remove error for Function completely. Rely on its modifier errors.
Change-Id: I2532f24b360ea0a2f7afb92f3393719a16fa15e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286957
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-03-07 08:13:19 +00:00
Kallen Tu 3b50e0a921 [cfe] Fix bug where we emit an extra error that we don't want for mixin classes.
Would otherwise emit `CantUseClassAsMixin` and then if the supertype is final or interface, would emit `FinalMixinMixedInOutsideOfLibrary` and `InterfaceMixinMixedInOutsideOfLibrary`respectively. These errors together don't make sense so this CL fixes it.

Change-Id: I5fdf4e260b709e08af53cbda0414cff2ef93d3b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286951
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-07 00:58:22 +00:00
Johnni Winther c9e29fa85f [_fe_analyzer_shared] Include errors in analysis result
This propagates information about reported error to the caller of
a shared type analysis. This is used to properly turn errors into
invalid expressions/patterns, as is normally done in the CFE in
face of errors.

Change-Id: Ibb8adedccb8314fabfe18ecaa3559e32ad7267ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286145
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-03-06 22:06:00 +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