Commit graph

22098 commits

Author SHA1 Message Date
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
Ryan Macnak 0150cddace [vm] Fix call-through-getter runtime handling.
This should look for `dyn:call` instead of `call`. If it was a non-dynamic call, we would hit an invoke-field-dispatcher instead.

TEST=ci
Bug: https://github.com/flutter/flutter/issues/116405
Change-Id: I98c441fec2eb53ab23ac1dd52db3aa4eaa5cbc6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274265
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-12-08 17:48:49 +00:00
Aske Simon Christensen ad06d73ace [dart2wasm] Use a flat index space for function type parameters
The current two-level indexing scheme for function type parameters
(depth and index) breaks down in the case of type substitution when
the substituted type is a generic function type, since its internal
type parameter types have been encoded assuming that the function type
had nesting depth zero, but after substitution its nesting depth can
be higher.

Relative indexing schemes such as De Bruijn indices will also not
work, since function type parameter types are constant types, and the
constant infrastructure assumes that the same constant always has the
same representation.

This change introduces a flat indexing scheme where function type
parameters are indexed using a single index which is independent of
the context in which the type parameter type appears. To avoid
collisions in the case of nested generic function types, every function
type has a type parameter offset, which conceptually shifts the
indexing range of its type parameters so it doesn't necessarily start
at zero.

Looking up a function type parameter in its environment thus involves
searching outwards until a function type is found whose type parameter
index range contains the index encoded in the function type parameter
type.

Change-Id: I544056d52711ff829b170f78a7274a93871825a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272361
Reviewed-by: Joshua Litt <joshualitt@google.com>
2022-12-08 13:54:57 +00:00
Aske Simon Christensen f72f2e92d5 [dart2wasm] Re-enable async tests that no longer time out
Issue: https://github.com/dart-lang/sdk/issues/50122

Change-Id: I311c7a709e74381c84cb9c42cceb3d5c9cde4d61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267960
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-12-08 13:43:41 +00:00
Srujan Gaddam 293ae7dabe [ddc] Add interop classes for static members
Fixes https://github.com/dart-lang/sdk/issues/46967

Creates classes for non-external factories and static members, and
modifies invocations to point to these members instead. Tear-offs of
interop constructors (external or otherwise) are now supported since
they're just non-external static methods.

Change-Id: Id754fb4bc872051a8df4169aefd4bdc078452fb5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270501
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2022-12-08 04:57:50 +00:00
Konstantin Shcheglov fd30c4f269 Report XYZ_FROM_DEFERRED_LIBRARY during constant evaluation.
Change-Id: I3cf2fa1dfcee3d9a2ddc6d506465d26a40181524
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/274141
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-12-08 00:19:34 +00:00
Alexander Markov 66f1dee48c [vm] Runtime type check in await
'await e' should check that e is a Future<flatten(S)>, where S is a
static type of e before awaiting e. If e is not a Future<flatten(S)>,
then 'await e' should await Future.value(e) instead of e. So futures
of incompatible type are not awaited and soundness is not violated.

TEST=tests/language/async/await_type_check_test.dart
(Based on https://dart-review.git.corp.google.com/c/sdk/+/267422.)

Fixes https://github.com/dart-lang/sdk/issues/50529
Part of https://github.com/dart-lang/sdk/issues/49396

Change-Id: Ia418db1be6736710abc9be87d95584c50cbc677e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273002
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-12-07 22:46:22 +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
Martin Kustermann 4be2981c2d [vm/ffi] Ensure there's a single Function object per ffi-callback + exceptional-return combination
Right each `Pointer.fromFunction()` invocation will lead to creation of
a new ffi trampoline function & it's following JITed code. In AOT we
have exactly one ffi trampoline per target/native-signature/exceptional-return
combination.
=> This CL ensures we have only one such function.

Furthermore each `Pointer.fromFunction()` will currently perform 2
runtime calls in JIT: One to create a `Function` object, the other to
JIT that function & register callback metadata.
=> This CL ensures we won't do a runtime call to get a function, instead
   do it at compile-time (as in AOT)

Furthermore we eagerly assign a callback-id to the unique/deduped ffi
trampoline callbacks. Only when the application requests a pointer, do
we populate metadata on the `Thread` object.

This CL doesn't (yet) change the fact that in JIT mode we have
isolate-specific jit trampolines (that will call now shared ffi trampoline
functions).

We also avoid baking in C++ runtime function pointers in generated
code. As a result we can now preserve ffi trampolines across AppJIT
serialization.

As a nice side-effect, we remove 100 lines of code.

TEST=ffi{,_2}/ffi_callback_unique_test

Issue https://github.com/dart-lang/sdk/issues/50611

Change-Id: I458831a47b041a088086f28f825de2a3849f6adc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273420
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2022-12-07 20:47:13 +00:00
asiva e70e2bc1b7 [Dart 3.0 alpha] Fix some test issues (legacy mode argument not passed in)
TEST=ci

Change-Id: Iebb31a509b99837e41cf3823ca366c1560777af6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/273920
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2022-12-06 19:34:47 +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
Erik Ernst ac68a593d4 New test, testing the behavior under scrutiny in SDK issue 49396
Change-Id: I1ebb2ea12f4d01c4077fca6fc380353f821bc68a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267422
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2022-12-05 09:40:08 +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
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
Ryan Macnak f4b34ad31b [vm, gc] Add missing promotion of Finalizer external size. Remove race incrementing external size.
When a FinalizerEntry's target gets promoted, the associated external size needs to also get promoted. We were handling the cases where the FinalizerEntry itself was either already old or remained new, but not the case where it was promoted. Failing to promote the external size meant that when the finalizer was collected, external size was subtraced from old space that was still being attributed to new space, so the old space total external size became negative.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/50537
Change-Id: Id2fe2d748311de73f04de367c9cd153d87b74ad1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272350
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-11-30 17:14:59 +00:00
Alexander Thomas 2a035279af [3.0 alpha] Use equals for default values in the SDK
The colons cause test failures when the language version is bumped to 3.0. This CL can be landed before the 3.0 version bump.

Bug: https://github.com/dart-lang/language/issues/2357
Change-Id: Id8396034b16adc18b476689314e28b9617d25f18
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272200
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-11-30 10:33:31 +00:00
Brian Quinlan 8df8bbf0de Add PathExistsException and PathAccessException FileSystemException subclasses.
Bug:https://github.com/dart-lang/sdk/issues/50436
Change-Id: Ie2954f162c01189cd0d817f58606529acdc13416
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269240
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-11-30 04:54:52 +00:00
Nicholas Shahan 2cbed01634 [ddc] Avoid null check on forwarding field setters
Overriding fields can change the type to remove nullability and
can also be final so they override the getters only.

For DDC that means there is an inherited setter that could still be nullable and a forwarding setter that should allow null even though
the type of the overriding field is non-nullable. With enhanced null
safety asserts enabled in weak mode there should be no failure when
setting the inherited field to null.

Fixes: https://github.com/dart-lang/sdk/issues/50569
Change-Id: Ie6af0d1e265a5f3b15469311fa1f7e2a184d95ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272480
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mark Zhou <markzipan@google.com>
2022-11-29 21:49:15 +00:00
Kallen Tu 0329e7da94 [tests] Typedef, part of, and mixin 'on' language tests for sealed classes.
Change-Id: Idc72291668d72def5ec4c93ecb77eeea554628b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271502
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-11-29 17:51:34 +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
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
Daco Harkes 827d166ea0 [vm/ffi] Stop reifying type argument in Pointer
All `Pointer`s will now have the `Never` type argument at runtime.

TEST=tests/ffi(_2)/*

Bug: https://github.com/dart-lang/sdk/issues/49935

Change-Id: I83c8bba9461c2cab22992ba2e3cf42b7b5f43c36
Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try,vm-kernel-reload-linux-debug-x64-try,vm-kernel-win-debug-x64-try,vm-kernel-precomp-win-debug-x64c-try,vm-kernel-mac-debug-x64-try,dart-sdk-mac-arm64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-ffi-android-debug-arm64c-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/272201
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-11-28 09:45:45 +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
Kallen Tu 669856ce4c [cfe] Report error when extending/impl/mixing in sealed classes outside of its library.
Change-Id: I8034cba69ca249c2727dea9641c3076788c6a854
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/271164
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-11-23 22:58:21 +00:00
Robert Nystrom b9b30b5883 Add language tests for pattern variable scoping.
This doesn't comprehensively cover everything we should test around
pattern variable scopes, but I wanted to cover most of the tricky
behavior around variables in cases that share a body, along with some
other edge cases that I thought of while speccing that out.

Change-Id: I64fff7b4a9a30b00801fbf37b52f07799ef0fd35
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268370
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
2022-11-23 00:05:47 +00:00
Srujan Gaddam aa252e907e 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>
2022-11-22 17:28:28 +00:00
Aske Simon Christensen f34be9eda4 [gardening] Consolidate skipped Windows tests between co19 and co19_2
Issue: https://github.com/dart-lang/sdk/issues/32138

Also updated the issue in the status files.

Change-Id: Icd80055a0dbc1341614bb9f5ce197796e0edf30f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268301
Auto-Submit: Aske Simon Christensen <askesc@google.com>
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2022-11-22 09:37:48 +00:00
Srujan Gaddam 7d8e63b0b5 [pkg:js] Disallow non-@staticInterop classes from inheriting @staticInterop
Adds checks that if the derived class does not have a `@staticInterop`
annotation, none of the classes it implements or immediately extends can
have it either. Also cleans up some redundant abstract class tests for
readability.

Change-Id: I2e8528b0fb02d9ce39003d00ee0b3da88ce75d44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268109
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2022-11-21 20:19:06 +00:00
Srujan Gaddam 4c34e780cf [pkg:js] Require users to use @JS when using @staticInterop
Change-Id: Iea0a54ff03b32bc910ef2c6eb633bffd09cf0671
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268108
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Riley Porter <rileyporter@google.com>
2022-11-21 20:19:06 +00:00
Srujan Gaddam aab6ab8b84 [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>
2022-11-21 20:19:06 +00:00
Paul Berry b8489128cb Test field promotion during top level inference.
Bug: https://github.com/dart-lang/language/issues/2020
Change-Id: I58d7f5691a4af614bcd481a109e340ca709fe4ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270760
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-11-21 17:20:55 +00:00
Paul Berry 22c46e573a Field type promotion: fix CFE handling of abstract fields.
Bug: https://github.com/dart-lang/language/issues/2020
Change-Id: Ie35f7ff2d3de33c5f94bb7b703c13c9764a85c70
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269981
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-11-21 15:25:03 +00:00
Kallen Tu e7c0280487 [analyzer/cfe] Add support for sealed mixins and class type aliases.
Change-Id: I1b875f9569ed09db73bda5fe33e723c8e8ed3b79
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/270020
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-11-18 19:09:40 +00:00
Paul Berry 2cdc987724 Field promotion: more thorough language tests, plus a CFE bug fix.
Bug: https://github.com/dart-lang/language/issues/2020
Change-Id: I1c604b548f2635b50addc0a97b105da8391b043c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269641
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2022-11-18 14:54:48 +00:00
Johnni Winther 02e8bbb036 [cfe,analyzer] Share experimental flags for the parser
This adds a new generated file into _fe_analyzer_shared for the
experimental flags. This is now used by the parser when generating
messages about features not being available.

The default implementation uses whether the feature is enabled by default
or not, to emit different messages. This change will therefore ensure
that when a missing feature changes from 'experimental' to
'enabled by default', the  message reported by the parser will be
updated accordingly. Currently errors are only reported from the parser
on features that are enabled by default, so the message for experimental
features is not currently used.

The reporting is performed through the Listener, such that
implementations can override the reporting to improve the messaging.
This is done in the CFE where the message is improved to take into
account whether the language version is explicit in the parsed library.

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

Change-Id: Ief812817c7eb4b1e433389f6f49d6a1f77604fa7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269860
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-11-17 11:32:01 +00:00
Alexander Aprelev a83cfa0990 [vm] Replace Double_hashCode native method with graph intrinsic implementation.
Bug: https://github.com/dart-lang/sdk/issues/50265
TEST=ci
Change-Id: Icae87ce3871bb44599e0f1fa19d8becb3a6fcdec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/264240
Commit-Queue: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2022-11-17 02:28:37 +00:00
Kallen Tu 9e922093da [cfe] Add sealed classes to AST, builders and dill files.
TEST=pkg/front_end/testcases/sealed_class/*

Change-Id: Iea7db59d2bba92e5f3594f6e89949e6ff3c85a80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269801
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-11-16 23:57:29 +00:00
Joshua Litt 2e0784a6c5 [test] Breakup named-captures_test to preserve test coverage.
Apparently the web implementation of RegExp has drifted from the native implementation in a very subtle way. To prevent further drift, this CL refactors named-captures_test into two tests, one which fails on all web backends currently(named_captures_2_test), and one that passes on all backends(named-captures_test, named unchanged to preserve history).

Change-Id: Ie94185948873fe3e592c10a45c6127dc6d0a4238
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267282
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-11-16 16:19:34 +00:00
Ömer Sinan Ağacan a2adab7dfd Update Function class documentation:
Language spec does not require that evaluations of the same function
literal should create distinct objects. Remove the parts in `Function`
documentation to reflect that.

Also fixes formatting of markdown.

Invalid test file (with Dart 2 and 3 versions) removed: the tests assume
function literals won't be lifted to top-level.

Change-Id: Ib7a9464ad992cf461e77ef2d8ef336c7b0f4875a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269721
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2022-11-15 15:41:49 +00:00
blagoev 50e18b8160 [vm/ffi] Add Dart_IsNull in dart_api_dl.h
TEST=tests/ffi/vmspecific_handle_dynamically_linked_test.dart

Closes: https://github.com/dart-lang/sdk/pull/50466
Closes: https://github.com/dart-lang/sdk/issues/48331

GitOrigin-RevId: ce49a64788310a755cd9bb5c7ff6d281830bcc33
Change-Id: Ia8e23c57c76767d9e3db799b8fe6b172071582a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269742
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
2022-11-15 10:32:16 +00:00
Kallen Tu 0e524b949a [analyzer/cfe] Emit error when trying to use sealed and abstract modifiers on a class.
`sealed` and `abstract` modifiers are mutually exclusive. Error when a user tries to use them together on a class declaration.

Implemented in the parser since it's a common error between the analyzer and the CFE.

Change-Id: I9a8835c29ddb430ea0f005630bbdf9348f8b055c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/269260
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2022-11-14 19:51:42 +00:00
Chloe Stefantsova e25e532900 [cfe] Allow 'new' as constructor name on enum elements
Additionally, add some missing compile-time errors and adjust error
text expectations.

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

TEST=Covered by existing tests.

Change-Id: Ie62211650633beb26abdf735e0dd36c4de4e24c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/266740
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2022-11-11 11:13:35 +00:00
Ryan Macnak ae13d34299 [test] Avoid tests fighting over the default service port.
With no argument, --enable-vm-service and --observe default to port 8181. Passing 0 means to take any available port. If two tests try to use the default port at the same time, one will fail to bind that port.

TEST=ci
Change-Id: Ib7615911db9fb9ab037de1efdd4918b54f59d9e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268840
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2022-11-10 17:28:48 +00:00
Kallen Tu 835317d7da [cfe] Add initial parser support for sealed classes.
Basic support for the `sealed` keyword and added a few tests.

Change-Id: I5adedda22b1e8ce6d4b61136ad8e6d38bdf05043
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268366
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2022-11-09 17:39:59 +00:00
Jackson Gardner 81a63dafe5 [ffi] Convert ABI-specific integers to fixed-width integers when doing wasm FfiNative transformation.
It's a bug if a class has more than one `@AbiSpecificIntegerMapping`
annotation. Reflect this in the return type of method for getting the
annotation and issue a diagnostic if the invariant doesn't hold.

The invariant is checked by `_FfiDefinitionTransformer`.

Change-Id: Iadf4636090c6ec814f623c9245b3a1fe8b466b4b
Tested: Unit tests written with all ABI specific integer types.
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/268105
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2022-11-08 22:16:28 +00:00
Brian Quinlan b75f8aaaf5 [io/file] - add FileSystemNotFoundException
Thrown by when an operation fails because a file is not found.

TEST=updated unit tests
Issue: https://github.com/dart-lang/sdk/issues/12461
Change-Id: I2e6e3986f92d5bf9f3922f4e2c6bbba67cc102bc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267280
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Brian Quinlan <bquinlan@google.com>
2022-11-08 19:26:19 +00:00
Kallen Tu 63b49dfc8e Deprecate checkValidIndex and avoid using it in the core library.
TEST=No new behaviour, existing tests pass.

Change-Id: Ia7a8e58543bd5e1d8dd14bd46c5083759333845b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/259104
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2022-11-08 19:02:35 +00:00
Johnni Winther 6a249fdcb0 [cfe] Include import paths in error for unavailable dart: libraries
This special-cases the error for importing/exporting dart: libraries
that are not available on the current platform and includes a detail
description of how the unavailable library was imported in the
context of the error message.

Currently there is no special casing of the message depending on the
unavailable library and the current platform, as this is meant as
a catch-all message. In a follow-up I'll add special casing of the
message for some of these cases.

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

Change-Id: Ia296f9ca1b03bf664e12241a139970ef31c8a2d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/261821
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2022-11-08 14:54:17 +00:00
Anna Gringauze cc80ccfaa0 Fix stack overflow in mixin application from separate library
Make sure that calls to super class methods from mixin application
stubs are always generated using `super` and not `this`.

Replacing `super` by `this` should not be used as non-virtual field access optimization in forwarding stubs that intend to redirect to the super class members (using `this` redirects to itself and causes infinite recursion).

Closes: https://github.com/dart-lang/sdk/issues/50119
Change-Id: Ib9c9aebdc88555518998db64aefa1fd0905c5b11
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/267822
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
2022-11-04 21:25:08 +00:00