Commit Graph

6018 Commits

Author SHA1 Message Date
Daco Harkes d763cd55fc [vm/ffi] Roll package:ffi to 1.0.0
G3 has been migrated (go/dart-ffi-1.0-g3-migration), so now we can roll
the package version which has all the deprecated methods removed.

Rolling `package:ffi` forward also means it is no longer using
`sizeOf<T>()` generically. So the problems in the CFE expect files
disappear.

Change-Id: I33c7c06c6b7b34178908b175f08f3fc0f275be41
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/185141
Auto-Submit: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-02-17 08:18:20 +00:00
Johnni Winther 4f65d69e5e [cfe] Handle duplicate getables and conflicting setables
Change-Id: Iea3cb2d74799f891367c27e1d5a460aa6e7ef803
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183661
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-02-17 07:38:01 +00:00
Paul Berry 4b4cc13ff5 Flow analysis: clarifying comments for "why not promoted" logic.
These comments address code review comments from
https://dart-review.googlesource.com/c/sdk/+/181741.

Bug: https://github.com/dart-lang/sdk/issues/44898
Change-Id: I93d35600048318c20e6c41b290b6736d0086a574
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184980
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-16 17:06:46 +00:00
Johnni Winther 02f0f53ddf [cfe] Don't block nnbd top merge on typedef types
The MergeVisitor was trying to merge FunctionType.typedefType in order
to merge function types, thus preventing nnbd top merge of two
compatible types that were just introduced through different typedefs
or function type syntax.

Change-Id: Icea75598168c86ed33314db22ebeec3e666c3675
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184785
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
2021-02-16 11:30:21 +00:00
Jens Johansen 2d064faf74 [CFE] Incremental compiler guards against multiple simultaneous calls to computeDelta
package:vm "clones" an old incremental compiler when creating a new one
for a new isolate. It does that by calling .computeDelta on the first
available compiler. If that compiler is already compiling, though, things
can go bad.

The risk of that happening was made bigger by awaiting in the standard
filesystem instead of using the sync filesystem operations, but it can
happen either way.

If it has any practial importance (outside of tests) is an open quesiton
but this should nevertheless fix the issue by only letting the
incremental compiler allow one compile at the time (creating an implicit
queue when more is tried).

TEST=Existing test suites + added test.

Change-Id: I694e360aa4bce604db41908730c66ef3b96e6d8b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184788
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Aprelev <aam@google.com>
2021-02-16 08:32:56 +00:00
Jens Johansen 4216dc8d12 [CFE] Attempt at 'benchmarking' intrumenter
Ultimatley this proved not very useful (for me at this time at least).
As it might be useful in the future, though, I'll land it here.

Change-Id: I7e6c7ad878d290763d2b2c0f3c372bf7f6521ea1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184422
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-15 10:14:40 +00:00
Dmitry Stefantsov b994d51d98 [cfe] Disallow super-bounded aliased constructor invocations
This CL also threads through the inferredness of type arguments for
the factories, so that the error that is checked twice isn't reported
twice because the arguments are recognized as inferred in one place
and as explicit in the other.

Closes #42446.

Bug: https://github.com/dart-lang/sdk/issues/42446
Change-Id: I8cc158b6d8070d34c1489386962fa1f5e2592719
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184270
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-02-15 09:51:27 +00:00
Paul Berry c2eb847697 Add "why not promoted" support for method invocations to CFE.
This required moving the logic for computing the context messages from
the inference visitor to the type inferrer.

This includes support for extension method invocations and invocation
of `.call` on a function type.

Bug: https://github.com/dart-lang/sdk/issues/44898
Change-Id: Icda160f69cc815953c43edc92be910c5f49f9401
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184842
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-13 15:39:17 +00:00
Paul Berry e0fd546dc3 Improve "why not promoted" context message for the case of writes.
The new message phrasing should flow better, especially in the analyzer CLI.

For the motivation for this change, please see
https://github.com/dart-lang/sdk/issues/44904#issuecomment-776286501

Bug: https://github.com/dart-lang/sdk/issues/44898
Change-Id: I595492c64b42aff25cae5a8936c32aa8a218edd8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184601
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-13 15:21:06 +00:00
Paul Berry 957c0a1c9d Improve "why not promoted" info for field/property reference.
When reporting that a null check is needed due to a lack of type
promotion, and the thing that was not promoted was a reference to a
field or property, the CFE and analyzer now report "why not promoted"
using a context message that points to the definition of the field or
getter.  (Previously the CFE reported a context message with no
location, and the analyzer didn't report "why not promoted").

Bug: https://github.com/dart-lang/sdk/issues/44898
Change-Id: If1841727b8b60dd87c43f239e6a06b98f363801f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184522
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-12 22:43:55 +00:00
Lasse R.H. Nielsen d352bc28b8 Remove (most) uses of the "non-nullable" experiment flag.
Since the flag is now enabled by default, there should be no mention of it.
There are still some uses in front_end/testcases that are not just removable
(it also uses `no-non-nullable`). There migth be more uses that are not
as easily found as grepping for `--enable-experiment

Removes two VM tests where fixing them meant they were just duplicating
the corresponding non *_2/ tests.
Fixes #44941

TEST= Large number of tests chaged.=(no-)?non-nullable`.

Change-Id: Ief755981ccde9a5482fcdf408c2929c74433a710
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183688
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-02-12 17:16:54 +00:00
Daco Harkes 34e3f571ac Reland "[vm/ffi] Disallow empty Structs"
Closes: https://github.com/dart-lang/sdk/issues/43974

TEST=tests/ffi/vmspecific_static_checks_test.dart

Change-Id: I35e6f5315826a751e5ce017a6a618c2c224c0f84
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180189
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2021-02-12 15:35:29 +00:00
Martin Kustermann 4172bea7b8 Revert "Async read as bytes"
This reverts commit a32498b929.

Reason for revert: Causes reload tests to fail:

```
% out/ReleaseX64/dart --hot-reload-rollback-test-mode --no-enable-isolate-groups tests/standalone_2/io/http_basic_test.dart

Crash when compiling null, at character offset null:
Unsupported operation: DillMemberBuilder.buildMembers
#0      DillMemberBuilder.buildMembers (package:front_end/src/fasta/dill/dill_member_builder.dart:75:5)
#1      SourceClassBuilder.build.buildBuilders (package:front_end/src/fasta/source/source_class_builder.dart:154:25)
#2      _LinkedHashMapMixin.forEach (dart:collection-patch/compact_hash.dart:397:8)
#3      ConstructorScope.forEach (package:front_end/src/fasta/scope.dart:585:11)
#4      SourceClassBuilder.build (package:front_end/src/fasta/source/source_class_builder.dart:183:18)
#5      SourceLibraryBuilder.buildBuilder (package:front_end/src/fasta/source/source_library_builder.dart:2561:31)
#6      SourceLibraryBuilder.build (package:front_end/src/fasta/source/source_library_builder.dart:955:7)
#7      SourceLoader.buildComponent (package:front_end/src/fasta/source/source_loader.dart:957:40)
#8      KernelTarget.buildOutlines.<anonymous closure> (package:front_end/src/fasta/kernel/kernel_target.dart:353:14)
<asynchronous suspension>
#9      withCrashReporting (package:front_end/src/fasta/crash.dart:122:12)
<asynchronous suspension>
#10     IncrementalCompiler.computeDelta.<anonymous closure> (package:front_end/src/fasta/incremental_compiler.dart:298:37)
<asynchronous suspension>
#11     IncrementalCompiler.compile (package:vm/incremental_compiler.dart:69:29)
<asynchronous suspension>
#12     IncrementalCompilerWrapper.compileInternal (file:///.../sdk/pkg/vm/bin/kernel_service.dart:337:23)
<asynchronous suspension>
#13     Compiler.compile.<anonymous closure> (file:///.../sdk/pkg/vm/bin/kernel_service.dart:212:45)
<asynchronous suspension>
#14     _processLoadRequest (file:///.../sdk/pkg/vm/bin/kernel_service.dart:872:37)
<asynchronous suspension>
```

Original change's description:
> Async read as bytes
>
> Change-Id: I9b893dc992c95e6aa59368b9c7613ba7008d6fcd
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184523
> Reviewed-by: Anna Gringauze <annagrin@google.com>
> Commit-Queue: Anna Gringauze <annagrin@google.com>
> Auto-Submit: Gary Roumanis <grouma@google.com>

TBR=sigmund@google.com,grouma@google.com,annagrin@google.com

Change-Id: Icc199316537ac303ad6f3a8ac7161aa4da67ad40
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184780
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-12 15:29:39 +00:00
Johnni Winther 6c1e985e76 [kernel] Partial migration of package:kernel wave 1 (part 2)
Change-Id: Ib1093ab9414a80f97f51d54589653f62ec34e30a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184267
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-12 13:52:20 +00:00
Gary Roumanis a32498b929 Async read as bytes
Change-Id: I9b893dc992c95e6aa59368b9c7613ba7008d6fcd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184523
Reviewed-by: Anna Gringauze <annagrin@google.com>
Commit-Queue: Anna Gringauze <annagrin@google.com>
Auto-Submit: Gary Roumanis <grouma@google.com>
2021-02-12 01:28:05 +00:00
Daco Harkes fca959e5f6 [vm/ffi] Add class to vm:ffi:struct-fields pragma
This CL changes `@pragma('vm:ffi:struct-fields', [...])` to
`@pragma('vm:ffi:struct-fields', _FfiStructLayout([...]))` which makes
it easier to add more data in subsequent CLs.

Extends `FindPragma` to allow returning multiple matched pragma's, so
that we can filter them. (In this case to avoid matching user-defined
pragma's that do not have an instance of the private class.)

Separated out from https://dart-review.googlesource.com/c/sdk/+/183640
because of the extra constant in existing expectation files.

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

TEST=tests/ffi(_2)/*_by_value_*_test.dart

Change-Id: Idef9f82e9b53c2a32dffabcec19669eae550fe2f
Cq-Include-Trybots: luci.dart.try:front-end-nnbd-mac-release-x64-try,front-end-linux-release-x64-try,vm-precomp-ffi-qemu-linux-release-arm-try,vm-kernel-nnbd-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184181
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-02-11 18:09:05 +00:00
Jens Johansen 88c617d21d [CFE] Refactor some usages of .forEach and .contains
Change-Id: I562db2f60cadfdfc458ee6c42e338e05f9191cb4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183687
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-02-10 10:33:28 +00:00
Johnni Winther ee0c0bcd57 Reland "[kernel] Ensure that visitors don't implicitly returns null"
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.

TEST=Refactoring

Change-Id: Ie8fa5d41b99850d9e4abb59634c72920c64128d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183691
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-10 07:51:52 +00:00
Johnni Winther 504d63288e [cfe] Handle setter conflicts
Handle setter conflicts with non-setters and implicit setters.

Closes #44003
Closes #44844

Change-Id: I32c5e4022c187578e2cd37d13151c27451666dbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183660
Reviewed-by: Dmitry Stefantsov <dmitryas@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-09 15:56:35 +00:00
Johnni Winther b60e0aa5a1 Revert "[kernel] Ensure that visitors don't implicitly returns null"
This reverts commit ce81216885.

Reason for revert: Flutter dependency

Original change's description:
> [kernel] Ensure that visitors don't implicitly returns `null`
>
> This is in preparation to migrate package:kernel to null safety.
> For the visitor interfaces to support non-nullable return types, the
> implementations must avoid using `null` as return value in its base case.
>
> TEST=Refactoring
>
> Change-Id: Ie5e4153f8d3779d94957bb13b3d2d2a942040ff2
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179760
> Commit-Queue: Johnni Winther <johnniwinther@google.com>
> Reviewed-by: Jens Johansen <jensj@google.com>

TBR=jensj@google.com,johnniwinther@google.com

Change-Id: I61b838d3371e6b1de2427716d056324c120be499
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183689
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-09 12:41:12 +00:00
Johnni Winther ce81216885 [kernel] Ensure that visitors don't implicitly returns null
This is in preparation to migrate package:kernel to null safety.
For the visitor interfaces to support non-nullable return types, the
implementations must avoid using `null` as return value in its base case.

TEST=Refactoring

Change-Id: Ie5e4153f8d3779d94957bb13b3d2d2a942040ff2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/179760
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-09 09:46:46 +00:00
Jens Johansen cb89632bdc [CFE] Reproduction of error on recomile even without change (slight variation)
This is a slight variation of
https://github.com/dart-lang/sdk/commit/6aee7d0eb82c420a907af0a1da5e90ca66736db2
that was fixed in
https://github.com/dart-lang/sdk/commit/019ce33409e246973a217a7f9655444bc13d2619

This one still fails.

Change-Id: I92d62d96b3783243c0ff3ee2dab20f9c7c5ec22a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183663
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-02-09 07:30:12 +00:00
Jens Johansen 6c4bc07b42 [CFE] Fix leakTester after changes to vm_service
vm_service was changed in https://dart-review.googlesource.com/c/sdk/+/182600

Change-Id: Ieb52349c970727889fb7ba87b90fbd408281d28d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183662
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-02-09 07:28:32 +00:00
Paul Berry 680f5e6da5 Clean up error message nomenclature around metadata vs annotations.
Change-Id: I866900d2c4baca6ee000885f2126de2a97e643ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182800
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-08 22:00:04 +00:00
Dmitry Stefantsov c6bd2afc10 [cfe] Remove a side effect from computeConstCanonicalType
Closes #44857.

Bug: https://github.com/dart-lang/sdk/issues/44857
Change-Id: I1082fded9a0b06cbcf30c484975b0cf464db75a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182781
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-02-08 13:22:13 +00:00
Dmitry Stefantsov d3f3cfd531 [cfe] Report cyclic typedef use in bounds of type parameters
Closes #43975.

Bug: https://github.com/dart-lang/sdk/issues/43975
Change-Id: Ia7e7b6c46d3c0d2eaa2e809008847d3f47897d2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182780
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
2021-02-08 13:13:23 +00:00
Jens Johansen da4e3f4bbe [CFE] Textual outline requires ScannerConfiguration
The incremental compiler now passes the correct nnbd settings and
extension methods settings.

Change-Id: I89e6bad8af330c3c81f141c260b2325aca4a5bb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182630
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-08 12:10:27 +00:00
Dmitry Stefantsov 63737581f8 [cfe] Encourage the use of the const NeverType objects
TEST=Covered by existing test base.
Change-Id: Ie858bd5a765d71fa4095eab3373a6ecdb063b260
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183006
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-08 10:36:40 +00:00
Jens Johansen 23a841c463 [CFE] Add a reordering fuzzing step to the strong unit tests
This CL:
* Adds a "reordering fuzzing step", i.e. it tries to sort the fields,
  procedures etc in both ascending order and descending order
  to verify that there are on crashes and no changes in error vs
  no error. This has been tested on http://dartbug.com/34803
  before the fix landed.
* Introduces an attempt at "visiting the outline" of the "direct from
  parser ast".

Change-Id: Ic3f5a776839030bb48a35eeee8575b37c19be453
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182504
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-08 10:00:10 +00:00
Jens Johansen 801e3331df [CFE] Remove unused stuff 'metadata collector' and 'documentation comment'
Change-Id: I5826dca4e328752ceaa5b788f2d85669ceb1f0d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183008
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-02-08 09:46:20 +00:00
Johnni Winther 909c44cecf [cfe] Support dart2js and dartdevc targets in expectation tests
Change-Id: If087dfaf291f02812aa1191328a10ad2a5f135ba
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183007
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-08 08:30:20 +00:00
Ben Konyi 848121e6d4 Reland "[ CLI ] Improved consistency of -D and --define across tools and commands"
- Added support for --define to the VM and dart2js
- Added support for -D and --define for `dart run` and `dart compile js`

Remaining improvements:
- Add support for providing multiple comma separated values for `dart
  run`, `dart`, and `dart2js`

Related issue: https://github.com/dart-lang/sdk/issues/44562

TEST=Updated CLI tests and added new dart2js tests.

This reverts commit e49937769f.

Change-Id: I5f9275b829665eb5e8695403d67f230e752ab0e6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183180
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-02-05 23:53:28 +00:00
Paul Berry 93cd0cdd3b Parser support for generic annotations.
This CL updates the parser so that it allows annotations of the form:

    `@` <constructorDesignation> <argumentPart>

Where <argumentPart> can contain type arguments.  Previously this was
prohibited at parse time.

Generic annotations are still prohibited in the current language
version, but the error is now generated by the parser listener
(BodyBuilder in the case of CFE, AstBuilder in the case of analyzer);
this should open the door for future CLs to add support for generic
annotations when the `generic-metadata` experimental flag is supplied.

Bug: https://github.com/dart-lang/sdk/issues/44838
Change-Id: I90604f38bcb378fc798c5737e486fb26589d4d1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182668
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-05 20:57:18 +00:00
Srujan Gaddam bea97da4a2 [pkg:js] Language version @Native/@JS class conflict check
Bug: https://github.com/dart-lang/sdk/issues/44797

This check was previously introduced without a language version,
and therefore lead to a breaking change on SDK update. It's now
versioned for releases >= 2.13, allowing users to migrate easier.
It also adds a hint for the error, providing alternatives for
users whose code triggers this check.

Change-Id: I4f61066a917ddb18071508291cde00710802fc5d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182920
Commit-Queue: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2021-02-05 00:23:42 +00:00
Sigmund Cherem 912005267d [web] rename suite dart2js -> web.
Change-Id: I46be49b2effec3e38a3dc44cd45cfe736f77fa78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182680
Commit-Queue: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Joshua Litt <joshualitt@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2021-02-04 23:11:32 +00:00
Johnni Winther 6ce8d74761 [cfe] Add Function.futureValueType and serialize Let.fileOffset
Serializing Let.fileOffset supports positions in stacktraces resulting
from null aware expressions, like `if (o?.foo) ...` when `o` is `null`.

Adding Function.futureValueType supports the proper backend
implementation for the fix in
https://dart-review.googlesource.com/c/sdk/+/181303

Closes #44654

TEST=existing

Change-Id: Ie5939a248d3d8bf41388e8f435e4ba4195afeabd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182269
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-04 14:06:47 +00:00
Alexander Thomas c88171c8af [sdk] Bump version to 2.13
TEST=Presubmit tests and local builds
Change-Id: I1b15d60eced0cf3f422548eda75706609f6640cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182624
Commit-Queue: Alexander Thomas <athom@google.com>
Auto-Submit: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-04 12:10:17 +00:00
Johnni Winther 5a26dba0d4 [cfe] Add ExpressionGeneratorHelper.createVariableDeclarationForValue
This combines the creation of synthetic variables with registration
of the create variable in flow analysis.

The fixes the failing expectation tests that currently crashes with
assertion failures.

Change-Id: I0d581653775dab135abebdecd28c19c5712b8d88
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182562
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2021-02-04 10:54:52 +00:00
Jens Johansen f3f831f103 [CFE] Enable asserts on unit test suites
This also updates the status files with the new crashes caused by
assert failures.

Change-Id: I0ec3fe8a10ad77c712760ab262297913f84e89b6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182503
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2021-02-04 08:13:47 +00:00
Jens Johansen 1392263ecc [parser] Non-crashing recovery of in-progress generification of typedef
Fixes #43090

Change-Id: I1377ebf08a8c561e4f15abbf458c5bb0d8c61494
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182040
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-04 08:01:07 +00:00
Clement Skau 2236883ff2 [SDK] Removes non-exiting tests from .status
TEST=Tested all configurations.

Change-Id: Iec00d7e6ea56221ffebcf044de22647907f598f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182500
Reviewed-by: Tess Strickland <sstrickl@google.com>
Commit-Queue: Clement Skau <cskau@google.com>
2021-02-04 06:46:13 +00:00
Paul Berry 0427342228 Add flag for generic metadata
See implementation plan PR:
https://github.com/dart-lang/language/pull/1417

Change-Id: Ib75026d7008d313f3dad94d9ccf47e341f945dc9
Bug: https://github.com/dart-lang/language/issues/1297
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182301
Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2021-02-03 13:54:48 +00:00
Riley Porter cfa35be6f0 [package:js] Added checks for external non-JS members.
Adds static errors in web backends requiring external members to be
annotated with @JS(). Members can be annotated directly, or on the
enclosing class or library.

Also removes duplicate checks in dart2js for non-native external
members that are now covered by the checks on external @JS members.

Change-Id: I2b17456f8f546f80f1ea6a817360c7f4c40f9640
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180442
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Riley Porter <rileyporter@google.com>
2021-02-03 02:14:18 +00:00
Daco Harkes 75c17483d3 [vm/ffi] Rewrite .ref calls in CFE
This rewrites `Pointer<Struct>.ref` and `Pointer<Struct>[]` calls in
the CFE to skip the runtime entry when the type argument is constant.

The runtime entry is still used when the type argument is generic.
Forcing the type argument to be constant and removing the runtime entry
will be done in follow up CLs.

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

Removing the runtime entry speeds up `.ref` significantly.
before: FfiStruct.FieldLoadStore(RunTime): 18868.140186915887 us.
after: FfiStruct.FieldLoadStore(RunTime): 270.5877976190476 us.
Measurements from Linux x64 in JIT mode.

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

TEST=tests/ffi/structs_test.dart

Change-Id: I82abd930b5a9c5c78a8999c2bc49802d67d37534
Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,analyzer-nnbd-linux-release-try,app-kernel-linux-debug-x64-try,dart-sdk-linux-try,front-end-nnbd-linux-release-x64-try,pkg-linux-debug-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,vm-kernel-reload-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182265
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Clement Skau <cskau@google.com>
2021-02-02 16:33:54 +00:00
Paul Berry a42244f73b Flow analysis: begin tracking non-promotion reasons.
This CL implements the core flow analysis infrastructure for tracking
reasons why an expression was not promoted.  It supports the following
reasons:

- Expression was a property access
- Expression has been written to since it was promoted

I expect to add support for other non-promotion reasons in the future,
for example:

- `this` cannot be promoted
- Expression has been write captured
- Expression was a reference to a static field or top level variable

These non-promotion reasons are plumbed through to the CFE and
analyzer for the purpose of making errors easier for the user to
understand.  For example, given the following code:

  class C {
    int? i;
    f() {
      if (i == null) return;
      print(i.isEven);
    }
  }

The front end now prints:

  ../../tmp/test.dart:5:13: Error: Property 'isEven' cannot be accessed on 'int?' because it is potentially null.
  Try accessing using ?. instead.
      print(i.isEven);
              ^^^^^^
  Context: 'i' refers to a property so it could not be promoted.

Much work still needs to be done to round out this feature, for example:

- Currently the analyzer only shows the new "why not promoted"
  messages when the "--verbose" flag is specified; this means the
  feature is unlikely to be noticed by users.

- Currently the analyzer doesn't show a "why not promoted" message
  when the non-promotion reason is that the expression is a property
  access.

- We need one or more web pages explaining non-promotion reasons in
  more detail so that the error messages can contain pointers to them.

- The analyzer and front end currently only show non-promotion reasons
  for expressions of the form `x.y` where `x` fails to be promoted to
  non-nullable.  There are many other scenarios that should be
  handled.

Change-Id: I0a12df74d0fc6274dfb3cb555abea81a75884231
Bug: https://github.com/dart-lang/sdk/issues/38773
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181741
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2021-02-02 16:15:34 +00:00
Johnni Winther 91be638a56 Add support for --verbosity in bazel/kernel_worker
Change-Id: If1c1cd2feb1c5341c3b7631dfe12888ce7eac249
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182221
Reviewed-by: David Morgan <davidmorgan@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2021-02-02 15:25:44 +00:00
asiva 34f9734b41 Revert "[cfe] Handle conditional await in CFE"
This reverts commit 14032a6209.

Reason for revert : Several customer flutter tests are failing because
of the change in behavior.

TEST=revert of previous CL.

Change-Id: Ia235aa93b9c81fbab066803dc0625856f93acceb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181860
Commit-Queue: Siva Annamalai <asiva@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
2021-02-01 23:41:01 +00:00
Dmitry Stefantsov 425e4dbe09 [cfe] Sort type variables topologically before building the bounds
Closes #44455.
Closes #34803.
Closes #42434.

Bug: https://github.com/dart-lang/sdk/issues/44455
Bug: https://github.com/dart-lang/sdk/issues/34803
Bug: https://github.com/dart-lang/sdk/issues/42434
Change-Id: I3be93b0d4a251de79c3bfe9829143f0fbec201ab
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181402
Commit-Queue: Dmitry Stefantsov <dmitryas@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-01 18:46:29 +00:00
Jens Johansen 16a66c8902 [parser] Don't crash, try to recover from written out logical operators and and or
Fixes #44785

Change-Id: I4c7198ea1c223900a58039c032ee303d7da2c14f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/181580
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2021-02-01 09:30:48 +00:00
Lasse R.H. Nielsen 4a484c88e1 Make ListMixin.take check that the argument is not null.
Fixes #41743, #30155
BUG= http://dartbug.com/41743

Change-Id: I223905a92b7353cdc50498d265a6dfe2f2f614d9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/160640
Commit-Queue: Lasse R.H. Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2021-01-28 17:19:35 +00:00