Commit graph

46891 commits

Author SHA1 Message Date
Jens Johansen 90add382e4 [CFE] Make macros work (more?) in the incremental compiler
Change-Id: I442bc817c91010690326d25327e919d53dbfce0e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360864
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-04-05 10:48:49 +00:00
William Hesse 9fcd15941d [test] Add detailed error message to test_runner's results loading
Scripts that load logs and results produced by package test_runner
will print more error details when a results file does not contain
a valid JSON map on each line.

Change-Id: Ia2789dd5c0bf565eb74f6960ec8783201ff9f0ae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359220
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2024-04-05 09:16:25 +00:00
Sergey G. Grekhov 53cf3b4cf0 [co19] Roll co19 to 7faf6c725b88ca0a7296eadb3a6ccdf91665d86d
2024-04-04 sgrekhov22@gmail.com Fixes dart-lang/co19#2589. Fix roll failure (dart-lang/co19#2590)
2024-04-03 sgrekhov22@gmail.com dart-lang/co19#2559. Add more augmenting types tests. Augment extends (dart-lang/co19#2588)
2024-04-03 sgrekhov22@gmail.com dart-lang/co19#2559. Rename and regroup augmentation types tests (dart-lang/co19#2587)
2024-04-02 sgrekhov22@gmail.com dart-lang/co19#2559. Add augmenting types tests. Part 5 (dart-lang/co19#2582)
2024-04-02 sgrekhov22@gmail.com dart-lang/co19#2559. Update augmenting libraries tests according dart-lang/co19#2583 (dart-lang/co19#2586)
2024-04-02 sgrekhov22@gmail.com Fixes dart-lang/co19#2574. Add more augmenting types tests (dart-lang/co19#2581)
2024-04-02 sgrekhov22@gmail.com dart-lang/co19#2559. Add augmenting types tests. Part 6 (dart-lang/co19#2583)
2024-04-01 49699333+dependabot[bot]@users.noreply.github.com Bump actions/checkout from 4.1.1 to 4.1.2 (dart-lang/co19#2585)
2024-04-01 49699333+dependabot[bot]@users.noreply.github.com Bump actions/setup-java from 4.1.0 to 4.2.1 (dart-lang/co19#2584)
2024-03-27 sgrekhov22@gmail.com Fixes dart-lang/co19#2577. Add more chained patterns assignment tests (dart-lang/co19#2580)
2024-03-26 sgrekhov22@gmail.com Fixes dart-lang/co19#2575. Remove null-aware warnings for CFE (dart-lang/co19#2578)
2024-03-26 sgrekhov22@gmail.com Fixes dart-lang/co19#2576. Replace `library augment` by `augment library` (dart-lang/co19#2579)
2024-03-25 sgrekhov22@gmail.com dart-lang/co19#2559. Add augmenting types tests. Part 2 (dart-lang/co19#2569)

R=brianwilkerson@google.com, vegorov@google.com

Change-Id: Ibf64d7fdcae0044b7317718ecf7e0852e0983f7d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361161
Reviewed-by: Erik Ernst <eernst@google.com>
Auto-Submit: Sergey Grekhov <sgrekhov22@gmail.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2024-04-05 08:07:40 +00:00
Johnni Winther 63d2008355 [cfe] Make kernel AST and CompilerOptions use strong mode by default
TEST=existing

Change-Id: I8d8bc59dc742a7499338ea2d23a611696492603c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359222
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
2024-04-05 07:45:08 +00:00
Konstantin Shcheglov 240d60c06b Augment. Add AugmentedExpression, AugmentedInvocation.
Change-Id: I15ec8a3bed5ad66600c3b51bf8109ff2089590f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361002
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-05 06:25:03 +00:00
Sam Rawlins df707ac85e DAS: Refactor the logic determining the location of a new ignore-comment
I renamed a few classes, then sorted them, so the diff is big.

Broadly, here is a summary of the code before: two "ignore diagnostic"
correction producers were in place, and the one that inserts a
"ignore_for_file" comment (IgnoreDiagnosticInFile) uses a
`CorrectionUtils.getInsertionLocationIgnoreForFile` function to get an
InsertionLocation object, then passes that to `_computeEdit()`, a
method defined in a parent class. `_computeEdit()` takes that
InsertionLocation object, and uses LineInfo, to determine whether we
need to _append_ to an existing ignore-comment (in which case all
other InsertionLocation information is discarded), or write a full
comment, and use the InsertionLocation prefix and suffix.

To me this was a pretty complicated set-up: IgnoreDiagnosticInFile
calls out to a function defined in a separate library to do "the first
half" of the location calculation. Then the `_computeEdit()` function
has to finish the job, which might involve ignoring computations done
in the first half.

I've changed it to instead be the following design: Each class,
IgnoreDiagnosticInFile and IgnoreDiagnosticOnLine, wholly implements
`compute()` (removing the parent `_computeEdit()` method). The former
class has the much bigger task of finding an appropriate position near
the top of the file in which it can insert a comment. Instead of
tracking a lot of variables along the way, this code quickly calls out
to `insertAt()` as soon as it knows where it is inserting, whether it is
appending, and whether we need a newline before the comment, or after.
So everything about the offset, possible prefix, suffix, and decision
to-append is done in one place. The latter class,
IgnoreDiagnosticOnLine, has a much simpler `compute()`, the most
complex part is determining whether to append to an existing comment.
There is not much duplicated. The `insertAt()` method is defined in
the parent class; it is nice to have a method that is agnostic to the
ignore comment being inserted; it just calculates an indent, and
writes the comment.

Summary of changes:

* AbstractIgnoreDiagnostic, the parent of the two mentioned classes,
  and IgnoreDiagnosticInAnalysisOptionsFile, is actually a base class,
  shouldn't be public, and it's `_computeEdit()` was not relevant for
  the 3rd subclass. So I rename it to _BaseIgnoreDiagnostic, and add a
  new small class in between: _DartIgnoreDiagnostic. The new class
  defines `insertAt()` (only relevant for Dart files), and requires
  that subclasses define their `ignorePrefix`.
* `_isCodeUnignorable` is changed from a method to a getter.
* `DartEditBuilderImpl._linePrefix` is moved to an extension on ResolvedUnitResult, along with some helpers. It is moved to `src/` so
  not technically part of public API. It should be moved to
  server_plugin soon.
* `getInsertionLocationIgnoreForFile` and `getLinePrefix` are removed.

Change-Id: I4757ea2d8a3b43eeec0c8895c5c1fb3edc3ca8a3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361006
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-04-05 00:17:58 +00:00
pq e829bad63c don't camel_case lint augmented extensions
Fixes: https://github.com/dart-lang/linter/issues/4898

Change-Id: I4c4836bc650eb6f5888fde739e1bfcf5858ce9f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361123
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-04-04 23:10:15 +00:00
pq e1d3d67a38 don't camel_case lint augmented extension types
See: https://github.com/dart-lang/linter/issues/4882

Enum support still WIP

Change-Id: Ic538afabbbe693ce92b47f32f8bf66b0cfcc858f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361244
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-04-04 23:04:17 +00:00
Parker Lougheed f2170a9ac6 [analyzer] Mark new package:meta diagnostics as published
Change-Id: I2c4657a189f0590ec9405ea10386932f1c101ee3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361320
Reviewed-by: Marya Belanger <mbelanger@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Marya Belanger <mbelanger@google.com>
2024-04-04 22:47:25 +00:00
Keerti Parthasarathy 6f46971624 Issue 55022: Fix for rename in type arguments.
https://github.com/dart-lang/sdk/issues/55022

Change-Id: I4485b9a4de3c2f0b7d54234c210dda7cdc29adb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361300
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-04-04 21:59:01 +00:00
Konstantin Shcheglov 85f3948d44 Macro. Produce errors / units when a macro impl changes, and the library is invalidated.
Change-Id: I3ceee509f96547e5023cb1a70ca3cc7411da1770
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361305
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-04 21:45:58 +00:00
Konstantin Shcheglov 479b3bdef6 Macro. Issue 55360. Fix types phase when library cycle.
Bug: https://github.com/dart-lang/sdk/issues/55360
Change-Id: Iaddd16f3ba98a5761ff5be551ec8cc280f868fd5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361243
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-04-04 21:23:47 +00:00
Danny Tuppeny da0540dfc7 [analysis_server] Add sync versions of ErrorOr methods and extensions for records
This is a step towards restricting use of `.error` and `.result` in `ErrorOr` to avoid runtime errors (or at least, the wrong runtime errors when error occur).

The reason for adding `.result` was to reduce excessive nesting when functions required the "result" version of multiple things in a chain. This is now handled better using records - we can do:

```
(foo1, foo2).mapResults((foo1, foo2) => ...);
```

This will execute the function only if both values are results and otherwise return the first error. These extensions exist for 2, 3, and 4 field records.

Additionally, I added Sync() versions of several of the helper methods to avoid using `FutureOr` (something that has caused problems with error handline in the past) and needing to `await` in synchronous code that just wants to map results.

This CL does not migrate _all_ uses of `.result` as it would make the CL much larger. Assuming the approach seems good and we will land this, I will migrate the rest.

Change-Id: Ib3f4c390818a8a26467d27c2472f6435055a6bd7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361141
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-04-04 21:08:47 +00:00
Danny Tuppeny e588c8b379 [anaysis_server] Move ErrorOr class from LSP package to analysis_server
ErrorOr is not related to (or used by) the spec or generated spec classes. It's a utility class for the server implementations of LSP handlers.

I'd like to extend this class and add some extensions (that require access to private fields) and don't feel it belongs in `package:language_server_protocol`.

(note: `package:language_server_protocol` is not published so I believe removing it from there is not a breaking change)

Change-Id: I06799b18d61d123364711a549231134c792e70e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-04-04 18:51:27 +00:00
Paul Berry 8566b772f7 Stop using AstNode.setProperty to store bodyContext.
AstNode.setProperty is expensive, since it causes a map to be
allocated for each AST node it's used with. It's more performant (and
IMHO clearer) to simply store a pointer to the bodyContext in the
FunctionBodyImpl.

Change-Id: I3e8856144a6428d408335f8c9b9c5b689e44fc92
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361041
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-04-04 17:57:29 +00:00
Ömer Sinan Ağacan 54910119d8 [dart2wasm] Give names to closures in names section when possible
Currently for `printInt` below:

  void main() {
    void printInt(int i) {
      print(i);
    }

    [1, 2, 3, 4, 5].forEach(printInt);
  }

We generate the name `$main closure at file:///...`.

With this change, when a closure is a function declaration, we use its
name in the generated name. For the example above we now generate:
`$main closure printInt at file:///...`.

Fixes #55279.

Change-Id: Ia5e8cb512c24ac33be4920c505b9ef33514b10c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361062
Reviewed-by: Jackson Gardner <jacksongardner@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2024-04-04 17:46:08 +00:00
Matan Lurey 497b861187 Add TargetKind.constructor to _DoNotSubmit.
Change-Id: If5ecd6bf015ef6e90761aa5d6d940cd8b021b30d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361280
Auto-Submit: Matan Lurey <matanl@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-04-04 17:45:01 +00:00
Kenzie Schmoll 40f6746c6f Improve documentation for DDS and DTD
Change-Id: I51387b733af9e84509e28e1ba806a8be957232e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360903
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-04-04 15:50:02 +00:00
Moritz b321254093 Add @mustBeConst annotation for parameters which should be
constant.

As const-only parameters are not planned, see
https://github.com/dart-lang/language/issues/1684, an annotation with analyzer support could help a bit at least, see
https://github.com/dart-lang/sdk/issues/29381.

The motivation is to enforce const arguments for methods annotated with
`@ResourceIdentifier`, to be able to record the argument values at build time, see https://dart-review.googlesource.com/c/sdk/+/329961.

Tested: pkg/analyzer/test/src/diagnostics/const_argument_test.dart
Change-Id: I2b8d2dce0c899fc0caa4985d892a5d031c747521
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357701
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Moritz Sümmermann <mosum@google.com>
Reviewed-by: Marya Belanger <mbelanger@google.com>
2024-04-04 15:22:31 +00:00
Paul Berry 4e68819ea8 Stop accepting null as a context in _fe_analyzer_shared.
Now that the analyzer no longer makes a distinction between `null` and
`_` as contexts (https://dart-review.googlesource.com/c/sdk/+/357521),
no longer uses `null` to represent contexts
(https://dart-review.googlesource.com/c/sdk/+/357522), and no longer
passes `null` as a context to the shared analysis logic
(https://dart-review.googlesource.com/c/sdk/+/358662), we can safely
update the shared analysis logic so that it no longer accepts `null`
as a context.

Change-Id: I0512d59405255ef45497885e7668ebc3b12abf58
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358800
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-04-04 14:45:04 +00:00
Nicholas Shahan 5532568778 [ddc] Add configuration to compile with asserts
- Assertions are enabled in the compiler itself. DDC already enables
  assertions in the test code by default. 
- Runs tests in d8.

Change-Id: Ibdf285d9ab182c3859f4724b4c0740579d6d2377
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/349361
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Commit-Queue: William Hesse <whesse@google.com>
2024-04-04 14:40:30 +00:00
Chloe Stefantsova d4d7884324 [cfe] Adjust static type of conditionals in if-null desugarings
Closes https://github.com/dart-lang/sdk/issues/55341

Change-Id: I2eb8ad23e9ccae7a01b07136a0e2f3f2e900ea4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360865
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-04-04 09:14:30 +00:00
Chloe Stefantsova cb64e6e1ed [analyzer][cfe] Add futureType to shared operations
Type constraint generation requires construction of the `Future` type
in order to handle `FutureOr` input types. This CL adds a shared
method for creating `Future` types with the given type argument and
uses the shared method in the constraint generation methods in both
the Analyzer and the CFE.

Part of https://github.com/dart-lang/sdk/issues/54902

Change-Id: I4efa20b39243e8985c3edb819fa6afcf627a645c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359820
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-04-04 06:57:24 +00:00
Chloe Stefantsova 17ebf73d31 [analyzer][cfe] Add TypeAnalyzerOperations.matchInferableParameter
This CL abstracts the notion of a type parameter that the compiler
should infer for. Since the notion of such a parameter is used
throughout the constraint generation, it is represented as another
type variable in the shared interfaces, similarly to Type, TypeSchema,
and other similar abstractions.

The affected regions of constraint generation are the central points
of that algorithm and don't require additional tests since any test
that requires non-trivial type inference exercises a pass through
those points.

Part of https://github.com/dart-lang/sdk/issues/54902

Change-Id: Idc7fe13952c40e748e761cc90ab74e7ccf45ee50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357611
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2024-04-04 06:57:24 +00:00
Kenzie Schmoll c042924d0d Add UnifiedAnalytics service to the Dart Tooling Daemon.
This CL also removes unified analytics code from DDS and DevTools server.

Bug: https://github.com/dart-lang/sdk/issues/55280
Change-Id: I6f1c56cb8dce6f611ee73de7081c0a9cd43187c4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360221
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Elias Yishak <eliasyishak@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-04-04 00:20:32 +00:00
Lau Ching Jun 9f7de83573 Show a message when DAP is connected to the VM service.
Closes https://github.com/dart-lang/sdk/pull/55328

GitOrigin-RevId: d64eca75bce398039151bba38f0b0b0b57e67e3c
Change-Id: Iede71f93140dfbcc14b2597c5d8088b4cff6a133
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360222
Commit-Queue: Helin Shiah <helinx@google.com>
Reviewed-by: Helin Shiah <helinx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-04-03 23:44:58 +00:00
Nicholas Shahan 2379cdc080 [ddc] Enforce more null safety on js interop
- Add a runtime flag to enable checks on non-nullable APIs that
  return values from non-static JavaScript interop.
- Call a new helper method at the call site when these APIs are
  detected to perform the null check.
- Add test file for the cases we can detect and enforce.

NOTE: This does not make non-static JavaScript interop sound.
This only adds more checks to enforce soundness with respect
to nullability in some cases. There are still holes that will
never be closed due to the permissive nature of this form of
JavaScript interop.

Change-Id: I2f88d1543a683fdc84d764e2b0eaafeb0ca73107
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358581
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2024-04-03 23:20:15 +00:00
Sam Rawlins 51d7b8477d DAS: Move two CorrectionUtils methods to DartEditBuilder
`addMethodInsert` and `addCaseClauseAtEndInsert` are only used by code
which combines them with DartEditBuilder, so the change is pretty
simple. A few utilities are needed in DartEditBuilder, which are also
not complicated, such as a utility for getting the existing indentation
string on a line. Using this utility in the shared code should improve
someo of the existing fixes and assists, which didn't use it before.
The same goes for looking at whether left and right brackets are
synthetic. So this change comes with a few minor improvements.

Change-Id: I5b235021ac234b4a50b09dca6d14a28b3f163e5e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360980
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-04-03 20:57:51 +00:00
Sam Rawlins 198339c824 meta: Bump to 1.14.0
Change-Id: I2b1270c3db2031740bbe08587382f04a0f9a63bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361020
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-04-03 20:53:38 +00:00
Brian Wilkerson 03c66f359d Replace constant with value in messages and docs
Change-Id: Id5829e5b9de6b3ca59c0f2fa5e7a534c64c696d4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361001
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Marya Belanger <mbelanger@google.com>
2024-04-03 20:02:40 +00:00
Konstantin Shcheglov ac06b9e006 Macro. Fix for assertEventsText() on Windows, write Posix URIs.
Change-Id: I357259fc2f9b2337df4dffce5ab0f1fb3f876108
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360961
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-03 19:53:22 +00:00
Konstantin Shcheglov 59aecb3493 Macro. Issue 55362. Fix for macro application in library cycles.
Bug: https://github.com/dart-lang/sdk/issues/55362
Change-Id: I10f06f7f41ead61b03a6f3ca08e1a6479d8c6454
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/361000
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-03 19:51:59 +00:00
Derek Xu be04ce25ca [CLI] Ensure that resident frontend compilers never try to compile kernel files or snapshots
Refer to the magic numbers in https://github.com/dart-lang/sdk/blob/main/runtime/bin/dartutils.cc

TEST=pkg/dartdev/test/resident_frontend_utils_test.dart, manual testing

Issue: https://github.com/dart-lang/sdk/issues/54245
Fixes: https://github.com/dart-lang/sdk/issues/49694
Change-Id: I3ba67f4a68898c3f8b24d19a7516e3d8713d886d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359921
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-04-03 19:38:02 +00:00
Brian Wilkerson db218f1af9 Track when suggestions are incomplete
This is in preparation for replacing the NotImportedContributor.

Change-Id: Ic3445372698ceb49811523c35c62cd03490e8399
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360901
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-04-03 18:29:02 +00:00
Sam Rawlins 9680d387ec meta: Add TargetKind.enumValue
In
[the spec](https://github.com/dart-lang/language/blob/main/accepted/2.17/enhanced-enums/feature-specification.md),
these are referred to as "values", so I went with that wording here. In
the analyzer, I found one case where we call them the "constants"
(EnumDeclaration.constants). I'd prefer to stick with the more common
term, "values."

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

Change-Id: I3ea4650fdeb15d3d23fb7ca42bcf6e0ec0e511f7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360661
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-04-03 18:20:59 +00:00
Danny Tuppeny 260ebec7a0 [analysis_server] Fix additional exception fetching CodeLens for missing/unresolvable files
The original code here was accessing `.result` on the result of `requireResolvedUnit` without checking it was an error. This meant if `requireResolvedUnit` failed, we would throw a new exception ("Value is not a result") instead of returning the original one.

Change-Id: I952edaac555eb4fccfb885f3f3c5bffc26ba0e90
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360880
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-04-03 18:19:22 +00:00
Ömer Sinan Ağacan 3db0bdf54d [dart2wasm] Fix typos, formatting in flutter_hhh_builds doc
Change-Id: I68a3f28c78c6241f471c985e1fa836019b1a7dc9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360881
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
2024-04-03 18:12:47 +00:00
Ömer Sinan Ağacan e42a0af8da [ddc] Avoid decoding the whole file repeatedly in assert statements
`Source.text` is the cached `utf8.decode(source)`. Use it instead of
decoding `source` for each `assert` statement.

Change-Id: I118992d8e71d75f048064e12aed32ff396273425
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360820
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2024-04-03 17:09:30 +00:00
Sergey G. Grekhov 35153da674 [co19] Roll co19 to 74b618cc11ea65ced9e017f58893cf565b7b21b9
2024-03-16 sgrekhov22@gmail.com dart-lang/co19#2559. Add augmenting itself tests (dart-lang/co19#2567)
2024-03-16 sgrekhov22@gmail.com dart-lang/co19#2559. Add augmenting types tests. Part 1 (dart-lang/co19#2568)
2024-03-16 sgrekhov22@gmail.com dart-lang/co19#2559. Add merge order tests (dart-lang/co19#2566)
2024-03-16 sgrekhov22@gmail.com dart-lang/co19#2559. Add augmenting types tests. Part 4 (dart-lang/co19#2571)
2024-03-16 sgrekhov22@gmail.com Fixes dart-lang/co19#2572. Fix roll failures (dart-lang/co19#2573)
2024-03-11 sgrekhov22@gmail.com dart-lang/co19#2559. Add applying augmentation library tests (dart-lang/co19#2564)
2024-03-11 sgrekhov22@gmail.com dart-lang/co19#2559. Add tests for augment libraries errors (dart-lang/co19#2562)
2024-03-08 sgrekhov22@gmail.com Fixes dart-lang/co19#2558. Remove `inline-class` experimental flag (dart-lang/co19#2563)

R=kustermann@google.com, pquitslund@google.com

Change-Id: Icdfcf44ecc525c1a673ec8024577cbcdfd316eb0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/359440
Reviewed-by: Erik Ernst <eernst@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Auto-Submit: Sergey Grekhov <sgrekhov22@gmail.com>
2024-04-03 16:03:29 +00:00
Konstantin Shcheglov ad345495ad Augment. Parse 'augment' for enum declaration.
Change-Id: I8360b86d675e423fe1a4e8d501b29a2b30f20fee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360781
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2024-04-03 15:59:49 +00:00
Derek Xu 4f1a4f2968 [CLI] Gracefully handle cases when the default resident server info file is inaccessible
Issue: https://github.com/dart-lang/sdk/issues/54245
Change-Id: Ibfe8d7277bca9d1ef94c9c84248d2a98eb3335ec
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358820
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2024-04-03 15:42:20 +00:00
Brian Wilkerson 7bd45d6767 Minor cleanup in in-scope completion pass
Change-Id: I58c976772790d9de8ee4a0d085cf6e8c0e89dfe5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360742
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2024-04-03 15:06:30 +00:00
Jackson Gardner d0061b65fc [dart2wasm] Include file, line, and condition text in assertion's toString()
This fixes https://github.com/dart-lang/sdk/issues/55317

Change-Id: I2371423a9715059b8a4c4ede2ef567a4b6293287
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360460
Reviewed-by: Lasse Nielsen <lrn@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Jackson Gardner <jacksongardner@google.com>
2024-04-03 14:14:08 +00:00
David Morgan 97be47cf17 [CFE] Fix test broken by introduction of package:macros.
Increase timeout to address flakiness.

R=johnniwinther@google.com

Change-Id: Ia25b6429b057cb4606646b09621293354d8f5d80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360821
Auto-Submit: Morgan :) <davidmorgan@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-04-03 09:10:38 +00:00
Jens Johansen 290520c710 [CFE] Correctly mark dart:typed_data in incremental compilation
Change-Id: I0bcfe38a4a2384d8eef7bec6845100b63f190049
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360644
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Jens Johansen <jensj@google.com>
2024-04-03 09:09:58 +00:00
Ömer Sinan Ağacan 03ce44cfbb [kernel] Clarify AssertStatement offset fields
Say what those offsets are for, instead of what they're not for.

Change-Id: Ia8d0ef119386188d6d880a480d609bb7a324df8e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360643
Reviewed-by: Jens Johansen <jensj@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2024-04-03 08:56:37 +00:00
Brian Wilkerson 769cfb32ba Use the budget to control whether overrides are suggested
I believe that this is the right thing to do from a UX perspective, but
this change could potentially cause flakiness in tests. There's support
in the LSP path for setting a bigger budget, but not for legacy based
tests (at least not yet).

Change-Id: I76353fd3e4cb4cf8fb7a55c27a3353415143dc06
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360740
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-04-03 00:30:00 +00:00
Konstantin Shcheglov c6a82ebf9d Macro. Send dart/textDocumentContentDidChange before analysis.errors
Change-Id: I343d61208f3500e68219257459e167307a55ee78
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360662
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-03 00:03:19 +00:00
Konstantin Shcheglov 5543d88289 AE. Deprecate OnClause, use MixinOnClause instead.
Change-Id: I938a1ff4046851c46c6ae4cebdff25e05e88300f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/360741
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-04-02 23:02:22 +00:00
Nicholas Shahan 5b262d8234 [ddc] Delete _emitPropertyGet
Avoids the use of one method with multiple code paths and returns
to handle any situation because it becomes very hard to reason
about what original source code leads to each path.

Fixes: https://github.com/dart-lang/sdk/issues/54463
Change-Id: I8158ae2a79e0f627f0703e2e253b4406022fc84b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357208
Reviewed-by: Sigmund Cherem <sigmund@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2024-04-02 22:54:23 +00:00