Commit graph

81546 commits

Author SHA1 Message Date
Ryan Macnak 70e3178215 [standalone] Set the process title based on the main script.
This makes it easier to identify the responsible program when a Dart process has high CPU or memory usage.

TEST=look at top
Change-Id: I0bf9e2f5c81aa82a4721b177b8db2bb6bf3fb002
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211303
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-08-31 19:33:10 +00:00
Johnni Winther c321301564 [dart2js] Handle nested type variables in type literals
dart2js previously assumed that type variables could only occur
at the root of type literals. With the constructo tear offs feature
type literals like `C<T>` are allowed, requiring a check for nested
type variables to determine whether a type literal can be encoded
as a constant.

Fixes the crashes in

  language/type_object/explicit_instantiated_type_literal_test
  language/typedef/aliased_type_literal_instantiation_test

Change-Id: I0fbd2f9ea3a96ab6db70f98b8d8af1b24c950070
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211902
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-08-31 18:01:00 +00:00
Danny Tuppeny 88a41363bc [analyzer] Support generic type aliases in available declarations
Fixes https://github.com/dart-lang/sdk/issues/46409.

Change-Id: I16fe47f52254956e58cb5f034c49e1d8fa4c22c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/204403
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-31 17:35:04 +00:00
Danny Tuppeny 03c525cc41 [analysis_server] Terminate in-process pub commands at shutdown
May fix "The process cannot access the file because it is being used by another process" on Windows bots when tests are trying to clean up while the pub process was running.

Change-Id: I1f3ed0a404d27e2769887e6d33c94cf9b3614092
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/209680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-31 17:35:01 +00:00
Joshua Litt c13954e29c [dart2js] Remove '_shouldAddDeferredDependency'.
Change-Id: I5be02f5a1ed2c1fea41819b529e9127d643964e1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208482
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-08-31 17:21:50 +00:00
Danny Tuppeny 7bc6c7ac39 [analysis_server] Map ENUM_CONSTANT to EnumMember in LSP if supported
Change-Id: Iecbb5e61bb580091e9ada709aa38042f3dbc7a19
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211906
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-31 17:12:13 +00:00
Danny Tuppeny f9db0dd6aa [analysis_server] Use "final" instead of "var" for assign_to_local_variable when prefer_final_locals is enabled
Fixes https://github.com/Dart-Code/Dart-Code/issues/3542.

Change-Id: I341d2de0620be726b756ec38b015632b64b202b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211905
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-31 16:51:11 +00:00
Erik Ernst 65b5125223 Add item in CHANGELOG.md about relaxed constant factory constructor rule
Change-Id: Ia4a9ffa1b4e27abcea66dca985d099f9fef75790
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211400
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: Michael Thomsen <mit@google.com>
2021-08-31 15:09:40 +00:00
Lasse R.H. Nielsen ed3824a220 Tweaks, refactoring and updates on DoubleLinkedQueue.
It's a badly designed class, but this change makes it slightly better.
(We should consider moving it to package:collection and removing it from
the platform libraries. Eventually.)

The changes decouples the public `DoubleLinkedQueueEntry` class from
the actual queue implementation classes, avoiding the latter having
to share a generic `_Link<DoubleLinkedQueueEntry>` interface
which would force them to do otherwise unnecessary casts.

The public class should have been abstract, but isn't.
It's mainly used as the API of the entries exposed by DoubleLinkedQueue,
but it can also be used by itself to build double-linked lists that are
not part of a Queue, and the class can be extended.
If anyone does either, it should keep working, so it needs to be a concrete,
self-contained class with a generative constructor.

That class is moved to dart:_internal to avoid its private
implementation fields from interfering with the queue implementation classes,
which have similar fields, but can now have them at different types.
That's a hack, but it works.

The internal implementation of the DoubleLinkedQueue and its entries
are updated to better follow current programming idioms, and avoids
having fields on classes which don't need them.

Also fixes #27920
(`clear`ing a list now detaches each entry from the list so later `.contains`
won't give the wrong answer).

And moves queue tests from tests/corelib to tests/lib/collection,
since Queue isn't exposed by `dart:core`.

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

Change-Id: Ia3bb340a75886de160cc0e449947e8e7ee587061
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211265
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-08-31 12:44:39 +00:00
Johnni Winther 54ae35250c [cfe] Use explicit language version in incremental test
This prepares for the expiration of the extension-method, non-nullable,
and nonfunction-type-aliases experiments in
https://dart-review.googlesource.com/c/sdk/+/211443

Included in the CL is a fix to isExperimentEnabled,
isExperimentEnabledInLibrary, and isExperimentEnabledInLibraryByVersion
method, so that these don't overwrite enabled/disabled experiments
with the default value when flags are expired, which would otherwise
disallow library from opting out of features using its language version.

Change-Id: Ib9668afcecc2247dd54d885d4a551638d6e7d59d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211900
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-31 10:38:38 +00:00
Alexander Thomas 8df427f5dd [co19] Roll co19 to cc4df792d0f02f15bfe04911c1f856b90cb7cbf4
2021-08-31 sgrekhov@unipro.ru Fixes 1177. Tests updated to expect compile errors according to the new behaviour
2021-08-31 sgrekhov@unipro.ru 1176. Roll failures fixed
2021-08-30 irina.arkhipets@gmail.com Issue 1172: --enable-experiment=constructor-tearoffs option returned back.
2021-08-30 sgrekhov@unipro.ru Fixes 1173. Resolving ambiguities tests were changed according to the new specification
2021-08-30 irina.arkhipets@gmail.com Fixes 1176: regression tests updated
2021-08-30 irina.arkhipets@gmail.com Fixes 1172: useless execution directives removed.
2021-08-30 sgrekhov@unipro.ru Fixes 1175. Use braces to get type literal
2021-08-26 sgrekhov@unipro.ru Rename some tests to follow test runner pattern
2021-08-25 sgrekhov@unipro.ru Fixes 1171. Expected CFE error messages updated
2021-08-25 irina.arkhipets@gmail.com Fixes 1170: tests re-named.
2021-08-25 sgrekhov@unipro.ru Fixes 1167. Fix checking for object's Type
2021-08-24 sgrekhov@unipro.ru 1169. Change error expectation for CFE according to the new behaviour
2021-08-23 sgrekhov@unipro.ru Fixes 1137. Add dependence "OtherResource" for the dependend library and chack AOT case
2021-08-20 irina.arkhipets@gmail.com Fixes 1166: test updated so that they check that function invocation cannot be constant. New tests added.
2021-08-19 irina.arkhipets@gmail.com Fixes 1168: test corrected to check syntax errors properly.
2021-08-19 irina.arkhipets@gmail.com Fixes 1167: existing test for abstract class updated, added new test for the custom generic class.
2021-08-17 irina.arkhipets@gmail.com Issue 1158: Language/Expressions/Numbers test splitted to web and non-web ones. Non-web ones should be excluded for dart2js in status files.
2021-08-17 irina.arkhipets@gmail.com Issue 1158: Some tests splitted to web and non-web ones. Non-web ones should be excluded for dart2js in status files.
2021-08-16 irina.arkhipets@gmail.com Fixes 1164: Got rid of toInt32, toInt16, toInt8 functions.
2021-08-13 sgrekhov@unipro.ru Fixes 1162.Wait for entryPoint is invoked before doing the test
2021-08-13 sgrekhov@unipro.ru 1138. Roll failures fixed and issue numbers added
2021-08-13 sgrekhov@unipro.ru Fixes 1161. Fix tests to be able to work without sound null safety
2021-08-13 sgrekhov@unipro.ru Fixes 1160. Fix tear-offs types in test expectations
2021-08-13 sgrekhov@unipro.ru Fixes 1159. Fix test expectations
2021-08-13 sgrekhov@unipro.ru Fixes 1155. Wrong tests deleted
2021-08-13 sgrekhov@unipro.ru Fixes 1154. Expect a compile-time error for 'C.new<int>' instead of syntax error
2021-08-13 sgrekhov@unipro.ru Fixes 1154. Expect a compile-time error for 'List.filled<int>' instead of syntax error
2021-08-13 sgrekhov@unipro.ru Fixes 1151. Use constants to tear-off constant constructors
2021-08-13 sgrekhov@unipro.ru Fixes 1153. Use (List<int>).toString() instead of List<int>.toString()
2021-08-13 sgrekhov@unipro.ru Fixes 1152. Fix typos in summary_A02_t01 test
2021-08-13 sgrekhov@unipro.ru Fixes 1150. Fix typo in parameter name
2021-08-13 sgrekhov@unipro.ru Fixes 1149. Fix named constructor tests to not to try to tear-off from Type
2021-08-13 sgrekhov@unipro.ru Fixes 1148. Expect errors for tear-off that violate bounds
2021-08-13 sgrekhov@unipro.ru Fixes 1147. Make 'call' method to be generic one
2021-08-13 sgrekhov@unipro.ru Fixes 1146. Fix expected error location for CFE
2021-08-13 sgrekhov@unipro.ru Fixes 1145. Remove excessive wrong check

Cq-Include-Trybots: dart/try:analyzer-nnbd-linux-release-try,dart2js-nnbd-linux-x64-chrome-try,ddc-nnbd-linux-release-chrome-try,front-end-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: I0ead022e41a63573e1d3a61b42fd9c4d9ca86fdb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211903
Reviewed-by: William Hesse <whesse@google.com>
2021-08-31 10:32:59 +00:00
Daco Harkes b294fe59f9 [vm/gardening] Mark bigint_parse_radix_test/3 as slow
Bug: https://github.com/dart-lang/sdk/issues/47050

Change-Id: Ia0496785c5df6c231269ae4ebbb4376beb3a63d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211904
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2021-08-31 09:56:50 +00:00
Ryan Macnak 8f9113d9f1 [vm, gc] Try to handle virtual memory limitations on iOS.
iOS appears not to allow any single virtual memory allocation to exceed ~700MB.
iOS appears to limit the total amount of allocated virtual memory to amount of physical memory available, even virtual memory that is reserved by not committed.

So instead of trying to allocate the full 4GB region for compressed pointer, allocate the largest power-of-two that succeeds, and speculate that further allocations to into the same 4GB region.

TEST=none
Change-Id: Ib45f7ece59e1adb96d175ae861b984c0c6737549
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210640
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-08-31 00:10:08 +00:00
Ryan Macnak 6433038907 [vm] Use stricter checks when deciding to keep a switchable call in the monomorphic state.
- Don't stay in the monomorphic state if the corresponding ICData is no longer monomorphic, even if the call site itself encountered the same CID as before.
 - Don't assume the ICData's entries array hasn't been replaced.

TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/47010
Change-Id: I00f59eb59ed52e21bd638fec876accda42db0e2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211464
Reviewed-by: Alexander Aprelev <aam@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2021-08-30 22:53:37 +00:00
Ryan Macnak 93d111d92d [vm, compiler] Add missing deopt info to CheckNullInstr.
TEST=ci
Bug: https://github.com/dart-lang/sdk/issues/46790
Bug: https://github.com/dart-lang/sdk/issues/47044
Change-Id: I6f4fc095ddb7701c9b61434d85839cb6d5dccc1b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/208687
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-08-30 22:00:57 +00:00
Brian Wilkerson c8b5446886 Improve the highlight range for unnecessary_question_mark
Change-Id: I789a49af697bab52b7a104c7976f33855af1b530
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211740
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-30 21:10:47 +00:00
Ryan Macnak be9bb43ceb [standalone] Don't sort classes in isolates loaded from app snapshots.
Sorting classes causes all generated code to be discarded because it may invalidate embedded CIDs. For the kernel-service in particular, this results in a significant slowdown. These classes were already sorted when the snapshot was generated.

TEST=ci
Change-Id: Ice443718ec43ead88e69039a7c723856f4fd448c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211882
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2021-08-30 20:26:57 +00:00
Ben Konyi 127fcf872a [ VM ] Avoid pausing system isolates on start/shutdown
Can cause unexpected behavior when combined with
--mark-main-isolate-as-system-isolate

TEST=Confirmed main isolate used to pause on start and not output anything to console. Applied fix, sample ran to completion.

Change-Id: I355deaa7f30909b345f38c85ec5a7ccb358b43c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211881
Reviewed-by: Jaime Wren <jwren@google.com>
Reviewed-by: Jacob Richman <jacobr@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Commit-Queue: Jacob Richman <jacobr@google.com>
2021-08-30 19:07:27 +00:00
Konstantin Shcheglov 6382d1ab17 Issue 42425. Don't report CONST_SET_ELEMENT_TYPE_IMPLEMENTS_EQUALS in lists.
Bug: https://github.com/dart-lang/sdk/issues/42425
Change-Id: I20ff1f84f2808cbac9e62402bcfb81b068ad1692
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211880
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-30 18:56:17 +00:00
Brian Wilkerson 6e4678e150 Make the formatting of fix and assist constants consistent
I added commas and formatted. No other changes were made.

Change-Id: I5aacab204d2a36474ed1689a912ea61362764726
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211760
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-30 18:46:37 +00:00
Joshua Litt edca0fc1dc [dart2js] Add kernel transform to early clone mixin methods with super.
Change-Id: I7634d53da4464b5ec7b024826019e0528f9ef0e7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211520
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2021-08-30 18:09:27 +00:00
Johnni Winther 00f089550f [cfe] Add test for valid expressions that look like unresolved constructor invocations
Change-Id: I697acb7fbeb043f4b1be0e346f276dd96c202062
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211821
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-30 17:28:39 +00:00
Johnni Winther 868daa3d5f [cfe] Refactor IncompleteSendGenerator
Detaches IncompleteSendGenerator classes from the Generator hierarchy
and renames classes to Selector, InvocationSelector and PropertySelector.

Change-Id: Iac1759b1c7f1971fd8519136e70ec8630199204e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211445
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-30 17:27:09 +00:00
Johnni Winther 1556299acf [cfe] Handle redirecting factory invocation in metadata
Closes #47036

Change-Id: I2c482df3b2c5c9bdca672167d03c7d77563cb12f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211822
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-08-30 17:20:37 +00:00
Sam Rawlins 873ecfd8fd Suppress redundant tearoff errors when constructor tearoffs not enabled
Fixes https://github.com/dart-lang/sdk/issues/47035

Change-Id: I745da785d80744f84e3582727e423e4caed866c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-08-30 17:19:07 +00:00
Konstantin Shcheglov b12724b7c6 Issue 47026. Use simple subtype check for combining signatures.
Bug: https://github.com/dart-lang/sdk/issues/47026
Change-Id: Id6999e0eaab03ffa0caa63c97b708526d22a8d97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211605
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-30 16:38:39 +00:00
Konstantin Shcheglov ae41b91336 Use named parameters in ParameterElementImpl, make parameterKind required.
So, 'parameterKind' is never null.

Change-Id: Id5d17a3cfc9795d3dcec4b2f1e8bb5c372f339fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211607
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2021-08-30 16:23:17 +00:00
Tess Strickland a70ab07a47 Revert "[vm/compiler] Add more checks in TTSes for uninstantiated types."
This reverts commit 1016bbadde.

Reason for revert: Broken benchmarks on golem.

Original change's description:
> [vm/compiler] Add more checks in TTSes for uninstantiated types.
>
> In certain cases, optimized type testing stubs for uninstantiated types
> compare the instantiation of the type arguments for the type against the
> corresponding instance type arguments. Previously, only an identity
> check was generated, so the instantiation had to match the instance type
> argument exactly.
>
> This CL adds checks for the following cases:
> * The instantiated type argument is dynamic, void, or Object.
> * The instance type argument is Null or Never.
>
> When strong null safety is enabled, we also check that the the instance
> type argument is legacy or non-nullable when the instantiated type
> argument is non-nullable Object or that the instantiated type argument
> is nullable or legacy when the instance type argument is Null.
>
> This CL also adds handling for the case where the instantiated or
> instance type argument is not a Type, which is necessary for safely
> retrieving the type class id and nullability, and allocates some
> additional registers in TTSInternalRegs for storing type arguments. On
> ARM7, this requires pushes/pops around type argument checking, because
> we've run out of registers there.
>
> Fixes https://github.com/dart-lang/sdk/issues/40736
>
> TEST=vm/cc/TTS
>
> Bug: https://github.com/dart-lang/sdk/issues/46920
> Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try
> Change-Id: Ib8498fd2b9593b4abb92111f062ed2fc95a45c16
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210681
> Commit-Queue: Tess Strickland <sstrickl@google.com>
> Reviewed-by: Alexander Markov <alexmarkov@google.com>

TBR=kustermann@google.com,alexmarkov@google.com,sstrickl@google.com

Change-Id: I8c2368cbbb3d23aa2d0cb4788737d9b737318bb7
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Bug: https://github.com/dart-lang/sdk/issues/46920
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211860
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2021-08-30 15:51:40 +00:00
Sam Rawlins fb5526a247 analyzer: Report a function tearoff on a dynamic target
Change-Id: Id1d552ba80adf89d383b0467b23ae192ab5a9994
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211780
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-08-30 14:48:55 +00:00
Tess Strickland 1016bbadde [vm/compiler] Add more checks in TTSes for uninstantiated types.
In certain cases, optimized type testing stubs for uninstantiated types
compare the instantiation of the type arguments for the type against the
corresponding instance type arguments. Previously, only an identity
check was generated, so the instantiation had to match the instance type
argument exactly.

This CL adds checks for the following cases:
* The instantiated type argument is dynamic, void, or Object.
* The instance type argument is Null or Never.

When strong null safety is enabled, we also check that the the instance
type argument is legacy or non-nullable when the instantiated type
argument is non-nullable Object or that the instantiated type argument
is nullable or legacy when the instance type argument is Null.

This CL also adds handling for the case where the instantiated or
instance type argument is not a Type, which is necessary for safely
retrieving the type class id and nullability, and allocates some
additional registers in TTSInternalRegs for storing type arguments. On
ARM7, this requires pushes/pops around type argument checking, because
we've run out of registers there.

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

TEST=vm/cc/TTS

Bug: https://github.com/dart-lang/sdk/issues/46920
Cq-Include-Trybots: luci.dart.try:vm-kernel-linux-release-x64-try,vm-kernel-precomp-linux-release-x64-try,vm-kernel-precomp-nnbd-linux-release-x64-try,vm-kernel-nnbd-linux-release-x64-try,vm-kernel-linux-product-x64-try,vm-kernel-precomp-linux-product-x64-try,vm-kernel-linux-release-simarm-try,vm-kernel-linux-release-simarm64-try
Change-Id: Ib8498fd2b9593b4abb92111f062ed2fc95a45c16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210681
Commit-Queue: Tess Strickland <sstrickl@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-08-30 14:01:15 +00:00
Jens Johansen 5caa4365d7 [parser] Add beforeSynthetic to SyntheticStringToken
E.g. if reporting a missing ";" after a SyntheticStringToken (e.g. a
inserted identifier) before this CL it would go to the next token and
say we expected the ";" after that, when really we expected it *before*
that token.

Change-Id: I2c358e017edb2f661e307eba03dddaee889086d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/205799
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-08-30 11:56:30 +00:00
Stephen Adams c63c1e5cf7 Redo "[dart2js] Enable default constructor tear-off lowering"
Change-Id: I089d81c4d46a3782bb5cc1d2c18f29afde1a02b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211500
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2021-08-29 03:56:19 +00:00
Konstantin Shcheglov edc835fe4c Fix UNNECESSARY_TYPE_CHECK_TRUE in front_end/.
Fixes before https://dart-review.googlesource.com/c/sdk/+/190360

Change-Id: I4720a361a74032003b57bb27a6b9c283004e9a0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211602
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-08-28 17:19:28 +00:00
Konstantin Shcheglov aceeb00949 Report MACRO_EXECUTION_ERROR for FieldDeclarationMacro(s).
Change-Id: Iba37133872809b59a20adce496d136fd2d3806e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211606
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-28 16:15:10 +00:00
Paul Berry 080ed7a37f Consolidate flow analysis feature detection logic into FlowAnalysisHelper constructor.
This should reduce the risk of mistakes, since there are many call
sites that create FlowAnalysisHelper objects, and we would have subtle
bugs if the call sites disagreed about when certain pieces of flow
analysis logic should be enabled.

Change-Id: I2c58eebbe05724b231107a0681c9ea668f5d968f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211502
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-08-28 15:24:38 +00:00
Brian Wilkerson 57bb16a797 Improve the highlight region for not_binary_operator
Change-Id: I4fa27d566673c9792a3169a4fe2c0058d72be4a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211660
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2021-08-28 14:58:37 +00:00
Konstantin Shcheglov 915a5c37d9 Fix UNNECESSARY_TYPE_CHECK_TRUE in nnbd_migration/.
Fixes before https://dart-review.googlesource.com/c/sdk/+/190360

Change-Id: Ifeab0b605d681d30516f8bcae04728e673982a24
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211601
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-28 05:11:08 +00:00
Konstantin Shcheglov d3db821ae4 Fix null checks for AstNodeImpl.propertyMap
Change-Id: I2251d44668c26423c6d277108d0141c24a645611
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211610
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-27 23:59:58 +00:00
Konstantin Shcheglov 907be26614 Fix null checks in Reference.
Change-Id: I0d6d16da16cac5cd9b11f50ae522e508aa00dd91
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211609
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-27 23:18:57 +00:00
Konstantin Shcheglov 699c7d9e17 Fix a null check in ConstantVisitor.
Change-Id: Ie912e5249ac0735cb75d52e5290b04a50f7a29f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211608
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-27 23:02:51 +00:00
Konstantin Shcheglov 6ba07105f5 Fix UNNECESSARY_TYPE_CHECK_TRUE in analyzer/.
Fixes before https://dart-review.googlesource.com/c/sdk/+/190360

Change-Id: Ie46c57abc6d8e72ed0370a900296d0438758def3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211603
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2021-08-27 21:11:37 +00:00
asiva 06a471ce86 [VM/Runtime] - Return error instead of a FATAL error when failing to
communicate with the kernel isolate while accepting compilation results
during a hot reload.

TEST=reload bot tests.

Change-Id: I55f983cc8461c89e91bf1bef84f39dcda61e8142
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/210942
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-08-27 20:49:39 +00:00
Stephen Adams bad83f4b03 [dart2js] Run 'dart format' on some directories
Ran on these directories:
/constants
/diagnostics
/helpers
/io
/js
/util

Change-Id: I614a04003b399a34450b25775aafb7b75a147634
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211604
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2021-08-27 20:49:37 +00:00
Konstantin Shcheglov 3d8d29f03c Fix UNNECESSARY_TYPE_CHECK_TRUE in pkg/vm/.
Fixes before https://dart-review.googlesource.com/c/sdk/+/190360

Change-Id: I918189b0077bb4e397b6fb6dd4349960ff8c4560
TEST=ci
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211600
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2021-08-27 20:27:15 +00:00
Sam Rawlins 6e1829fd9f analyzer: constructor tearoffs can be const.
Fixes https://github.com/dart-lang/sdk/issues/46899

Also required fixing the dangling type parameters on
ConstructorElements, FunctionTypes and the returnType (an
InterfaceType) of the FunctionTypes. In the case of the
ConstructorElements, we just refer to the declaration.

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

To remove dangling type parameters, we set
`constructorName.type.type` to null for generic ConstructorReferences.
The idea is that this code is generic and the TypeName is not a proper
type. This requires a few changes to other code that expects
TypeName.type to be non-null.

Change-Id: Ie14344c5179922318ca746cbbdab13cf67b7432a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211304
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-08-27 19:16:37 +00:00
asiva bc387837c4 [VM/Runtime] Reland : Fix 'File' object leak in async file open operation
The 'File' object created in the async file open method is leaked
if the operation is not completed when the isolate shuts down
with an unhandled exception.
This change adds a finalizable state for the 'File' object so that
the message deletion that happens when ports are closed could run
the callback to clean up the 'File' object.


TEST=new tests added

Change-Id: I64c18a7905261b0fc7bf9f220086791478232d0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211340
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Siva Annamalai <asiva@google.com>
2021-08-27 17:45:17 +00:00
Alexander Markov 28348d650f [vm] Move implementation of dart:math intrinsics to flow graph builder
This change removes duplicated implementations of dart:math intrinsics
from GraphIntrinsifier/AsmIntrinsifier and FlowGraphInliner, and adds
a single implementation in FlowGraphBuilder.

TEST=ci

Change-Id: Ifcf285aba15e1b240144215463cd6b2703a8937c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211481
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2021-08-27 17:42:27 +00:00
Sam Rawlins 9b3d1b70d8 analyzer: Do not report duplicate constructors when one is invalid
Addresses extra error in
co19/LanguageFeatures/Constructor-tear-offs/unnamed_constructor_A03_t07.

Change-Id: Ice77048de06199de9de65a0a403f0393e4300a4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211562
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-08-27 17:11:26 +00:00
Sam Rawlins c1e972a87d analyzer: Report error when unknown member is referenced off instantiated class
Fixes https://github.com/dart-lang/sdk/issues/47006

Change-Id: I0d27bd7fc7307b9bdb53b296bd5ecd7371048b16
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211560
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2021-08-27 17:05:47 +00:00
Tess Strickland dab80fee03 [vm] Make legacy or non-nullable FunctionTypes <: non-nullable Object.
Non-nullable Object is not a top type in strict null safety mode, so
we need to explicitly check for it, since we can't fall back to
Class::IsSubtypeOf for FunctionTypes.

TEST=vm/cc/FunctionType_IsSubtypeOfNonNullableObject

Change-Id: Icfa2ece9bb954a2cc8756334614eb38c0ec1443a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/211580
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Tess Strickland <sstrickl@google.com>
2021-08-27 16:52:48 +00:00