Commit graph

37894 commits

Author SHA1 Message Date
Aske Simon Christensen 6faa5f3bd0 [dart2wasm] Initial commit for the Dart-to-WasmGC compiler.
This is work in progress. Several language features are still
unimplemented or only partially implemented.

Instructions for running the compiler and its output can be found in
pkg/dart2wasm/dart2wasm.md. These procedures are preliminary and
expected to change.

The best version of d8 to use for this version of dart2wasm is 10.0.40,
as explained here: https://dart-review.googlesource.com/c/sdk/+/232097

This commit also adds a dart2wasm-hostasserts-linux-x64-d8 testing
configuration to run the compiler over the test suite.

The history of the prototype that this is based on can be seen here:

https://github.com/askeksa-google/sdk/tree/wasm_prototype

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

Change-Id: I910b6ff239ef9c5f66863e4ca97b39b8202cce85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/175728
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Aske Simon Christensen <askesc@google.com>
2022-02-16 11:11:14 +00:00
Johnni Winther f24c4fa919 [cfe] Add initial support for applying the phase 1 macro results
This adds support for the generating a synthesized augmentation
library for each library in which phase 1 macros were applied.
Current implementation piggybacks on the patch library support. The
intension is that both patches and augmentations are handled through
the same general mechanism. For now, the wording refers to augmentation
libraries as patch libraries where the implementation is shared.

Testing is extended to verify that the generated classes are
included in the resulting AST.

Change-Id: Ie0d4cfdc84b55ca87e0014794f14b38e442f08eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233101
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-16 09:19:49 +00:00
Joshua Litt f50a4b4612 [dart2js] Cleanup some TODOs in dart2js' frontend api.
These appear to be no longer necessary.

Change-Id: I8ec8a13394b6e56697de3ccee3a5326b149a137a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233000
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-02-15 17:41:39 +00:00
Jake Macdonald e6654814cc Make the serialization mode easily configurable (and required), and some other improvements.
- Support TransferableTypedData in the bootstrap code and IsolatedExecutor.
- Also removed the fake executor and conditional import. Mode will likely be chosen based on factors other than just the availability of `dart:isolate`.
- Run the tests in both serialization modes.

Change-Id: I5c731d192c0d3a8cdc5f7fb900dc07a32f4f4d51
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232981
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2022-02-15 16:16:20 +00:00
Chloe Stefantsova 6c8ad6a723 [cfe] Report errors on declared 'values' member in enums
Part of https://github.com/dart-lang/sdk/issues/47453

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

Change-Id: I8313e3f63122c85c91a9647ddaa53346591d7238
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232841
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-02-15 12:22:19 +00:00
Jake Macdonald 97176be3d4 add the local identifier type for parameters, add isStatic field to class members
Change-Id: I15d85fdc4a6b894e6ecda6716f9931e03a8278ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232961
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-15 11:49:50 +00:00
Ben Konyi 7a0f27f241 [ Service ] Added service tests for enhanced enums
Fixes https://github.com/dart-lang/sdk/issues/47870

TEST=pkg/vm_service/test/enhanced_enum_test.dart

Change-Id: Ifa55c894f331452d1d88131d892d6c153dcbe8cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232225
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-02-15 00:36:10 +00:00
Paul Berry 5d7445e972 Migration: respect built_value @nullable annotations even when there is no codegen
Previously, when the migration tool encountered a built_value
`@nullable` annotation, it removed it, because when the built_value
code generator is consuming a library with null safety enabled, it
relies on the presence of a `?` to determine nullability, rather than
an annotation.  However, there was no logic to actually ensure that
the `?` would actually get introduced, because I thought the code
generated by built_value would always create the conditions necessary
to convince the migration tool to introduce the `?` using its normal
graph traversal algorithm.

It turns out this is not the case: when `@nullable` appears in an
interface class that is used by other built_value classes, but is not
itself a built_value class, the migration tool sometimes doesn't have
enough information to figure out that it needs to add the `?`.

So in this CL, I'm doing what I probably should have done in the first
time: adding the necessary logic to the migration tool to ensure that
the `@nullable` annotation gets translated into a `?` regardless of
whether it is required to by generated code.

Bug: https://buganizer.corp.google.com/issues/217863427
Change-Id: I9efe5241634389981a4c56e764bac91b3350c4fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/233003
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-02-15 00:32:50 +00:00
Jaime Wren a2f887ea59 New optional enum input, CompletionCaseMatchingMode, in DAS getSuggestions2 request.
Change-Id: Ibddcd7db4f51266c29a104d2b46e93c29ddf5465
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232422
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Jaime Wren <jwren@google.com>
2022-02-15 00:15:00 +00:00
Joshua Litt 201557fb1d [dart2js] Remove FrontendStrategy.
This CL cleans up some indirection now that we only support
KernelFrontendStrategy.

Change-Id: Iaee8d41e061cc88957cae00d61111cbd8c076d65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232963
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-02-14 23:44:10 +00:00
Stephen Adams 1314d66d41 [dart2js] Better dead phi removal
Remove dead phis including back-edges and cycles.

Add a postcondition validation for optimization phases.

Add post-phase validation test for dead-phi removal and dead-code elimination.

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

Change-Id: I178cda52dd165e825b9e2d9ae642c22162cee2e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232782
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-02-14 23:30:30 +00:00
Sigmund Cherem 447e802aaa [web]: remove a couple dynamic calls in the sdk
Change-Id: I59d4697e981417a695a08b21f3b350fa6f84f484
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232962
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Sigmund Cherem <sigmund@google.com>
2022-02-14 21:44:20 +00:00
Devon Carew bd5da72538 [dartdev] tweak the pubspec file generation for 'dart create'
Change-Id: I769ef258b9875aeeb23bc9aeca396bc9594197d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232980
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2022-02-14 21:23:59 +00:00
Joshua Litt 1e799e1580 [dart2js] Merge CompilerImpl into Compiler.
This indirection is no longer needed.

Change-Id: Ic917ec758dc8a8a648fea9f74ddf75f47b6b9d4d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232485
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-02-14 20:42:50 +00:00
Stephen Adams 75d4047276 [dart2js] Dead code eliminator should remove dead phis
The bad codegen reported in #48383 was due to an unused phi confusing
the expression-tree construction algorithm. It was trying to generate

    data = cond ? callWithSideEffects() : null;

but `data` is unused, so somehow we generated only

    cond;

We should not have unused phis at this point so I put a safety check
in the above code to not try to build an unused conditional, and
changed the dead-code eliminator to eliminate dead phis.

Now we get

    if (cond)
      callWithSideEffects();

I compared the output for some large apps and there were about a dozen
changes. All looked like improvements, e.g. not assigning to an unused
variable. There was some code missing that is now present, but luckily
for the large apps, it was all code that did not have real-world side
effects.


Fixed: 48383
Change-Id: Id7b32cfa0cbfb47a4d9eff174ad9ae52da99f6a4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232781
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2022-02-14 20:15:30 +00:00
Joshua Litt 971772bf6d [dart2js] Cleanup a few minor uses of dynamic.
Change-Id: Ic29689ce30f368bfa21bdd2bd13cca038973fba0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232321
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-02-14 18:33:33 +00:00
Danny Tuppeny 4bd312d1e6 [analysis_server] Improve LSP server error messages for invalid paths/parse failures
Change-Id: I1a72ee62e282991b0071d0135c9a658bc5f7e14e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232861
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-02-14 17:07:48 +00:00
Alexander Thomas 30beab0f43 [infra] Add OWNERS to the Dart SDK
* Add team "groups" in tools/OWNERS_<group name>.
* Add top-level OWNERS as a fallback.
* Add OWNERS for all top-level directories.
* Add OWNERS to all packages.

For additional background information see go/dart-sdk-owners.

TEST=No op until code-owners is enabled.
Bug: b/200915407
Change-Id: I7fe6116cc599c749cd50ca16151d6d6a801d99d7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/229147
Reviewed-by: Jonas Termansen <sortie@google.com>
2022-02-14 14:06:34 +00:00
Johnni Winther 74a355c544 [cfe] Use buildAugmentationLibrary on phase 1 results
This CL add support for identifier resolution to use the
MacroExecutor.buildAugmentationLibrary for generating the code.

The CL updates the ResolvedIdentifier to have a nullable [uri] in
order to support built in identifiers, such as `void`.

Change-Id: I9436ea77c06cf5618f1977f4c9ac0490ff059587
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232623
Reviewed-by: Jake Macdonald <jakemac@google.com>
Auto-Submit: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-14 11:31:25 +00:00
Lasse R.H. Nielsen 0408bc6c18 Deprecate AbstractClassInstantiationError.
The class is no longer used in Dart 2.0 where instantiating an abstract
class became a compile-time error.

The class is now also exported from `dart:mirrors`. Since `dart:mirrors`
throws this error when trying to call a constructor mirror from an
abstract class, it needs to keep having an error to throw.
For backwards compatibility, we'll keep using the same class,
but restrict it to `dart:mirrors` and remove it from `dart:core`
when possible.

Q.v. #30771

Bug: https://darbug.com/30771
Change-Id: I2eef6ff8b1509b00b0567cc1951ae9972c87c3fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232605
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
2022-02-14 11:13:14 +00:00
Konstantin Shcheglov 85cdbe31ca Report all available libraries in exceptions.
There are two kinds: which we just built, and from readers.
With this change we will cover also just built libraries.

Change-Id: I67fa8ec5eeb00e539b4bd648d35b547dea8b4a7e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232686
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-12 01:49:21 +00:00
Konstantin Shcheglov a646c11592 Add failing test for 'v<int>.^'.
Change-Id: Ib2587e8c5b845cc65d029750ede23c6d4f9206c5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232685
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-12 01:49:08 +00:00
Jake Macdonald 49d7f5056f Add a byteData serializer/deserializer implementation
With the optimizations suggested this does now equal or outperform the JSON serializer in all scenarios, the latest numbers from the benchmark are as follows:

Isolate.spawn + SerializationMode.jsonClient: 0:00:00.041666
Isolate.spawnUri + SerializationMode.jsonClient: 0:00:00.069551
Separate process + SerializationMode.jsonClient: 0:00:00.177171
Isolate.spawn + SerializationMode.byteDataClient: 0:00:00.040990
Isolate.spawnUri + SerializationMode.byteDataClient: 0:00:00.059319
Separate process + SerializationMode.byteDataClient: 0:00:00.080008

Change-Id: If5431513c7487d8b7af350381e794cbd61c1be42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232027
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2022-02-11 23:35:27 +00:00
Konstantin Shcheglov ea4f04f56d Support completion in enum constant argument list.
Change-Id: Id483d6ea3715e567f1d2cc9a2051f615b750a8a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232684
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-11 23:07:25 +00:00
Konstantin Shcheglov 582bf2f230 Completion for constructors in enum constants.
Change-Id: I3a68db8045d249f7459ec0dbf0fbd9c203fccade
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232683
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-11 21:41:37 +00:00
Konstantin Shcheglov 65d7aa3b49 Add OK tests, getter index for MIXIN_APPLICATION_NO_CONCRETE_SUPER_INVOKED_MEMBER.
Change-Id: I34039f61aefc6662cd3b4359024878ed3eca776c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232681
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-11 21:04:07 +00:00
Joshua Litt da66e1f39a [dart2js] Make info_visitor_test cleanup created test data.
Change-Id: I8f70c5d751b670bde2d2b6f3fcc2c163722edac8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232661
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-02-11 19:41:26 +00:00
Konstantin Shcheglov b62949ea1d Semantic highlighting for enums.
Change-Id: Ib3e4aceec56b6bdd28b38a317c4c3981db87b7d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232680
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-11 18:50:57 +00:00
Konstantin Shcheglov 8b67b90016 A few tests for completion in class body and similar.
Change-Id: Id8749e4c45d26a5e56de31ce0d8b117db60150a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232486
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-11 18:04:57 +00:00
Joshua Litt 95a924d289 [dart2js] Delete ImpactStrategy.
This strategy is no longer necessary with the single frontend, and
inlining all the logic makes the code much easier to follow.

Change-Id: I73995aa6249b52a932dbfb2d459c2d6633a620d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232029
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2022-02-11 17:45:07 +00:00
Konstantin Shcheglov d5269652d8 Remove 'index' from enum classes.
Change-Id: I7632aced8cde06c449e694c028d0e7fb2d3312df
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232426
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-11 17:35:17 +00:00
Leaf Petersen 4dbd35f04d Reland "Simplify json parser and eliminate dynamic calls."
This is a reland of e77ea8a17b.  I've
undone the change to the name of the platformScript setter, restoring
the previous behavior of accepting anything and casting.

TEST=Existing tests.

Change-Id: I7e36935ef3784035769527dc5624191f38faaa40
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232487
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Leaf Petersen <leafp@google.com>
2022-02-11 16:06:37 +00:00
Chloe Stefantsova a10e11d863 [cfe] Update .expect files after simultaneous CLs landing
Change-Id: I6a37585de9e32d797e3e209fe96c17d97db1d8cd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232604
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-02-11 14:30:07 +00:00
Chloe Stefantsova ab84be0a88 [cfe] Fix _name field resolution for toString body generation
Part of https://github.com/dart-lang/sdk/issues/47453

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

Change-Id: Ib2934779fc7295c066c1c1580609c933be76b618
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232381
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-02-11 13:10:16 +00:00
Chloe Stefantsova 0ef68f8ca5 [cfe] Check enum elements against all other members for diplication
Part of https://github.com/dart-lang/sdk/issues/47453

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

Change-Id: Iea4b147eaed19681e227d84a9afc6a1069b1e3fc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232380
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-02-11 12:54:37 +00:00
Johnni Winther 49990c3e69 [cfe] Allow (inferred) void in for loop variables
Closes https://github.com/dart-lang/sdk/issues/48347

Change-Id: Idc8c4c81dac66574c5d24d41c4a81b66fcf34597
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232601
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-11 12:39:27 +00:00
Johnni Winther 2e6d7bf6ec [cfe] Report error on instantiation of enums from .dill
Closes https://github.com/dart-lang/sdk/issues/48350

Change-Id: I0cedf8a5a12e1a8dee546eec73e012519a054e13
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232384
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-11 11:24:16 +00:00
Chloe Stefantsova 7263b35932 [cfe] Infer constness in enum element initializers
Part of https://github.com/dart-lang/sdk/issues/47453

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

Change-Id: Iaa75ccac6622e874da5f6e5feb053fc19a220936
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232382
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2022-02-11 10:09:26 +00:00
Devon Carew 7f026d6e46 [dev_compiler] remove the dep on package:cli_util
Change-Id: I34c17dc76a0c608ac3536bfdf2c0e39bb8daa6c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232424
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2022-02-11 00:50:31 +00:00
Elliott Brooks a6c96a4707 Allow Dart DevTools to be embedded in Chrome DevTools.
Change-Id: Iff97f9dbc432ed926d668ac8339c32b679e316ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232482
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Kenzie Davisson <kenzieschmoll@google.com>
2022-02-10 23:52:41 +00:00
Johnni Winther 2a1224f3b5 [cfe] Check primitive equals in legacy libraries
This enables the check for primitive equals in switch cases in
legacy libraries.

Change-Id: Iddc464f39525d5167a5c6e8c40c95acc3c245d76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231701
Reviewed-by: Joshua Litt <joshualitt@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2022-02-10 22:13:14 +00:00
Devon Carew 1a72a4ca8f [analysis server] remove the dep on package:cli_util
Change-Id: I9a3b7b8c23dc324ad62f0d9b456e608d365133c0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232423
Auto-Submit: Devon Carew <devoncarew@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-10 21:27:34 +00:00
Konstantin Shcheglov 4a122c0b5a Add completion tests inside enum declaration.
As we discussed some time ago, it is not clear to me where some
tests should go. Here, I put it into "location" tests, and checked
locations that seem strongly associated with the enum - its header,
its body; including the `WithClause` on the enum.

It is less clear where tests for completion inside the header or
the body of a method inside of an enum should go. I initially
planned to put them into `declaration/enum_test.dart`, but now
starting to doubt. The tests there are currently for using an
enum from outside.

Change-Id: Ife091f82bbb0ad1f26df984be42aa93a78595816
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232421
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-10 20:26:01 +00:00
Danny Tuppeny 70d25c7ce7 [analysis_server] Make docs more explicit about positions in LinkedEditGroups
Change-Id: Ifcc8935ac7c72d42fcc0462fd2f6ad3eb8ecd3b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232460
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-02-10 19:51:13 +00:00
Danny Tuppeny 74248dc6db [analysis_server] Use ConvertToPackageImport fix for always_use_package_imports lint
Fixes https://github.com/Dart-Code/Dart-Code/issues/3823.

Change-Id: I33d1448b36de1927e3e3cc5628d0d822d4f21786
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232265
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2022-02-10 19:45:31 +00:00
Paul Berry 8d84fa5485 Migration: fix handling of annotations that refer to named constructors.
Annotations that refer to named constructors are represented a little
strangely in the AST, with Annotation.name being bound to a
PrefixedIdentifier and Annotation.constructorName being bound to
`null`.  This was confusing the EdgeBuilder, causing it to visit the
class name as though it were an expression, and then crashing because
there was no associated expression type.

The solution is to simply not visit Annotation.name at all, because
there's no way it can have any effect on null safety.

Bug: https://buganizer.corp.google.com/issues/217386404
Change-Id: I2baf0a9e8d63a4a5bbff1b2c5ee2aeec52b2844a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232031
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-02-10 19:35:51 +00:00
Devon Carew 554b001ad9 [dartdev] adjust the behavior of several 'dart doc' cli flags
Change-Id: I9efdd71da948b87b0fcbcd2b3e242647131462b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232120
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2022-02-10 18:55:41 +00:00
Paul Berry 8652944f72 Clean up how negated integer literals are type inferred.
Previously, when upon reaching the integer literal, we would check if
the parent was a PrefixExpression with an operator of `-`, and if so,
use the context type of the PrefixExpression to decide whether to do
an int->double conversion.  This CL moves the logic to the
PrefixExpressionResolver; we now pass down the appropriate context
when visiting the integer literal.

This makes the context handling for negated integer literals less of
an odd exception.

This is part of a larger effort to elimiate the use of
InferenceContext.getContext and InferenceContext.setType entirely.

Change-Id: I6ca63df1adcb706011c146c80c2576814a73926d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/231326
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2022-02-10 18:36:51 +00:00
Konstantin Shcheglov 9098b5d12e Increment DATA_VERSION.
Change-Id: Id84b42f083a581a2d391b400ff6868c782a73d4a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232420
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2022-02-10 16:57:11 +00:00
Konstantin Shcheglov 1150b1c2dc Don't build synthetic toString() for enums.
The specification now says that `class Enum` is extended, and
has `external` impelementations of `index` and `toString()`.

Change-Id: I6cb138013722006d570766b87c46ac1c12273dee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/232233
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2022-02-10 16:35:31 +00:00