Commit graph

47782 commits

Author SHA1 Message Date
Mayank Patke 56851e50e2 [dart2js] Restrict instanceof is-test specializations to non-generic
types when SNS checks are enabled.

Change-Id: I759a4ba77b74f6e0ec7c7ec65ad3ca37ed8410a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372201
Commit-Queue: Mayank Patke <fishythefish@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2024-06-24 20:52:43 +00:00
Danny Tuppeny 4f36252fd3 [analysis_server] Support folding multiline strings
Fixes https://github.com/Dart-Code/Dart-Code/issues/5139

Change-Id: I7038568b5504b97c0bb817a608e000c268a3fae6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372902
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-24 18:47:56 +00:00
Danny Tuppeny a98c0197f4 Expose DTD constructor to pass a StreamChannel directly
+ loosen `call()` signature to allow `Object?` in param map values.

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

Change-Id: I962be849b9492d19605301dc211d780e0bd6ecf0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371900
Reviewed-by: Dan Chevalier <danchevalier@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2024-06-24 18:38:26 +00:00
Konstantin Shcheglov 08b50825c4 Macro. Reuse parsed unit when merging macro results.
This saves another 160 ms.

Bug: https://github.com/dart-lang/sdk/issues/55784
Change-Id: If626d616999b85edaaa4028cbe5fc70fbc1bf86a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372960
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-24 18:16:39 +00:00
Kallen Tu ef1ec76054 [cfe] Wildcard import prefixes are non-binding.
Bug: https://github.com/dart-lang/sdk/issues/55655
Change-Id: I938c254fad2c656c9342e9cea5b146373b9f63e5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372603
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-06-24 18:08:47 +00:00
Danny Tuppeny 2f5dff3586 [analysis_server] Add a test for analysis_options nested in the workspace not handling includes
See https://github.com/dart-lang/sdk/issues/56047

Change-Id: Ic61234cb9cdf30ac7d28989c77eff8048730e891
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372340
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-06-24 18:06:31 +00:00
Sam Rawlins 39497e46fc linter: Move tests for two lint rules
* lines_longer_than_80_chars
* unnecessary_brace_in_string_interps

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I75b5a5feeb863cb7463467d96ad751d6334e7cfd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371940
Auto-Submit: Sam Rawlins <srawlins@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-06-24 17:58:11 +00:00
Brian Wilkerson 80b0bda3de Convert the analyzer package to use the new location for mock packages
Change-Id: I097059764e999683564992b475fece4ebfb5a47b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372380
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-24 17:53:45 +00:00
Sam Rawlins 4d20dea313 analyzer: Resolve extension methods on nullable Never type
Fixes https://github.com/dart-lang/sdk/issues/55000

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: Ie71d4762bc294028787c28976b2e0a7e604ab2fa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372880
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Sam Rawlins <srawlins@google.com>
2024-06-24 17:44:09 +00:00
Sam Rawlins 89d9912790 analyzer: Support operators in extension on a type variable type
Fixes https://github.com/dart-lang/sdk/issues/54462

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: If0c2a29559d86830434ae9c68ae1f0da72380741
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372840
Commit-Queue: Sam Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-06-24 17:37:29 +00:00
Konstantin Shcheglov 6d6251528a Augment. Report AUGMENTATION_TYPE_PARAMETER_COUNT.
Change-Id: Iafd5613c7ed87f9f9aff244f0852a663bb45d642
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372562
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-24 16:50:19 +00:00
Brian Wilkerson e159bfee64 Improve the computation of the completion prefix
There are a couple of tests where the new code fails to produce a
prefix, but in those cases the prefixes are `""` and `{`, which are
not useful for filtering (and wrong for replacing). The new code does,
however, now find prefixes that the old code missed, which improves the
filtering. The changes to the tests reflect the improved filtering.

Change-Id: I3d48162ee56de1b94ecb3a88d11e8a2167fb8f2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372860
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-24 16:04:53 +00:00
Ben Konyi 1c57c6cbae [ package:dds ] Update CHANGELOG and pubspec to 4.2.4+1 (republished 4.2.4)
4.2.4 was retracted due to an extra binary being included in the archive
that increased the package size by 10x.

Change-Id: Iebca85555e871fee22bafdd1bf547972bfe5b201
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372920
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Auto-Submit: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-06-24 14:13:55 +00:00
Johnni Winther 43452cdd6c [cfe] Remove SourceLibraryBuilder.libraryTypeParameterScopeBuilderForTesting
This helps moving `currentTypeParameterScopeBuilder` and
`_libraryTypeParameterScopeBuilder` to SourceCompilationUnitImpl

Change-Id: I1374accef8e177a4572bf21ad839a105ced91395
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372900
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-06-24 10:01:28 +00:00
Jens Johansen 40dad48ede [parser] Add more tokens
Add
 * endToken to endBinaryExpression
 * endToken to handleEndingBinaryExpression
 * endToken to endConditionalExpression
 * beginToken (and rename to endToken) on handleExpressionStatement
 * rightSeparator to handleForLoopParts

Change-Id: I55d5a0e6c795b82d8f3480365e4cc3fbb59c65b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372482
Commit-Queue: Jens Johansen <jensj@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-24 08:12:41 +00:00
Konstantin Shcheglov 755d4e0531 Macro. Parse merged code only if there are optimization edits.
This saves another 120 ms.

Bug: https://github.com/dart-lang/sdk/issues/55784
Change-Id: I4b195f977b7e49cc5b07dcecd4836b3f25399428
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372820
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-22 16:30:11 +00:00
Paul Berry 1d38fc4bf2 Add command-line tool to invoke type inference logging.
Type inference logging may be used to examine details of the
analyzer's type inference algorithm. It may be invoked as follows:

  dart pkg/analyzer/tool/type_inference_log.dart <file_to_analyze>

The log is printed to standard output.

Change-Id: I687e4a343e2ea11c6a757066c4375fd6a411e1af
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372720
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-06-21 21:15:29 +00:00
Konstantin Shcheglov b3d39af94f Macro. Reuse cached ParsedFileState(s) for unlinked and augmentation.
This saves us about 150 ms, from 2350 ms.
In a macro running benchmark with 200 JSON classes in 20 libraries.

Bug: https://github.com/dart-lang/sdk/issues/55784
Change-Id: Ia2e242b38157709cd34fafc9445159676824f3d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372800
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-21 20:45:49 +00:00
Danny Tuppeny a42ae0c906 [analysis_server] Include types in closure completions when always_specify_types is enabled
Fixes https://github.com/Dart-Code/Dart-Code/issues/5149

Change-Id: Ic212e13d9fe90b4c728f92ecdf8fd5ca519047ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372426
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-21 20:43:37 +00:00
Kallen Tu 523f03a749 [cfe] Local and top level function wildcard type parameters are non-binding.
This CL adds `isWildcard` to `StructuralVariableBuilder` and allows type variables in functions and function types. It also removes them from scope so they can't be used.

Bug: https://github.com/dart-lang/sdk/issues/55655
Change-Id: I26237375480318dd0c9a01cb59b3426b783ca7be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372240
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2024-06-21 17:59:29 +00:00
Konstantin Shcheglov ef59500e6f Macro. Issue 55696. Revert to syntactic NamedTypeAnnotation, update resolve() to instantiate to bounds.
Bug: https://github.com/dart-lang/sdk/issues/55696
Change-Id: I5d4507ace6186ee669d4cf8863af36a4f02cd64f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371942
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-21 16:10:27 +00:00
Konstantin Shcheglov 35cae3a8b8 Augment. Report AUGMENTATION_EXTENDS_CLAUSE_ALREADY_PRESENT
Change-Id: I5590b68366a12129e42e19e26ac3ec4fa8330149
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372221
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-06-21 15:55:11 +00:00
Paul Berry 7d649303c2 Avoid setting node.staticType twice in PostfixExpressionResolver.
Also, add an assertion to `SharedInferenceLogWriter` to prevent
accidentally setting static types more than once in the future.

Change-Id: If96a40c5490d91b67e061158b2b92af90c05d4d2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372602
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-21 15:44:33 +00:00
Paul Berry 63de2edc74 Build out analyzer type inference logging implementation.
The type inference logging infrastructure in the analyzer is built out
to include the following functionality:

- Tracking of type inference of annotations, collection elements,
  patterns, and statements.

- Tracking of method lookups.

- Tracking of the generic type inference process, including type
  formals, constraints that were generated (and their sources),
  partial solutions, and the final types chosen.

It is not yet possible to invoke this functionality on the command
line; I plan to introduce a mechanism for doing so in a follow-up
commit.

Change-Id: I3f592a483b272fcea74c1e31bc51f2c5c3623bc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/363240
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-06-21 15:41:48 +00:00
Martin Kustermann 9761ccff6f [dart2wasm] Remove runtime blob to/from js string helpers, use JS<>() instead
This removes the special runtime blob for string conversions, instead we
make 2 functions for conversions use our built-in `JS<>()` support.

This will allow specializing the implementation in a future CL.

Change-Id: I06df25ed805042c0a3e2efb966eaebd1ce67dc0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372660
Commit-Queue: Martin Kustermann <kustermann@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
2024-06-21 15:36:29 +00:00
Brian Wilkerson c475a7ebcd Add a method that returns the candidate suggestions
The intent of the new method is that it can be used to get the candidate
suggestions before they are sent to the suggestion builder, making it
easier for us to skip the suggestion builder (in the future) and
translate directly into the apporpriate protocol objects.

Change-Id: I4cb185f9076e559dd131870f9c3f05bc4fc883f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372601
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-21 15:09:08 +00:00
Ömer Sinan Ağacan 844ced8016 [dart2wasm] Move list implementations to their own library
This WasmArray-backed list classes to `dart:_list`, similar to
`dart:_string` and `dart:_typed_data`

This will allow having internally-public list members like unchecked
getters and setters that we will use in the rest of the standard
library.

This CL doesn't add anything new, just renames things.

- `dart.core._ListBase` -> `dart._list.WasmListBase`

  This is to avoid confusion with `dart.core.ListBase` (defined by Dart
  standard library), and also to be consistent with `WasmTypedDataBase`
  and `WasmStringBase`.

- `dart.core._List` -> `dart._list.ModifiableFixedLengthList`

  Similar to the above, to avoid confusion with `dart.core.List`.

- `GrowableList.ofOther` -> `GrowableList.fromIterable`

  `ofOther` sounds like it should make a growable list from another
  growable list, but the type is more general than that. To reflect what
  it actually does we call it `fromIterable`.

Tested: Existing tests.
Change-Id: I24398765e1b0d549fc70b03ba94161479c5fc54c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372622
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-06-21 14:46:58 +00:00
Johnni Winther 81badfad5d [cfe] Move LibraryBuilderImpl.becomeCoreLibrary to subclasses
This prepares for moving `SourceLibraryBuilder.addBuilder` to
`SourceCompilationUnitImpl`.

Change-Id: Ia6a8a678c21ef66a92f41fd061ef26136ab52893
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372425
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-06-21 11:00:39 +00:00
Jens Johansen efb380708d [CFE] Fix lint_suite not ignoring exports in api_unstable in presubmit
The presubmit has a different working dir than expected, making the
check not work (which has resulted in some status entries that shouldn't
have existed).
This CL sets the working directory for the presubmit making the check
work.

Change-Id: I7535050c73af6cd5ae7957c63c85fb2c3b33813d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372624
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-06-21 10:07:29 +00:00
Jens Johansen 5ad31d95bb [CFE] Fix outline_suite time-regression on using generateKernelInternal in expectation tests
After 9a9b33eb0b running the outline suite
got noticeably slower.
For whatever reason it wasn't noticed until now though.

```
$ out/ReleaseX64/dart pkg/front_end/test/fasta/outline_suite.dart --traceStepTiming
[...]
[ 05:02 | 100.0% | + 2914 | -    0 ]: outline/wildcard_variables/unnamed_optional_parameter_no_default


             check errors: 0:00:00.301055 ms
      ErrorCommentChecker: 0:00:00.455464 ms
stress constant evaluator: 0:00:00.810962 ms
              write .dill: 0:00:01.040020 ms
                    print: 0:00:01.048330 ms
                   verify: 0:00:06.864096 ms
       match expectations: 0:00:07.527595 ms
                typeCheck: 0:00:12.512297 ms
                  outline: 0:04:31.713300 ms
```

The reason is that the outline also serializes the entire component (including the platform).
This CL disables that and instead gets (back) to:

With this CL:
```
$ out/ReleaseX64/dart pkg/front_end/test/fasta/outline_suite.dart --traceStepTiming
[...]
[ 01:15 | 100.0% | + 2914 | -    0 ]: outline/wildcard_variables/unnamed_optional_parameter_no_default


             check errors: 0:00:00.347309 ms

      ErrorCommentChecker: 0:00:00.438746 ms
stress constant evaluator: 0:00:00.915786 ms
              write .dill: 0:00:01.092630 ms
                    print: 0:00:01.108090 ms
                   verify: 0:00:07.156487 ms
       match expectations: 0:00:08.019510 ms
                typeCheck: 0:00:14.013395 ms
                  outline: 0:00:41.738619 ms
```
Change-Id: I1fd7486384b34a54ec86b884f102eae6963508f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372483
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-06-21 10:06:08 +00:00
Jake Macdonald 51939f1454 add type parameters when creating augmentations
Bug: https://github.com/dart-lang/language/issues/3922
Change-Id: I9d9f6ce898e16e2ed393ae77f0dbcbf9c75fb56d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372580
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-06-21 07:57:33 +00:00
Chloe Stefantsova 476d126510 Revert "[cfe] Process invocations eagerly"
This reverts commit 282893db9e.

Reason for revert: breaks roll of flutter into google3.

Original change's description:
> [cfe] Process invocations eagerly
>
> Some invocation nodes, such as redirecting factory invocations,
> type-aliased constructor invocations, and type aliased factory
> invocations, were unaliased and resolved via lists of delayed
> processing actions. That was due to dependencies of the processing
> actions on each other.
>
> This CL untangles the dependencies and processes the invocations
> eagerly. Namely, the redirecting factory constructors are processed
> before all other nodes that may require unaliasing and resolving. The
> eager processing of nodes eliminates the need for fragile filtering of
> the nodes that may require post-processing.
>
> Change-Id: I3e6971515a974c01eced31aa68bf72399dcfa8b8
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372280
> Reviewed-by: Johnni Winther <johnniwinther@google.com>
> Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>

Change-Id: Ib2a9da524a763396559e48aec70f2581e85ebdd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372620
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-06-21 07:02:40 +00:00
Paul Berry abe6ad5400 Simplify and improve MethodInvocationResolver._resolveReceiverDynamicBounded
This change makes the following improvements:

- The setter for `nameNode.staticElement` is always
  invoked. Previously it was only invoked when storing a non-null
  element. In principle this shouldn't make a difference (since static
  elements default to `null`), but it should hopefully make the code a
  little easier to reason about.

- In the case where the `receiverType` is `InvalidType`, no other
  resolution is attempted. Previously, in this case, an attempt was
  still made to resolve the method invocation to a member of `Object`,
  which kind of went against the intended behavior of
  `InvalidType`. Also, if a matching member of `Object` _was_ found,
  then `nameNode.staticType` would get set more than once, making it
  more difficult for the reader to understand what the code was doing.

- In the case where the method invocation resolves to a method of
  `Object`, `nameNode.staticType` and `node.staticInvokeType` are set
  to the type of that method. Previously they were not set at all in
  this case (but they were set in all other cases).

In addition the logic is more straightforward, since the various AST
properties are always set in the same order by straightforward inline
code.

Change-Id: I246a2e9c53542b1e4b26d5197708e66e7988789d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372561
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-06-20 22:03:39 +00:00
Alexander Markov 6ca015ab20 [vm] Cleanup obsolete pragma vm:non-nullable-result-type
Since sound null safety, 'vm:non-nullable-result-type' pragma is
no longer useful as the same information is conveyed by a non-nullable
return type.

TEST=ci

Change-Id: Ie6a61aca38cfea47cb005b12ca7f0d7631791024
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372200
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
2024-06-20 20:24:44 +00:00
Parker Lougheed 96eb11f052 Update various flutter.dev links to more stable destinations
Bug: https://github.com/flutter/website/issues/10363
CoreLibraryReviewExempt: Just updating link in API doc.
Change-Id: I6c4dc17206410fa86e88b4630c8056a994e18967
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372381
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
2024-06-20 19:30:02 +00:00
Kallen Tu bf31d0ea04 [cfe] Class type parameters wildcards are non-binding.
Wildcard type parameters are not added to the scope of the class. They do not collide with other wildcards or other wildcard type parameters.

Bug: https://github.com/dart-lang/sdk/issues/55655
Change-Id: I473a5023c570623fe2a11df5c07d491082bab642
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371943
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2024-06-20 19:27:10 +00:00
Parker Lougheed 818f97783c [linter] Avoid one-off classes in flutter-related box rules
Change-Id: Ie0d8d2f66eb2c5ab5a4664eeaa588c623a395a65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371786
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
Auto-Submit: Parker Lougheed <parlough@gmail.com>
2024-06-20 19:21:58 +00:00
Danny Tuppeny c34f79355f [dartdev] Fix analysis test failing on Windows due to drive letter casing mismatches
On the bots, the system temp directory has a lowercase drive letter (`c:\`) but the analyzer normalises the path to uppercase. The output for the error being used in the test contains a complete path so this allows for casing differences.

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

Change-Id: Id85fba7965a64a83783e7eb8e180cac0a5df9a1a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372300
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Sam Rawlins <srawlins@google.com>
2024-06-20 18:40:15 +00:00
Brian Wilkerson b0dabf03da Fix a bug in the completion metrics tool
Change-Id: I890fbc5ca722f839b7e375ba4fbc41700c629566
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372521
Auto-Submit: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-06-20 18:10:59 +00:00
Keerti Parthasarathy bcbe3a54ff Fix bug in AddDiagnosticReference when using it via CLI.
Fixes https://github.com/dart-lang/sdk/issues/55772.

Change-Id: Ic77f67486f71bdfea726ea3161d83728326b2c5b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372120
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-06-20 18:10:32 +00:00
Sam Rawlins ae3de54bbb Tidy up LintCode docs before making public API
Work towards https://github.com/dart-lang/sdk/issues/50986

Cq-Include-Trybots: luci.dart.try:flutter-analyze-try,analyzer-win-release-try,pkg-win-release-try
Change-Id: I60d378da27570f6b76a554685802d3b888edee0d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372182
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Sam Rawlins <srawlins@google.com>
2024-06-20 16:44:45 +00:00
Johnni Winther 9a2d6f12b6 [cfe] Remove StackListenerImpl.libraryBuilder.
Change-Id: I051adec1de7597f35ab246dfe4dc5b6b5353c378
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372301
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-06-20 14:58:28 +00:00
Ömer Sinan Ağacan a954aa0200 [dart2wasm] Move JSStringImpl to dart:_string
This moves `JSStringImpl` class from `dart:_js_types` to `dart:_string`.

This allows implementing a common base class with unchecked operations
to all string classes as internal methods (so users won't be able to
call them via `dyanmic`), and extension methods to call these unchecked
methods in libraries like `dart:convert`.

Uses of these methods are introduced in
https://dart-review.googlesource.com/c/sdk/+/372443.

Change-Id: Ie4cfe778654c42d62bc4a90391fe349fa783a42c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372442
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2024-06-20 13:08:03 +00:00
Johnni Winther 08768435d9 [cfe] Move imports/exports to SourceCompilationUnitImpl
Change-Id: I1cb5c38e98d8db7bfedac32c6df359fc505a9d65
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372083
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2024-06-20 09:41:35 +00:00
Johnni Winther e40cad30a3 [cfe] Move fasta/codes/ to src/ and rename to cfe_codes*
Part of removing uses of 'fasta'.

TEST=existing

Change-Id: Ibf144a126d8ff4ba15b6cfd2c4fb898e9a499362
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371685
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2024-06-20 09:36:39 +00:00
Lasse R.H. Nielsen a505bbc6a0 Add TypedDataList superinterface on typed data lists.
Adds an interface which implements both `TypedData`
and `List`. That allows abstracting over types that are both
`List` and `TypedData` without losing access to one of the
interfaces.

Tested: typed_data_interface_test.dart
Change-Id: Idbdfc084ea5d2d9a072887973e2e9d29a5fd94ce
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/371100
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2024-06-20 08:18:38 +00:00
Chloe Stefantsova 282893db9e [cfe] Process invocations eagerly
Some invocation nodes, such as redirecting factory invocations,
type-aliased constructor invocations, and type aliased factory
invocations, were unaliased and resolved via lists of delayed
processing actions. That was due to dependencies of the processing
actions on each other.

This CL untangles the dependencies and processes the invocations
eagerly. Namely, the redirecting factory constructors are processed
before all other nodes that may require unaliasing and resolving. The
eager processing of nodes eliminates the need for fragile filtering of
the nodes that may require post-processing.

Change-Id: I3e6971515a974c01eced31aa68bf72399dcfa8b8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372280
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-06-20 07:02:23 +00:00
Brian Wilkerson 5fc437e6f2 Use shared mock packages in linter
I believe that this removes the last of the mock packages from the
linter. I went ahead and created shared mock packages for everything
supported in 'analyzer' even though the linter doesn't use all of them.

Change-Id: I83a9f83a9c9cca7c6969ffade3d0b11c1ec54fd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372220
Reviewed-by: Sam Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-06-19 14:07:19 +00:00
Johnni Winther 7ed610de1d [analyzer/cfe] Replace StackListener.importUri with isDartLibrary
The [StackListener.importUri] property is problematic because it assumes
or implies that when a compilation unit is being parsed, the import URI
for the containing library is known. This might not be the case if a part file is read before the main library file.

Currently the [StackListener.importUri] is only used to detect whether
the current file is part of a `dart:` library, so the property is replace with [isDartLibrary] which does just that.

Change-Id: I2d2baf2fe20bb62fd1922864c0e5af95e8fd1ca7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372084
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-06-19 12:47:21 +00:00
Daco Harkes 4f8e65318d [test] isVmAotConfiguration in custom configurations
https://dart-review.googlesource.com/c/sdk/+/352863 standardized AOT
detection in tests. However, this didn't work for custom configs.
This wasn't caught on our CI, as the CI only uses predefined configs.

For custom configurations, fall back on the executable name to
determine the runtime. (Which is what the failing tests in the linked
issue used before the the referred CL.)

TEST=Manually tested.

Closes: https://github.com/dart-lang/sdk/issues/56041
Change-Id: I17ac731d2137020880defd254c3d006b55f7cf29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/372260
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-06-19 08:49:29 +00:00