Commit Graph

21307 Commits

Author SHA1 Message Date
William Hesse 24c7666def Update tests that have the current version number hardcoded
Some package configuration tests have the current version hardcoded
in local package_config.json files. Update these from 2.9 to 2.10.

Change-Id: I77bf63c0e5dfa73aa8a86fb1b4e8a404e8cfaa7f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155441
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-22 13:22:07 +00:00
Ben Konyi a24192e786 Revert "[ VM ] Print a meaningful error message when a user attempts to run an AOT snapshot with a JIT VM."
This reverts commit d870a71b20.

Reason for revert: ASAN failures

Original change's description:
> [ VM ] Print a meaningful error message when a user attempts to run an AOT snapshot with a JIT VM.
> 
> Fixes https://github.com/dart-lang/sdk/issues/42482
> 
> Change-Id: I284a5673e30f59b127e69c712df93552cdfcde41
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154834
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=bkonyi@google.com,rmacnak@google.com,asiva@google.com

Change-Id: I3639ede6987fbb51fb95584685c472abb789970e
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155303
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-07-21 23:49:47 +00:00
Ryan Macnak d68d2e9e0a [vm, gc] Account for unbounded number of images pages in the compactor.
Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: I23201f28e5d1e2ba298611206fc3eb0a9a989c2b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155241
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2020-07-21 21:57:05 +00:00
Ben Konyi d870a71b20 [ VM ] Print a meaningful error message when a user attempts to run an AOT snapshot with a JIT VM.
Fixes https://github.com/dart-lang/sdk/issues/42482

Change-Id: I284a5673e30f59b127e69c712df93552cdfcde41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154834
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-07-21 19:29:15 +00:00
Paul Berry eae54cf02c Fix reachability logic for expression types.
Previously, we considered an expression unreachable if its type was
exactly `Never`.  This CL switches to using TypeSystem.isBottom, which
correctly handles types like `T extends Never`.

Change-Id: Ia6ce580caab6bc7ce7cceb1d0097b50f1da88f8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154746
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-07-21 18:56:25 +00:00
Ben Konyi 157ebfe50f Reland "[ VM / DartDev ] Launch DartDev in an isolate within a single main Dart process"
This reverts commit 7e373831ce.

Change-Id: Ib94d793a5753ec6352cd9a65e35f726a63336368
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154830
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-07-21 16:23:18 +00:00
Johnni Winther 1dab58697c Fix number operator tests
Change-Id: I082a33b023e574e96e57a0ea28bb8eab98a802b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155127
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-21 15:27:08 +00:00
Tess Strickland bb24f76c72 [vm] Reland "Remove non-covariant checks from closure bodies (part 1)"
Also relands the followup CLs:
"Perform non-covariant checks when dynamically invoking callables."
"Use AreValidArguments so that names are checked as well."

Original description of first CL:

This change only affects compilation when running in non-precompiled
mode with --no-lazy-dispatchers enabled.

Instead of always compiling in non-covariant checks, even for closures
not called dynamically, remove the non-covariant checks from the closure
and instead do the non-covariant checks for dynamic calls during the
NoSuchMethodForCallStub fallback by calling
Function::DoArgumentTypesMatch.

Adds two overloads for Function::DoArgumentTypesMatch, one which takes a
function type argument vector and one which takes neither an
instantiator type argument vector or a function type argument vector.
For the versions that are not explicitly passed a type argument vector,
an appropriate one is constructed using the arguments. If there is not
enough information in the arguments, then we fall back to assuming the
empty type argument vector for the instantiator case and instantiating
to bounds in the function type argument case.

Fixes Function::DoArgumentTypesMatch to handle generic functions and to
check arguments appropriately according to the active null safety mode.
For generic functions, the provided or resulting function type vector
has non-covariant checks performed against the type parameter bounds.

This change uncovered one test that was incorrectly passing in strong
mode, see https://github.com/dart-lang/sdk/issues/42688 for details.

Original description of second CL:

The VM only does this when the callable function does not expect dynamic
invocations. Otherwise, performing the checks would be redundant, as the
function body already contains the appropriate non-covariant checks.

Third CL had no additional description.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-debug-x64-try,vm-dartkb-linux-release-x64-try,vm-kernel-reload-linux-release-x64-try, vm-kernel-reload-rollback-linux-debug-x64-try
Bug: https://github.com/dart-lang/sdk/issues/40813
Change-Id: I1a3e9c1865103a8d716e1cad814267caffaaadf2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154688
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-21 10:00:41 +00:00
Konstantin Shcheglov 86ec742832 Switch to new Scope(s).
No much changes to resolution itself, only to the way how we create
scopes. But we still use `lookupIdentifier` that is basically the old
approach to resolution.

This also moves the fix of https://github.com/dart-lang/sdk/issues/42620
to TypeNameResolver.

I will continue improving in following CLs.

Change-Id: I89bae5afe0a7978aba9fe9bf7c8bf08fb59b1440
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154920
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-07-21 01:37:34 +00:00
Alexander Markov f53449421d [tests/nnbd] Fix language/vm/bool_check_stack_traces_test for NNBD weak mode
In weak mode using null in a bool condition results in AssertionError.
In strong mode it results in TypeError (as it is casted to non-nullable
bool).

Test language/vm/bool_check_stack_traces_test is adjusted to account for
both behaviors.

Change-Id: I9c08cf917fb2782dbc6316c5a11cf69003622452
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/155041
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-20 20:47:11 +00:00
Srujan Gaddam 7c40665f91 [package:js] Add static errors for named parameters and tests
Adds error for named params in JS interop functions, static error
tests, and removes redundant code from dart2js.

Change-Id: Ie16ebdd7a816983c1250579ea346e31e77227112
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154752
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-07-20 20:27:07 +00:00
Joshua Litt 3786c32753 [dart2js] Port ~20 tests to nnbd #4.
Change-Id: Id4bd09e9f00e6a5ea9c2bbd537c853c9a0862623
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152616
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2020-07-20 18:03:51 +00:00
Paul Berry ded9b3ce3f Flow analysis: consider promotion to Never to be unreachable.
Fixes #41981.

Bug: https://github.com/dart-lang/sdk/issues/41981
Change-Id: Id2ce176c703cb3346d4bd7471b10ecac9e3b9907
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154624
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-07-20 16:17:57 +00:00
Lasse Reichstein Holst Nielsen c894edca89 Update number operator tests to simpler rules.
Change-Id: Iec4eeda564923c542e9881774f988d5a0b5f46c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154880
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2020-07-20 16:01:17 +00:00
Johnni Winther 87906e832b [cfe] Implemenet abstract fields errors
Change-Id: I78900228ee72d914844e9fe11fcfb2cdef952ece
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154881
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-20 12:05:54 +00:00
Erik Ernst bf814cfe61 Add test for null spread element typing with null-safety
A spread element in a collection literal, e.g., `[...e]` or `{...?e}`,
can have an `e` of type `Null` or a subtype thereof. This CL adds a test
where this situation is created for different types (`Null`, `Never`,
`X extends Null`) with different collection literals, and with and
without elements of other types. In general, the spread does not
contribute any elements, and hence the element/key/value type is `Never`
such that it has no effect on the element/key/value type of the
collection.

Cf. https://github.com/dart-lang/language/pull/1079.

Change-Id: Ib760bcba18045b1afaa50f65c0e7d0a7fe9a8ab6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154693
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-07-20 08:06:44 +00:00
Sam Rawlins bbe6bb9823 Analyzer: Improve generator return error messages
Fixes https://github.com/dart-lang/sdk/issues/27468

In addition convert both ILLEGAL_ASYNC_GENERATOR_RETURN_TYPE and
ILLEGAL_SYNC_GENERATOR_RETURN_TYPE to CompileTimeErrorCodes.

Change-Id: I5f09f3d77dad52b4ba524c86b3e07ac5fac905fd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154824
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2020-07-18 15:28:06 +00:00
Alexander Markov c5a6ead5a1 [tests/nnbd] Update tests/standalone/package/scenarios for strong mode
Strong mode requires package_config.json to opt-in packages, so
.dart_tool/package_config.json was added for tests which used .packages
file before.

Certain tests for handling custom foo.packages file were marked
to run only in weak mode (as package_config.json would supersede
custom .packages files).

Finally, certain tests were converted to multi-tests with expected
compile-time errors to reduce number of failing tests (compile-time
error was an expected behavior for those tests, just not reflected
in the test sources).

Change-Id: Id5a3140ee033c115221b2f4a0b12adf40b6de415
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154831
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-18 03:25:40 +00:00
Alexander Markov 0ea5612753 [tests/nnbd] Fix tests/language/lazy/static8_test
This test exercises recursive static field initialization.
Under the new language semantics all static fields are implicitly late,
The test was using 'final' fields, which can be initialized only once,
but the test attempted to initialize those fields multiple times
during recursive invocation. This results in LateInitializationError.

So the test is updated to use non-final fields which allow
multiple writes.

Relevant paragraph from the spec:

Let D be a late and final local variable declaration named v. It is a run-time error, throwing an instance of LateInitializationError, to assign a value to v if a value has previously been assigned to v.
Note that this includes the implicit initializing writes induced by evaluating the initializer during a read.

Change-Id: I577cb9d189c1e6975ea5f21fab64d5b1204315d8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154823
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2020-07-17 20:27:07 +00:00
Ryan Macnak c5a94db091 [vm] Initial implementation of deferred loading.
(Assignment of libraries to loading units is already done in the kernel generation step.)

After compiling and before serializing, we walk the program and for each Code we assign its Instructions, CodeSourceMap and CompressedStackMap to the loading unit of that Code's defining library. Deduplication may cause Instructions, CodeSourceMaps and CompressedStackMaps to belong to more than one loading unit; in this case the objects are assigned to the root loading unit. Later they can be more precisely assigned to the dominating loading unit.

All objects except some Instructions, CodeSourceMaps and CompressedStackMaps belong to the root loading unit's snapshot. This snapshot is written like an unsplit snapshot, except that when serializing Code, we will write a reference to a stub or null when the Code's Instructions, CodeSourceMap or CompressedStackMap belongs to a non-root loading unit. The snapshots of non-root loading units contain these deferred objects and references to the corresponding Code objects to patch. The types of objects we defer (Instructions, CodeSourceMaps and CompressedStackMaps) usually represent 70+% of the snapshot size.

Bare instructions mode must be disabled when splitting because we cannot have PC-relative calls between loading units. Later we can re-enable this for calls within loading units.

Broken: Compactor probably crashes we can now have an unbounded number of image pages and the compactor assumes a fixed number.

Embedder's guide:

At compile-time, gen_snapshot should be passed --loading_unit_manifest with a path, which will enable splitting and output a mapping from loading unit ids to snapshot output paths.

At runtime, sometime during isolate startup, an embedder should call Dart_SetDeferredLoadHandler, probably near an existing call to Dart_SetLibraryTagHandler. The callback is given a loading unit id, and should eventually call Dart_DeferredLoadComplete[Error].

Bug: https://github.com/dart-lang/sdk/issues/41974
Change-Id: Ib597eb87c8cd634416d5ee1f00629c5550aebb00
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152427
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2020-07-17 19:29:47 +00:00
Erik Ernst 7c66851efe Adjust external_fields_test to expect specified outcome
Change-Id: Ie90ad6b1bb98930bb803c64ca2b7037681a88857
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154690
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-07-17 17:51:46 +00:00
Nicholas Shahan d933cc61e5 [test/status] Skip built_in_type_annotation_test on all backends
This test looks like it is intended for the analyzer/CFE only.
Since it is a multi-test there are hundreds of tests being run on
all backends with the exact same results on every CI and CQ run.

The structure and the nature of cascading errors from some of the
keywords means this test isn't easily adaptable to a static error
test.

Change-Id: Ida842051982cbb0a59caec45b28bca993d0edc2a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154751
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-07-17 16:32:55 +00:00
Konstantin Shcheglov 7d3252800b Infer void return type for FunctionExpression.
https://github.com/dart-lang/language/pull/1092

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

Change-Id: I7ce44a066382c63e22debbcb652a717b5230b267
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154620
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2020-07-17 16:03:00 +00:00
Alexander Aprelev 7e373831ce Revert "Reland "[ VM / DartDev ] Launch DartDev in an isolate within a single main Dart process""
This reverts commit bc4cb123a8.

Reason for revert: breaks crossword simarm tests https://ci.chromium.org/p/dart/builders/ci.sandbox/vm-kernel-precomp-linux-debug-simarm_x64/2619

Original change's description:
> Reland "[ VM / DartDev ] Launch DartDev in an isolate within a single main Dart process"
> 
> This CL changes how DartDev is run and how the run command handles executing a Dart program (will port additional commands in a separate CL). Rather than using DartDev to spawn a child process to run user code, the VM will instead launch a DartDev isolate after doing some VM options processing. DartDev will communicate information like exit codes and script/arg pairs with the VM via isolate ports. Once DartDev runs to completion and notifies the VM that a script should be run, the VM will move on to spawning another isolate with user code and continue executing in the same VM process.
> 
> By moving DartDev into an isolate within the same process that user code will eventually run in we're able to resolve the following issues that arose due to signal handling and IPC issues:
> 
> VM hangs when --enable-vm-service is supplied and there are compile time errors (https://github.com/dart-lang/sdk/issues/42630)
> Dart daemon spinning in exit code handler / zombie Dart processes (https://github.com/dart-lang/sdk/issues/41978)
> Signal handling in children of 'dartdev run' is problematic (https://github.com/dart-lang/sdk/issues/42092)
> 
> This reverts commit 3849b5061c.
> 
> Change-Id: I4fd3ba33840771a9f284d733c4a25fac6cde64ca
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154706
> Reviewed-by: Siva Annamalai <asiva@google.com>

TBR=bkonyi@google.com,asiva@google.com

Change-Id: I649d94c668417f2edbfd7039fa5c876e10dc32fe
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154800
Reviewed-by: Alexander Aprelev <aam@google.com>
2020-07-17 04:37:48 +00:00
Ben Konyi bc4cb123a8 Reland "[ VM / DartDev ] Launch DartDev in an isolate within a single main Dart process"
This CL changes how DartDev is run and how the run command handles executing a Dart program (will port additional commands in a separate CL). Rather than using DartDev to spawn a child process to run user code, the VM will instead launch a DartDev isolate after doing some VM options processing. DartDev will communicate information like exit codes and script/arg pairs with the VM via isolate ports. Once DartDev runs to completion and notifies the VM that a script should be run, the VM will move on to spawning another isolate with user code and continue executing in the same VM process.

By moving DartDev into an isolate within the same process that user code will eventually run in we're able to resolve the following issues that arose due to signal handling and IPC issues:

VM hangs when --enable-vm-service is supplied and there are compile time errors (https://github.com/dart-lang/sdk/issues/42630)
Dart daemon spinning in exit code handler / zombie Dart processes (https://github.com/dart-lang/sdk/issues/41978)
Signal handling in children of 'dartdev run' is problematic (https://github.com/dart-lang/sdk/issues/42092)

This reverts commit 3849b5061c.

Change-Id: I4fd3ba33840771a9f284d733c4a25fac6cde64ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154706
Reviewed-by: Siva Annamalai <asiva@google.com>
2020-07-17 00:54:11 +00:00
Alexander Aprelev d6eb87bbcc Revert "[vm] Remove non-covariant checks from closure bodies (part 1)" as it broke language_2/vm/no_such_args_error_message_vm_test.
This reverts commit 556f0fb5c8 and fixes merge conflict.

Revert "[vm] Perform non-covariant checks when dynamically invoking callables." as a collateral.

This reverts commit 7a6287bb92.

Revert "[vm] Use AreValidArguments so that names are checked as well." as a collateral

This reverts commit 90c683018f.

Change-Id: Iee2c5e91c39d19dca7a1e640c103443c95e6c4f9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154705
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2020-07-16 23:25:54 +00:00
Ben Konyi 3849b5061c Revert "[ VM / DartDev ] Launch DartDev in an isolate within a single main Dart process"
This reverts commit ffe258d2d4.

Reason for revert: Failures on bots

Original change's description:
> [ VM / DartDev ] Launch DartDev in an isolate within a single main Dart process
> 
> This CL changes how DartDev is run and how the run command handles executing a Dart program (will port additional commands in a separate CL). Rather than using DartDev to spawn a child process to run user code, the VM will instead launch a DartDev isolate after doing some VM options processing. DartDev will communicate information like exit codes and script/arg pairs with the VM via isolate ports. Once DartDev runs to completion and notifies the VM that a script should be run, the VM will move on to spawning another isolate with user code and continue executing in the same VM process.
> 
> By moving DartDev into an isolate within the same process that user code will eventually run in we're able to resolve the following issues that arose due to signal handling and IPC issues:
> 
> VM hangs when --enable-vm-service is supplied and there are compile time errors (https://github.com/dart-lang/sdk/issues/42630)
> Dart daemon spinning in exit code handler / zombie Dart processes (https://github.com/dart-lang/sdk/issues/41978)
> Signal handling in children of 'dartdev run' is problematic (https://github.com/dart-lang/sdk/issues/41978)
> 
> Change-Id: I1c6b1425831b691ad20284716aa80f817dbaf607
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152588
> Commit-Queue: Ben Konyi <bkonyi@google.com>
> Reviewed-by: Siva Annamalai <asiva@google.com>
> Reviewed-by: Ryan Macnak <rmacnak@google.com>

TBR=bkonyi@google.com,rmacnak@google.com,asiva@google.com

Change-Id: Idb1d24a4524bdc3ccfb199a82710f3c0d9db539a
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154702
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2020-07-16 19:50:57 +00:00
Ben Konyi ffe258d2d4 [ VM / DartDev ] Launch DartDev in an isolate within a single main Dart process
This CL changes how DartDev is run and how the run command handles executing a Dart program (will port additional commands in a separate CL). Rather than using DartDev to spawn a child process to run user code, the VM will instead launch a DartDev isolate after doing some VM options processing. DartDev will communicate information like exit codes and script/arg pairs with the VM via isolate ports. Once DartDev runs to completion and notifies the VM that a script should be run, the VM will move on to spawning another isolate with user code and continue executing in the same VM process.

By moving DartDev into an isolate within the same process that user code will eventually run in we're able to resolve the following issues that arose due to signal handling and IPC issues:

VM hangs when --enable-vm-service is supplied and there are compile time errors (https://github.com/dart-lang/sdk/issues/42630)
Dart daemon spinning in exit code handler / zombie Dart processes (https://github.com/dart-lang/sdk/issues/41978)
Signal handling in children of 'dartdev run' is problematic (https://github.com/dart-lang/sdk/issues/41978)

Change-Id: I1c6b1425831b691ad20284716aa80f817dbaf607
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152588
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-07-16 19:03:24 +00:00
Tess Strickland 556f0fb5c8 [vm] Remove non-covariant checks from closure bodies (part 1)
This change only affects compilation when running in non-precompiled
mode with --no-lazy-dispatchers enabled.

Instead of always compiling in non-covariant checks, even for closures
not called dynamically, remove the non-covariant checks from the closure
and instead do the non-covariant checks for dynamic calls during the
NoSuchMethodForCallStub fallback by calling
Function::DoArgumentTypesMatch.

Adds two overloads for Function::DoArgumentTypesMatch, one which takes a
function type argument vector and one which takes neither an
instantiator type argument vector or a function type argument vector.
For the versions that are not explicitly passed a type argument vector,
an appropriate one is constructed using the arguments. If there is not
enough information in the arguments, then we fall back to assuming the
empty type argument vector for the instantiator case and instantiating
to bounds in the function type argument case.

Fixes Function::DoArgumentTypesMatch to handle generic functions and to
check arguments appropriately according to the active null safety mode.
For generic functions, the provided or resulting function type vector
has non-covariant checks performed against the type parameter bounds.

This change uncovered one test that was incorrectly passing in strong
mode, see https://github.com/dart-lang/sdk/issues/42688 for details.

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-linux-release-x64-try,vm-dartkb-linux-release-x64-try
Change-Id: I5030a46b356778448b51a243f16406eacf1c04bf
Bug: https://github.com/dart-lang/sdk/issues/40813
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153202
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Régis Crelier <regis@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2020-07-16 14:54:04 +00:00
Erik Ernst c326744224 Adjust language tests cf. #1092 ("void from context")
Change-Id: I62d8ff458bef5903b69827de140490790c4f529c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154661
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-07-16 14:30:53 +00:00
Erik Ernst 4743211d04 Add new tests, cf. #1060 (void generators)
Change-Id: I7a2bcc85731e426c6d0073d65c06878f917d6627
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154681
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2020-07-16 14:07:13 +00:00
Erik Ernst dc7c947a9c Add/change tests to cover new compile-time errors
Cf. spec update in https://github.com/dart-lang/language/pull/1083.

Change-Id: I99675cf761bfeacf4fd5a971380c548cc4997852
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153963
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
2020-07-16 11:17:33 +00:00
Johnni Winther 92f4eb58c8 [cfe] Support abstract fields
Only positive implementation, no error states are checked yet.

Change-Id: Iad79da1dd7e8be9229ee9d47c5301d39ebc3debc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154003
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2020-07-16 10:13:23 +00:00
Sigmund Cherem c632a629ff [web] remove mirrors patch for web compilers.
This makes both compilers report a compile-time error when importing dart:mirrors.

Change-Id: I23360b87ee31fba36fe7c111cee1987aa2d50638
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154622
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2020-07-16 00:12:22 +00:00
Joshua Litt 200dede184 [dart2js] Port ~20 tests to nnbd #3.
Change-Id: I8ff8f20dd699fa6cdc4b61d6fd499d0583cb3cb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152613
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-07-15 21:50:10 +00:00
Ryan Macnak 51d3fae7d3 Revert "Move BytesBuilder class and implementation to dart:typed_data."
This reverts commit 084f9faf81.

Reason for revert: Breaks ABI without relevant version updates 

Original change's description:
> Move `BytesBuilder` class and implementation to `dart:typed_data`.
> 
> Change-Id: I3e66e61940a1060e4970427799e0d8ebdaebb310
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150523
> Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
> Reviewed-by: Nate Bosch <nbosch@google.com>

TBR=lrn@google.com,nbosch@google.com

Change-Id: I2b79063b7ff70de7ce039283a10d56460594a6ab
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154563
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2020-07-15 21:35:35 +00:00
Lasse Reichstein Holst Nielsen 084f9faf81 Move BytesBuilder class and implementation to dart:typed_data.
Change-Id: I3e66e61940a1060e4970427799e0d8ebdaebb310
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/150523
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2020-07-15 15:09:14 +00:00
Robert Nystrom e314030e1f Fix list tests to not set length on non-nullable lists.
The fixes to list_concurrent_modify_test are I think correct and
preserve the intent of the test. The changes to list_test get the test
working correctly and preserve the intent of the test but are
workarounds that shouldn't be needed once #42496 is fixed.

Change-Id: I82b32b2256b9940ceb934fb0f628311b8e7c6567
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152988
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
2020-07-15 00:45:43 +00:00
Nicholas Shahan 1332cf8c41 [ddc] Migrate tests in dartdevc suite
Change-Id: I2a35de7f79b8d768cdd0144b3bf5de87fa929942
Issue: https://github.com/dart-lang/sdk/issues/42107
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154301
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
2020-07-15 00:16:03 +00:00
Nicholas Shahan 461d01cd80 [ddc] Fix variance test migration to null safety
Change-Id: I5f6e446c72ae1a41d92f419eb57a8dd030a70372
Issue: https://github.com/dart-lang/sdk/issues/42107
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154292
Reviewed-by: Leaf Petersen <leafp@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-07-15 00:15:23 +00:00
Srujan Gaddam 63a57a76ce [dart:html] Revert "[dart:html] Revert commits using MDN compatibility info"
This reverts commit f8ff12008e.

This CL is a revert of the initial revert and should be landed once
Flutter changes have been merged to handle the changes here.

Change-Id: I300a5efd776bf2a596743971f4e15ad62da77f5a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153368
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-07-14 23:18:43 +00:00
Joshua Litt cfeb1d647a [dart2js] Port some tests to nnbd #5.
Change-Id: Ic9912d94e1248df70a92e2504af87d42d5ca0528
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152617
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-07-14 20:02:02 +00:00
Joshua Litt 7df03a752c [dart2js] Port ~20 tests to nnbd #2.
Change-Id: Iff3074c7882a4f8418f854424c6133b5a53bee4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152609
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2020-07-14 19:04:30 +00:00
Nicholas Shahan fdf4e364bf [test_runner] Use sound null safety js files
The bootstrapping was still loading the wrong version of the sdk and
pre-compiled packages when running tests for DDC.

Update constant_null_safety_mode_test to test a constant that is
defined within the sdk itself in addition to one defined in the test.

Change-Id: I8938ed92d866cfca0ce42567f03bed5f3dd9f10c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154121
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-07-13 20:09:28 +00:00
Nicholas Shahan cd9a206d55 [tests] Fix type of stream getter in test
The focus event stream is typed to be non-nullable. Updated the
return of the function passed to reduce in the "_2" version as
well to keep them consistent.

Change-Id: Ic1ae2e027c184d751549c989d60924360139fd5c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/154140
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2020-07-13 18:26:19 +00:00
Paul Berry 6547f741b6 Add language tests illustrating issue #42603.
Bug: https://github.com/dart-lang/sdk/issues/42603
Change-Id: I1d59b7b65d77e5f1accb4f9c3c99e92e48ffb364
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153709
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2020-07-13 18:12:39 +00:00
Srujan Gaddam 0e25306d3f [package:js] Add test for is checks and as casts
Adds tests for type checks and casts using JS classes and object
literals. Checks typing between different classes, same classes,
object literals, subtypes, and dynamic conversions.

Change-Id: I01c384395f0e6c8d671ac9bd0dc6e6905845a760
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/152990
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2020-07-10 21:01:47 +00:00
Paul Berry b91ff153c1 Test various exceptions to variables being considered definitely unassigned.
There are several scenarios in which the flow analysis implementation
needs to be careful to mark variables as "not definitely unassigned",
even though they are not definitely assigned.  These scenarios are
handled by the implementation but not yet properly spec'ed.  Prior to
updating the spec, I wanted to make sure we had adequate test cases.

Change-Id: Id3f82279e0686f9cccfabd834396f05b8b28bcab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153825
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2020-07-10 20:14:16 +00:00
Johnni Winther 27446b463e [cfe] Update test expectation for language/unsorted/flatten_test/12
+ use the inferred return type in error reporting when no return type is
declared. This turned up in this particular case where we report an
error between the returned value and the inferred return type.

Closes #42546

Change-Id: I48da24047f2e92ca91a514dfcb43c2ba6f65ee46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153610
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2020-07-10 07:01:18 +00:00
Paul Berry 9f8aaf65c7 Issue an error if a prefix in a type name is shadowed by a local variable.
See #42620.

Change-Id: Ifd18c939082935390df0c2aa0bd724cf6f76c27c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/153705
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2020-07-09 23:09:18 +00:00