Commit graph

20988 commits

Author SHA1 Message Date
Ben Konyi
2752e9686b Skip standalone{_2}/check_for_aot_snapshot_jit_test on non-JIT test
configurations

This test tries to AOT compile a sample test program and run it in a JIT
VM to ensure a useful error message is output. This test doesn't make
sense in non-JIT test environments and should be skipped.

Fixes https://github.com/dart-lang/sdk/issues/44227

Fixed: 44227
Change-Id: I17abbf8512944ac77bb9cad1c486ae77aac26c7a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/172401
Reviewed-by: Régis Crelier <regis@google.com>
2020-11-16 22:20:59 +00:00
Tess Strickland
844a5176ff [vm] Fix ArgumentsDescriptor uses in DoArgumentTypesMatch.
Use of PositionalCount() and PositionAt() as indices in the arguments
array must account for the type arguments if present. Otherwise, we'll
either skip checking the last positional argument (in the former case)
or check against the wrong arguments (in the latter case).

In nosuchmethod_forwarding_arguments_test.dart, add cases that check for
the above mistakes.

In require_named_args_strong_test.dart, use the more specific
throwsTypeError or throwsNoSuchMethod checks instead of the generic
throwsError to ensure the correct error is thrown.

TEST=Changed tests to add extra cases for failures that can happen.

Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try
Change-Id: If5e6c310d36d244bb0650ded54e32e583732584e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171947
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2020-11-16 11:53:39 +00:00
Martin Kustermann
22f1b7b88e [gardening] Add two more needed resources for standalone/io/test_extension_fail_test.dart
Also fix another test that was missing // OtherResources= annotations

When reproducing the failures, one has to remember to `rm -rf out/Release/generated_*`

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

Change-Id: If838a5fcdf56bcb094ba2ca211163c3b5007a3c3
Fixed: 24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171943
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Liam Appelbe <liama@google.com>
2020-11-14 10:30:27 +00:00
Martin Kustermann
838fe41428 [gardening] Add missing helper files to make test pass in appjit mode
In app-jit mode the Platform.script is in a different place. The test
needs files next to it in order to run.

Change-Id: Icc05287c6cba37fcdc9f8cd54edefb3657a0084c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171887
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
2020-11-13 12:04:29 +00:00
Srujan Gaddam
4cd0926703 [package:js] Add/modify tests for JS interop subtyping
Adds some basic tests to check for runtime subtyping with JS
interop types. Uses function types only to check for subtyping
relationships. Extends some tests on is and as checks as well.

Change-Id: I9cbc91d0c475fba3213dd9a3443921232c286804
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170660
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-11-11 19:28:13 +00:00
Lasse Reichstein Holst Nielsen
1003e91a35 Remove uses of, and need for, Expect.throwsNullCheckedError.
All code which was tested now throws a TypeError in both
sound and unsound null safe mode.

Change-Id: I304dfa6b8683223562f8613f3d14823fccab35bd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170439
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-11-11 13:30:30 +00:00
sgrekhov
93d74d6aad [co19] turn off some type alias tests in analyzer and external variables tests on dart2js
Change-Id: I4ecec92d5d0d51e050e2d3a189eede439e5b8de3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171520
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2020-11-11 08:34:18 +00:00
Stephen Adams
8c13fa841e [dart2js] Kernel transformer expansion for List.generate
Simple calls to `List.generate` are expanded into a list allocation
and a loop. This generates better code for several reasons:

 - There is no overhead for the function argument (closure allocation,
   closure type, closure class)

 - Global type inference is more precise since each List.generate list
   is tracked separately, and the assignments in the loop give better
   inference to the collection's element type.

To get precise element type inference, there are two new JSArray
constructors. Global type inference starts with the element type being
bottom for these elements, avoiding spurious nulls in the inferred
type.

Change-Id: I5efb90651ae3f9eb2e81af556704960cdf0b75c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168770
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-11-11 04:27:22 +00:00
Regis Crelier
9711b9a331 [VM/kernel] Remove obsolete workaround when reading dynamic bound from kernel.
If the bound is not specified, CFE will use Object* in an opted-out library or Object? in an opted-in library, and not dynamic as before.
This workaround is therefore not needed anymore, and actually harmful as shown in the regression tests.

Closes https://github.com/dart-lang/sdk/issues/44136
Add regression tests.

Change-Id: I11a96cbebcb592f66f3965e38cb2411200df332b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/171380
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Régis Crelier <regis@google.com>
2020-11-10 21:30:26 +00:00
Johnni Winther
38d7c7661d [cfe] Special case Null in assignability errors.
In error reporting on assignability where the expression has type
`Null` we use a special messages that doesn't state that
"'Null' is nullable". Cases where `Null` is part of the type or where
the expression of type `Null` is derived from a collection are not
special cased.

Closes #43998
Closes #44093

Change-Id: Ic0c79e6362f2365eb3fe8222ccd2ef8fac4f188d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170433
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2020-11-09 11:07:44 +00:00
Daco Harkes
6101e4653b [test/ffi] Add struct stack alignment test
A smoke test to exercise alignment of structs with various field types
to see how they are aligned on the stack. Only contains small structs
because most ABIs only pass structs less than 16 bytes on the stack.

Especially tests iOS64, where `AlignOf(struct{float32;float32;}) == 4`
but `AlignOf(struct{int32;int32;}) == 8` due to the special treatment
of homogenous floats in the arm64 ABI combined with iOS decision to not
align everything on the stack to at least word size.

Test tested on iOS64 through Flutter.

structs_by_value_tests_configuration.dart is the only non-generated
file.

The tests are tested in the dependent CL. Tests are ignored in status
file and are un-ignored in dependent CL.

Tests for https://github.com/dart-lang/sdk/issues/36730.

Change-Id: I6ec4523208db740b8ea3f8a4ab1e5717f1088467
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170691
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-06 13:54:23 +00:00
Erik Ernst
35d83867ba Enable non-function type alias tests for the analyzer
Change-Id: I64074eb4b49e514f3b7454de0fb244f21ef336a6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170580
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-11-06 08:19:52 +00:00
Stephen Adams
e769817cdc [tests] Split corelib{,_2}/list_concurrent_modify_test
Splitting out a failing test to increase coverage of other tests.

It is not clear that `a.addAll(a)` should throw if `a` is empty.
`a` is not modified by the action.

dart2js/DDC do not detect this case and I'm reluctant to add a check
for the case where `a` is in fact not modified.

The VM test is very specific to an identical argument and cannot
detect the case for `a = Mylist([])`.

Another option to this proposal is to simply delete the `[]` case.

In general, I'd like to move more ConcurrentModificationError tests
into assert statements.

Change-Id: I1f9559bdb43ea1bae0575413748c9d9d0de58b99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170023
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-11-05 19:46:35 +00:00
Erik Ernst
3a7eeb6315 Rename is{Strong,Weak}Mode to has{Sound,Unsound}NullSafety
Change-Id: If3912d75c5f89a741299b2fae4299d01ac928eec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170424
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-11-05 14:26:53 +00:00
asiva
5c0e6ba974 [Tests] - Fix legacy tests that broke when non nullability was enabled by default
1. lib_2/isolate/issue_6610_test - the source is served from a http request, the autodetect code causes the code to be served multiple times leading to 'count' being incremented multiple times.

2. standalone_2/http_launch_test - source is served from http request and hence the CFE auto opt out does not work for the spawned isolate

3. standalone_2/io/named_pipe_script_test - serves the source using a named pipe and the autodetect code does multiple fetches of the source resulting in an error

4. standalone_2/io/test_extension_test - spawns processes from a directory that is not auto opted out by CFE

TESTS = Fixes existing legacy tests.

Change-Id: I3c78055136659850ce068d6ab254279839d2414b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170280
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-11-04 20:58:57 +00:00
asiva
308c8059f3 [Tests] - Fix the spawnuri autodetect tests.
TESTS = existing tests are being fixed here

Change-Id: I9136017d29c11f73dd97c82364dc5ead8e2ae7d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169407
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2020-11-04 17:50:27 +00:00
Alexander Markov
0b3e6bd16c [vm] Enable non-nullable experiment in the VM by default
VM was not performing auto-detection of sound null safety mode
if --enable-experiment=non-nullable was not specified on the command
line. This change flips that logic to perform auto-detection unless
--enable-experiment=no-non-nullable is specified.

TEST=Added regression test runtime/tests/vm/dart/regress_44026_test.dart.

Fixes https://github.com/dart-lang/sdk/issues/44026
Fixes https://github.com/dart-lang/sdk/issues/44043

Change-Id: Ide8935e90dd3a8bd5a417aeb758605dedbb853eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170201
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-11-03 22:29:08 +00:00
Daco Harkes
5278383736 [vm] Native API: Make Dart_NewWeakPersistentHandle not auto delete
Changes Dart_NewWeakPersistentHandle to no longer auto delete the
weak persistent handle.

Changes the signatures of WeakPersistentHandleFinalizers to no longer
have access to the handle.

Flutter PR: https://github.com/flutter/engine/pull/19843
g3 presubmit: cl/318028238

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

TEST=runtime/vm/dart_api_impl_test.cc

Change-Id: I3f77db9954d9486759f903b78c03a494f73c68ba
Cq-Include-Trybots:dart/try:vm-ffi-android-debug-arm-try,vm-ffi-android-debug-arm64-try,app-kernel-linux-debug-x64-try,vm-kernel-linux-debug-ia32-try,vm-kernel-win-debug-x64-try,vm-kernel-win-debug-ia32-try,vm-kernel-precomp-linux-debug-x64-try,vm-kernel-precomp-android-release-arm64-try,vm-kernel-asan-linux-release-x64-try,vm-kernel-msan-linux-release-x64-try,vm-kernel-precomp-msan-linux-release-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try,vm-kernel-precomp-android-release-arm_x64-try,vm-kernel-precomp-obfuscate-linux-release-x64-try,dart-sdk-linux-try,analyzer-analysis-server-linux-try,analyzer-linux-release-try,front-end-linux-release-x64-try,vm-kernel-precomp-win-release-x64-try,vm-kernel-mac-debug-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try,analyzer-nnbd-linux-release-try,front-end-nnbd-linux-release-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/151525
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-11-03 10:27:44 +00:00
Liam Appelbe
f25c50fdcb [wasm] Use wasm traps to handle exceptions
The Dart exception is converted to a string, stored in a trap which
is passed through wasm, then converted back to a Dart exception.

Module instantiation can also throw a trap, because it internally
invokes the initialization function, if the module defines one. So I'm
handling this too.

Also, update to the new version of the wasm C API, which replaces some
foo_t** with foo_vec_t*.

Bug: https://github.com/dart-lang/sdk/issues/37882
Change-Id: I1e6952a191134734a892c42b2fb8ba3506bb0844
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169784
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-11-02 23:32:20 +00:00
Vijay Menon
f346cb7f77 Fix ddc debugger_test
This CL:
- Fixes https://github.com/dart-lang/sdk/issues/43987 (an exception in custom formatting code)
- Restores (most of) debugger_test.dart to passing (which tests above)
- Fixes a type caching error also exposed by the above test

Note, this skips the golden file comparison.  That appears to be very broken
(see comment).

Change-Id: I283b66a710f17765faed47aa099b0b8570e6cac1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170022
Reviewed-by: Gary Roumanis <grouma@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Vijay Menon <vsm@google.com>
2020-11-02 23:31:30 +00:00
Brian Wilkerson
3fe3a0384f Improve the highlight range for invalid_super_invocation
Change-Id: I8be664802f04def78304b7cc0e8481d734d295e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/170040
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-11-01 15:24:51 +00:00
Ryan Macnak
c8dea19836 [vm, gc] Reserve some memory to use during handling of OutOfMemoryErrors.
This reserved space can only be allocated from after an allocation has failed from OutOfMemory, and once some portion of this space is used, refilling it is the first allocation performed after GC.

Also avoid greatly slowing down from ineffective scavenges as the memory limit is reached.

Bug: https://github.com/dart-lang/sdk/issues/43543
Bug: https://github.com/dart-lang/sdk/issues/43642
Bug: b/169880355
Change-Id: Ic7132cb34d7a7d13c67661f057f00dd74306251c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/165862
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-30 23:07:22 +00:00
Ryan Macnak
88fdb3ee68 Add tests for the identity of constants repeated in different loading units but not present in the main unit.
Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: I29a00aa6139dc2a1f865f8c5f659169c84c8e45d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169790
Reviewed-by: Régis Crelier <regis@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-10-30 19:16:42 +00:00
Johnni Winther
5efe55abf7 [cfe] Fix missing case of using receiver type instead of bound
+ fix test to expect erasure of `S & int` to `S` also when bound is `dynamic`.

Closes #43591

Change-Id: I44cb4c726648d4065bdf89bb2dbf71b2753c6c84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169340
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-10-30 16:33:51 +00:00
Erik Ernst
0cf3c37e9e Adjust tests verifying the static type dynamic
Change-Id: Icf229e3877ce646340b6dad1bd49c20110953d44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169885
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-10-30 16:10:30 +00:00
Mayank Patke
a5afc3e974 [dart2js] Remove tests/dart2js/boolean_conversion_test.
The dart2js_2 version still exists.

Prior to null safety, it was legal to assign `null` to a `bool`, so
things like boolean operators and control flow constructs required
null checks on their inputs. `--omit-implicit-checks` removed these null
checks, so we had to specify what the behavior would be in these cases.
(In general, `null` was just treated as a falsey value, since that's
what happens in JS.)

With null safety, it is no longer legal to assign `null` to a
(non-nullable) `bool`, so the backend freely optimizes boolean
expressions under this assumption. It's possible to smuggle `null` in
via a cast to `dynamic` and an implicit downcast to `bool`. The downcast
ordinarily fails at runtime but can be removed with
`--omit-implicit-checks`. We do not want to specify the behavior in this
case. We do not guarantee the behavior under `--omit-implicit-checks` of
code which would have failed with checks enabled.

Maintaining the old behavior would likely require us to be pessimistic
about nullability and miss optimization opportunities.

Fixes: https://github.com/dart-lang/sdk/issues/43471
Change-Id: I7e8e7c66f777ef631ef4054a8dfe211e3e2bef55
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169820
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
2020-10-30 15:21:20 +00:00
William Hesse
65b424b3fd Skip VM tests that hang on Windows
Three dart:io tests in the co19 suite are hanging, causing
test infrastructure failures. Skipping them until the problem is fixed.

BUG=https://github.com/dart-lang/sdk/issues/32138

Change-Id: I5102eef49bf094158535aa2b938930994d4df4dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169880
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-30 11:20:43 +00:00
Leaf Petersen
a6faf8f2f9 [Language] Enable null safety in Dart 2.12.
Closes https://github.com/dart-lang/sdk/issues/22

Change-Id: I662dd17fda0ff62a871314896fbf1dbe220f41de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/166790
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
2020-10-29 18:25:56 +00:00
Johnni Winther
13704520a0 [cfe] Indicate nullability as assignability issue when appropriate
Closes #43592.

Bug: https://github.com/dart-lang/sdk/issues/43592
Change-Id: Ib57a70526a39a7125238546f08e1a2e97c279f0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168860
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-29 16:10:03 +00:00
Erik Ernst
d459f2244a Enable non-function type alias tests for CFE based tools
Change-Id: I794b18ee8e8b87e692889614a062132fcf1f010a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169641
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-10-29 13:40:23 +00:00
Lasse Reichstein Holst Nielsen
8abf6c67ad Add test of potentially constant scopes.
Tweaks.

Change-Id: I0fb8b4088c86e5b83f1c76db8a2dfa7c9023c1b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/99000
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-10-29 10:11:53 +00:00
Alexander Markov
061848e97e Cleanup misc remaining references to bytecode
Change-Id: I37c2dfb29a5bc4faf1478fb31623749cb8f67d67
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169502
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
2020-10-28 21:51:20 +00:00
Srujan Gaddam
2fd4b4f562 [dart2js, ddc] Emit native null checks in sound mode only
Bug: https://github.com/dart-lang/sdk/issues/42536
Bug: https://github.com/dart-lang/sdk/issues/42535

Since ddc would require a potentially breaking change to emit these
checks in unsound mode without opt-in and it's currently not possible
to emit these checks only in opt-in with dart2js, both are changed
to only emit checks in sound mode. In ddc, calling convention is
changed conditionally on sound mode as well to avoid emitting
unnecessary code in unsound mode.

Change-Id: I42f7bb5a53550f4ee5412fbbbfb6ca533c393e96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169247
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-10-28 21:35:45 +00:00
Daco Harkes
312a572ade [vm/ffi] Fix prepare_flutter_bundle.dart
It now includes /ffi_test_functions_generated.cc and prints
instructions on how to use the generated bundle.

This CL adds some TODOs and deletes the non-migrated copy that was in
the NNBD folder.

Finally, this CL disable a check that fails because of static linking
on iOS.

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

Change-Id: Ie85d92568bb95eaafd2991725a1a31cdecd246be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169402
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-28 21:33:35 +00:00
Srujan Gaddam
ed009afc4c [package:js] Add static errors for invalid extends
Bug: https://github.com/dart-lang/sdk/issues/37896

dart2js disallows JS interop classes from extending Dart classes,
and ddc does not work as expected. Dart classes that extends JS
interop classes can't be declared in ddc and throw an error on
usage in dart2js. This CL adds static errors for both cases.

Change-Id: I72001d2e8bec046c0e1ab4c06fed8fcf84ade259
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/164840
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2020-10-28 16:04:15 +00:00
Martin Kustermann
a99904a45a [vm/nnbd] Explicitly opt-out test helper scripts from null safety to prepare for NNBD turned on
Closes https://github.com/dart-lang/sdk/issues/43947

Change-Id: I5c7abdd25e15f4ddaef11b45af294e7345d7cf99
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169321
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-10-28 11:00:57 +00:00
Clement Skau
c486a07b02 [VM] Fixes yield* exception handling in sync*.
This adds a mechanism similar to that used in async functions where
exceptions are caught in the synthetic code and passed into the
generated body to be rethrow'n.
This ensures the exception is throw'n from the same place as the
original yield*, as per the spec.

Bug: https://github.com/dart-lang/sdk/issues/42466
Change-Id: I054b9db568a49b046b6bb49f3e775bf093f83950
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160221
Commit-Queue: Clement Skau <cskau@google.com>
Reviewed-by: Vyacheslav Egorov <vegorov@google.com>
2020-10-27 06:46:27 +00:00
Daco Harkes
957487b5da [test/ffi] Structs by value 1-byte aligned
The 3 and 7 byte tests in
https://dart-review.googlesource.com/c/sdk/+/168829
had their sizes rounded up to the next power of two due to alignment of
fields inside the structs.

In order to properly exercise behavior on win32, win64 and iOS, this CL
changes those structs to only have uint8 fields to prevent alignment
influencing the sizes.

Old tests are renamed to exercise the size rounding due to alignment.

This also swaps around the two 9byte structs to have consistent naming
with the new 3 and 7-byte tests.

structs_by_value_tests_confguration.dart is the only non-generated file.

The tests are tested in the dependent CL. Tests are ignored in status
file and are un-ignored in dependent CL.

Tests for https://github.com/dart-lang/sdk/issues/36730.

Change-Id: If47cfcaebe56f43d50265f0d6e2749c56fe7b195
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169101
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Tess Strickland <sstrickl@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-26 17:26:56 +00:00
Daco Harkes
b62e715073 [test/ffi] Passing structs by value test generator
Split off from https://dart-review.googlesource.com/c/sdk/+/140290/33
to make that CL smaller and review the test generator separately.

Because of the amount of corner cases in the calling conventions that
need to be covered, the tests are generated, rather than hand-written.

The tests are tested in the dependent CL. Tests are ignored in status
file and are un-ignored in dependent CL.

Change-Id: I5507f52229793fdf07da3066b49045fdb703a69d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168829
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-10-26 12:01:16 +00:00
Brian Wilkerson
6b3f3403ec Unify three diagnostic codes for documentation purposes
Change-Id: I46326160fedb26c92843698dd6513b9fe87e32dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/169041
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2020-10-26 04:24:55 +00:00
Jens Johansen
5a6129406f [parser] Consistently disallow 'late' without 'var', 'final' or type
Fixes https://github.com/dart-lang/sdk/issues/43811
Fixes https://github.com/dart-lang/sdk/issues/43812
Fixes https://github.com/dart-lang/sdk/issues/43813

Change-Id: I39de527883d33459694ec0f91b769676eb52d54b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168641
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2020-10-23 06:28:51 +00:00
Srujan Gaddam
1c1fef8d68 [dart2js] Add negatable flag for native null assertions
Allows build systems to turn off native null assertions if the
default value ever changes.

Change-Id: I7265b2328e4e8834d8bbe19159fcac7ea916b451
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168763
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-10-23 00:07:21 +00:00
Srujan Gaddam
d201c33f69 [ddc, dartj2s] Exclude null checks on non-web native members
Modifies ddc and dart2js logic to only include null-checks on native
members inside the web libraries. Modifies tests to account for this
change.

Change-Id: If9c164fb90b761d3c4611d87ffeb02c2fa884457
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168585
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-10-23 00:07:21 +00:00
Alexander Markov
f4afdb3d76 [Tests] Skip slow co19 tests on simarm* and aot/debug configurations
These tests involve large list literals which are very slow to
compile in AOT/debug mode, or they perform a large amount of work
which is too slow on simulated architectures (simarm, simarm64).

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

Change-Id: Iafe1407247cc69e641d1e63f47b4c3d9f6eea35f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168782
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-10-22 17:09:40 +00:00
Liam Appelbe
e2840ed07a [wasm] Basic WASI support.
Enabling WASI when building an instance sets up the default WASI
imports, and can optionally capture stdout/stderr. I'd like to set up
something similar for stdin, but Wasmer doesn't support that yet.

I also improved error handling in WasmRuntime by adding Wasmer's last
error to the thrown exceptions where appropriate.

Bug: https://github.com/dart-lang/sdk/issues/37882
Change-Id: I2d8546e878bcb43c7093490eac085aa62d318e96
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167904
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-10-20 19:24:05 +00:00
Jens Johansen
9b28b6e503 [tests] Add const-big-set-literal test
Const version of regression test for #43756

Change-Id: Ie21be7985e420290cf1c286fd299d5e8962f757e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168483
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-20 11:07:23 +00:00
Erik Ernst
a917cae88c Add further cases to metadata test
Adding static methods/getters/setters to class/mixin/extension,
instance getters/setters/operators to mixin/extension, new-syntax
type alias.

Change-Id: I4e3f168d8db9c5f168b138c847bccf948c05c567
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168080
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-10-19 16:10:08 +00:00
Jens Johansen
bf46063e16 [tests] Add big-set-literal tests
Regression test for #43756

Change-Id: Iaf2cca5ae5440d3604c8c3311ad443f63355dc33
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/168340
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2020-10-19 09:23:26 +00:00
Liam Appelbe
89dbc35fca [wasm] Wasm function imports.
I switched from a WasmImports object to a builder pattern:
module.instantiate().addMemory(...).addFunction(...).build();

Bug: https://github.com/dart-lang/sdk/issues/37882
Change-Id: I381aa0f7df1fa006ce8d051cd5b4a1bcc1835e46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167460
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Liam Appelbe <liama@google.com>
2020-10-16 23:16:42 +00:00
Paul Berry
f0052ef52e Add cycle detection test cases for nonfunction type aliases.
Change-Id: I4375c3374ba5d51b4431dbe22a0e8c867a4eb03d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/167720
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-10-16 23:13:42 +00:00