This language feature allows type promotion to apply to private final
fields, e.g.:
class C {
final int? _x;
C(this._x);
}
f(C c) {
if (c._x != null) {
print(c._x.abs()); // (1)
}
}
Previously the line marked (1) would have needed to be written
`print(c._x!.abs());`.
Note that to ensure soundness, there are certain restrictions:
- Public fields don't undergo promotion (because a public field might
be overridden by a class in some other library).
- Non-final fields don't undergo promotion (because a non-final field
might be modified as a side effect of code executed between the type
test and the field's usage).
- Fields that are forwarded to `noSuchMethod` in the same library
don't undergo promotion (because there's no guarantee that
`noSuchMethod` will return the same value on every invocation). For
example:
class C {
final int? _x;
C(this._x);
}
class D implements C {
@override
noSuchMethod(...) => ...;
}
f(C c) {
if (c._x != null) {
print(c._x.abs()); // ERROR: `c._x` might dispatch to
// `D.noSuchMethod`, in which case there's
// no guarantee that it will return a
// non-null value the second time it's
// invoked.
}
}
- If two classes define fields or getters of the same name, and
promotion is not permitted for one of them, then it isn't permitted
for the other. This is because there might be a class in some other
library that's a subclass of both classes, causing a reference to
one field or getter to dispatch to the other. For example:
class C {
final int? _x;
C(this._x);
}
class D {
int? get _x => ...;
}
f(C c) {
if (c._x != null) {
print(c._x.abs()); // ERROR: `c._x` might dispatch to `D._x`
// (e.g. because some library might declare
// `class E extends D implements C`), in
// which case there's no guarantee that it
// will return a non-null value the second
// time it's invoked.
}
}
Change-Id: Ib9183581aa0194377e38ab70d37c3e9f0bb57a75
Bug: https://github.com/dart-lang/language/issues/2020
Tested: TAP global presubmit
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/314600
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This is not the flag you're looking for.
The 'extension-types' flag was used for an early experiment that is
not directly related to the Extension Types feature currently being
developed. The current feature uses the 'inline-class' flag.
Change-Id: Icbb6c3828c41e743e726161b17da4c7784a2c677
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316380
Reviewed-by: William Hesse <whesse@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Tested: CQ
Change-Id: I16210697b47dd85aec8743b457e773b044cab81f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/316200
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
This CL introduces native assets suport for `dart run` and introduces
`dart build` which is similar to `dart compile` but outputs a folder
instead to that native assets can be bundled with an executable.
Change-Id: Ib6cfb95539f0adee46c99e531e440928c3f72f2b
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267340
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Change-Id: Icf489686d790be195e37db37727782227d2f3704
TEST=Version bump autogenerated by scripts
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294600
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: William Hesse <whesse@google.com>
Tested: No tests. Removing functionality, all existing tests running is a success.
Change-Id: I25eb84347e1d133d465671223f4d3b037116c5e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/294241
Reviewed-by: Liam Appelbe <liama@google.com>
Auto-Submit: Lasse Nielsen <lrn@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Kevin Chisholm <kevinjchisholm@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
This turns on the flags for these two language features and makes
them generally accessible.
Doing so causes a number of tests to fail, but the failures are
approved and there are filed issues for them. Most of the
failures are minor or only affect code using the new language
features.
This CL:
- Enables the features in experimental_features.yaml.
- Re-generates all of the various files generated from that.
- Makes some analyzer and front end changes that this CL
inherited from Paul's original CL flipping all of the 3.0
feature flags. I don't know what these changes are about, but
I assume they are necessary.
- Pins a couple of tests to 2.19 since they deliberately test
behavior that is specific to 2.19. (For most test changes, I've
landed them separately, but there are a couple of stragglers
in this CL.)
This doesn't enable "class-modifiers" or "sealed-types" and doesn't
include the core lib changes related to those.
TEST=On bots
Change-Id: Id387753772286a958e20a3589a6e983995f2e4a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286344
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Includes several updates to tests that needed to land with this flip, as well as some other tests that needed to be updated and could land separately, but are being included here to expedite things.
Removes some unnecessary experimental release versions, as well as bringing up to date the generated files, which were previously out of sync with the yaml file.
TEST=bots
Change-Id: I71a86d7a86190069b504bd27d687f62b97a7251e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285080
Commit-Queue: Jake Macdonald <jakemac@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
This reapplies commit 0c05e33836
and reverts the revert 029e0cec71.
Tested: Added few new tests, updated existing. Mainly regression testing.
CoreLibraryReviewExempt: Reviewed in original CL.
Change-Id: Ifcc79ce2f9375f607722643a04957b0961e6c295
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284304
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
This reverts commit 0c05e33836.
Reason for revert: breaks ~10% of G3 smoke suite.
Original change's description:
> Enforce current library restrictions.
>
> Mark all currently unimplementable types as `final`, or `sealed` for `num` and `final` for `Function`.
> Mark all current classes intended as mixins as `mixin class`.
>
> More additions and cleanup will follow,
> but this change should make everything keep working as today
> if we flip the switch.
>
> TEST= No new tests, very little actual change, covered by existing tests with few changes. Will add more tests when adding more modifiers.
>
> Change-Id: I40e724f823e7f88cdef186d2f73874df256e2f43
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281683
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
> Reviewed-by: Aske Simon Christensen <askesc@google.com>
> Reviewed-by: Slava Egorov <vegorov@google.com>
> Commit-Queue: Lasse Nielsen <lrn@google.com>
> Reviewed-by: Sigmund Cherem <sigmund@google.com>
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Kallen Tu <kallentu@google.com>
# Not skipping CQ checks because original CL landed > 1 day ago.
Change-Id: Ib0cb5b7ec1a8c392bbf9bf4af8dc3efc0b27991d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284187
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Ilya Yanok <yanok@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
Mark all currently unimplementable types as `final`, or `sealed` for `num` and `final` for `Function`.
Mark all current classes intended as mixins as `mixin class`.
More additions and cleanup will follow,
but this change should make everything keep working as today
if we flip the switch.
TEST= No new tests, very little actual change, covered by existing tests with few changes. Will add more tests when adding more modifiers.
Change-Id: I40e724f823e7f88cdef186d2f73874df256e2f43
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/281683
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
This feature is about to be renamed from Views to Inline Classes and
we adjust the flag name accordingly. The rename PR hasn't landed yet,
but we update the flag now to unblock work on co19 tests.
Change-Id: Ib6981b99f8541ed75f3315059a8bbca02f3a4579
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/275000
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Have a separate flag from patterns, even though sealed families are to be shipped with patterns -- keep the work separate for now.
Change-Id: Ic3996b81d9a61f2a3b1e5137e7cc32ecc8bdec9e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267289
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
This adds the 'views' feature flag together with parser support
for 'view class'. If the feature is not enabled, an error is reported.
TEST=pkg/front_end/parser_testcases/views/...
Change-Id: I813ac86a0e7de9f0a5729c6d7ae35b82d1258ae5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/265780
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: William Hesse <whesse@google.com>
This adds support for the experimental 'records' feature in the sdk
by settings its experimental release version to 2.19 and opting the sdk
into the feature the allowed_experiments.
Change-Id: I7a30212e5724e5d8ae3208f177103764b9aed737
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/262760
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Tested: Standard CQ
Change-Id: Ic52d4d38a5b117dfcdc778dedfac08315ca30a54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/251541
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Remove them from tests.
(They should have been removed from tests before launcing 2.17.)
Change-Id: I546f6cb90fdf9e6ed1bb560f3715f9db163b7c68
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/250384
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Fixes https://github.com/dart-lang/language/issues/731.
Change-Id: I5fee1470efe7b891b79dcfecd33bc3670590efb3
Tested: trybots, and global presubmit in the internal mono repo
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/243530
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
This is initially intended to support type promotion of fields
(https://github.com/dart-lang/language/issues/2020). However, if time
allows, we may roll other type inference improvements into it.
Change-Id: Ie4548ceafe671a9a328a11ad950a4e70f4d3ca41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244766
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Although we had previously planned to have multiple features included
under this experimental flag, we've decided that the one feature
implemented so far (horizontal inference) is worth turning on ASAP, so
other inference improvements will be implemented under a different
flag. This change updates the description for the flag to reflect its
narrower purpose.
Change-Id: I50918e1580ae3732e11157c8269243e1adef4cba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/244822
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Tested: Default CQ run; Dart VM changes were generated.
Change-Id: If0ea7b9fd2bb0de8459c9d4b39b9cc91cec73e23
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/240542
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
This is intended to be an umbrella for several features we plan to
implement during Q2:
- Improved type inference for methods like `Iterable.fold`
(https://github.com/dart-lang/language/issues/731).
- Promotion of final fields
(https://github.com/dart-lang/language/issues/2020).
- Other type inference and type promotion issues as time allows.
Change-Id: I31db3c15d3f6a2654650f056866c61f3d1023600
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/237924
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Step of releasing 2.16.
Change-Id: I9336289e71bcbb2cc5d298c9fb621aa6d14e99b7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/227540
Auto-Submit: Lasse Nielsen <lrn@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
TEST=Standard CQ
Change-Id: I0eba9fa6eaa73bf9da8abdd93645a8e6eb8e601b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/226691
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: William Hesse <whesse@google.com>
This CL add the 'macros' experiment and adds support for the `macro`
modifier on class declarations. This is part of the prototyping of
the static meta-programming feature.
Change-Id: Ie4b8c5443fda3813307ea076c315baad6a90c3e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/224205
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Remove messages referring to expired `non-nullable` experiment.
Remove occurrences of --enable-experiment with expired experiments.
TEST=Flags were expired. If existing tests still run, it's a success.
Change-Id: Id66d78eb0a3191ec5e31375faf0effd9ea7b768f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219789
Auto-Submit: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
TEST=Standard CQ
Change-Id: I8598e2102df2990396afa3e56ad4a41120c5dee0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/219787
Auto-Submit: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
TEST= removed flags from test. No behavior should change.
Change-Id: I401bfb68c082d1bd405a118d5eca6a47a807945f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/199241
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>