Commit Graph

52243 Commits

Author SHA1 Message Date
FMorschel bc4e201375 [DAS] Fixes missing case for create class
This also adds a new priority for mixins when the written type name starts with lowercase letters (to match the class existing ones) and tests the priority between it, create class and import fixes.

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

Change-Id: Ie451db6a273fe8eb52df21725276068b1980e7f1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433500
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-09 15:10:50 -07:00
Sam Rawlins c219974ecf analyzer: Deprecate Diagnostic.errorCode in favor of diagnosticCode
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I2c7d64a81bc214e64fbc3ac95cf1fe2363a6ebd0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433242
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2025-06-09 09:22:22 -07:00
Brian Wilkerson b0adb4185e Convert upper snake case fields to lower camel case
There are no semantic changes in this CL, just renames.

The one unfortunate rename was from `DEFAULT` to `default_`. It can't be
`default` because that's a built-in identifier. If you have a better
convention to follow here I'm happy to change it.

Change-Id: Idf70621ad577dbea6c1c161aac17e9e200aac2d0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433440
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-09 07:35:37 -07:00
Sam Rawlins bddcddfe6b analysis_server: use new Diagnostic name over AnalysisError
Work towards https://github.com/dart-lang/sdk/issues/60635

Change-Id: I5cc0cc66afd3531271eb8dc337556505cb21c074
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425962
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-06 16:00:25 -07:00
Brian Wilkerson 3502a35cf7 Add a context message to not_a_type diagnostics
Fixes https://github.com/dart-lang/sdk/issues/55947

Change-Id: I38b838c59d3c2983ac26efda7a5ab20f3d29485e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433362
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-06-06 14:23:32 -07:00
Kallen Tu 5a17591682 [analysis_server] Dot shorthands: Hover work and tests.
Added some extra logic for handling dot shorthands in hovers. They should show the same information in the hover as if we had added the type in front of `.`.

Added a new line "Declared in:" to show the containing class information.

Bug: https://github.com/dart-lang/sdk/issues/59836, https://github.com/dart-lang/sdk/issues/60864
Change-Id: If159d53b7c4443d8a8311125ceef66c441d39d4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431944
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-06-06 13:35:19 -07:00
FMorschel bd2a0e6a5e [DAS] Fixes keyword/type in auto-completion for pattern matching
Fixes: https://github.com/dart-lang/sdk/issues/59854

Change-Id: Ic7a0dee51eb45792520ae49d935510e8669f94ff
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/417222
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-06 13:31:50 -07:00
Keerti Parthasarathy 426227b3ac [Completion] Fix for adding duplicate suggestions for Keywords 'covariant' and 'this'.
Change-Id: I736ad405791638bf8be0eb898e72ccb7983abfb2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2025-06-06 12:58:23 -07:00
Stephen Adams 23ba783c4c [dart2js] Use null-aware elements
Change-Id: I2dc74c57efd355ab4871eb2ad48a97fc817a2940
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433300
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2025-06-06 12:45:17 -07:00
Kallen Tu 5ccfa844da [analysis_server] Update bullets on language feature checklist.
The bullets on this doc were bugging me because they were confusing which tasks were subtasks of one another. I made them all into checklist bullets (since that's what's most useful for me anyways) and it looks much better.

Change-Id: I593ceb7db5ae39ffda52a2a2e481b1c53a5a7784
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433360
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2025-06-06 11:57:10 -07:00
Ivan Inozemtsev 3f2befef35 Revert "[dart2js] Do some load elimination in simplifier"
This reverts commit ff583f2e2e.

Reason for revert: b/422944368

Original change's description:
> [dart2js] Do some load elimination in simplifier
>
> Doing load elimination of final fields earlier generates more
> opportunities for GVN.  This helps when the same value is 'boxed' in a
> wrapper object and the 'unboxed' multiple times.
>
> Change-Id: Id3a2b392a7563bae7a4cd1f8b2763c5ac1b377b5
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432502
> Commit-Queue: Stephen Adams <sra@google.com>
> Reviewed-by: Mayank Patke <fishythefish@google.com>
> Reviewed-by: Nate Biggs <natebiggs@google.com>

Change-Id: I97f06e46b193394df6393296d504965f959bcfa9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433340
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Mayank Patke <fishythefish@google.com>
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
2025-06-06 11:32:11 -07:00
Sam Rawlins 0f41778adf linter: merge most of the impl of discarded and unawaited futures rules
Change-Id: I784b383dc14f2f74036a4c70cafee6b9454c22eb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/428561
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-06 11:26:41 -07:00
Paul Berry 0da11d5464 [flow analysis] Share more code in tests of try/finally ordering.
This change introduces some helper functions to avoid duplication
between the enabled/disabled variants of each of the try/finally
ordering tests.

Thanks to Lasse for the suggestion.

Change-Id: I4538d44643fde7954a75bc1b6843fcc805d8afc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432782
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-06-06 11:01:42 -07:00
Nicholas Shahan 9cdc4a1963 [ddc] Reformat pkg/dev_compiler
Something seems wrong with the previous formatting. This change formats
with language version 3.8 again.

Change-Id: I077d635d815fa82ddf1153122ee3082787e1dd73
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433301
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
2025-06-06 09:14:23 -07:00
Paul Berry e208c2c636 [flow analysis] Rework tests of try/finally ordering.
This change adds test-only methods `propertyPromotionChainForTesting`
and `variablePromotionChainForTesting` to flow analysis; these are
used by the flow analysis unit tests to query the full promotion chain
of a porperty (or variable, respectively). This allows tests to
observe the effect of try/finally ordering on promotion chains without
having to resort to clever control flow joins.

Thanks to Lasse for the suggestion.

Change-Id: Ida5349ecc93dbd4b3392becd20882be3eb101024
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432800
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2025-06-06 08:47:41 -07:00
MarkZ bbc99947c9 [ddc] Rolling internal dart_library.js into the external module loader.
Change-Id: If25fd9ac78d795d16b7edca507df0b806a0ebf39
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433262
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2025-06-06 07:20:10 -07:00
FMorschel fae7752e9e [DAS] Adds tests for fix priorities and new priority for Create class
The related issue asked for a new priority for the `Create class` fix
that would be lower if the undefined name was lowercase, giving the
`Create method` and `Create function` fixes a higher relative priority.

This change also adds a new abstract class to test the relative priority
between fix kinds. It is also used to test agains the merge combinators
fixes.

Fixes: https://github.com/dart-lang/sdk/issues/60523
Change-Id: I938f52a577ecf1b6bb8dd66c94fd45395a011ffa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/422321
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-05 16:58:40 -07:00
FMorschel f0ad03cabf [DAS] Adds fixes for implicit_this_reference_in_initializer
Fixes: https://github.com/dart-lang/sdk/issues/60729
Change-Id: Ie2ee6ff84062b749a9a8385a3140f9bc35760df2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/429081
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-05 16:17:39 -07:00
Brian Wilkerson 4fbb4dc6ee Fix the field formal parameter to normal parameter assist
This disables the assist if the field formal parameter happens to also
be an older style function typed parameter. As written the assist
produces invalid code, and the older style is strongly discouraged so
not supporting it shouldn't impact very many users.

Change-Id: I44a3942b4656265bb1cbbba29e68fff61962b689
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433260
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-05 14:30:09 -07:00
Sam Rawlins 903d77cc82 analyzer: Rename ErrorListener classes to DiagnosticListener
Work towards https://github.com/dart-lang/sdk/issues/60635

I tried to keep this minimal but still sensible:

* Rename AnalysisErrorListener and all subtypes to use 'Diagnostic'.
* Rename all instantiations of such classes if they previously
  contained the word 'error'.
* Rename `RecordingDiagnosticListener.errors` to `.diagnostics`.
* Rename some _testing_ instance members that had the word 'error'
  to instead use 'diagnostic'.

Change-Id: I3948e27ba28ac2494092e04f4e1d201a20cc1135
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433004
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-06-05 14:05:40 -07:00
Stephen Adams 73d9a8d08b [dart2js] Cleanup
Rename DummyInterceptorConstantValue to DummyConstantValue. It was
actually used as a dummy *receiver* argument and could be used against
any unused parameter.

Remove unused CompilerOptions argument in SSA as-checks and is-tests.
Pass the checked input explicitly to facilitate testing on other inputs (e.g. to do partial redundancy elimination by pushing the operation into the arms of a phi.)

Change-Id: I4b450bfcf5fc877de731bf83201e3c9248ffcb0c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433104
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2025-06-05 13:53:16 -07:00
Stephen Adams ff583f2e2e [dart2js] Do some load elimination in simplifier
Doing load elimination of final fields earlier generates more
opportunities for GVN.  This helps when the same value is 'boxed' in a
wrapper object and the 'unboxed' multiple times.

Change-Id: Id3a2b392a7563bae7a4cd1f8b2763c5ac1b377b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432502
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Mayank Patke <fishythefish@google.com>
Reviewed-by: Nate Biggs <natebiggs@google.com>
2025-06-05 13:21:13 -07:00
Brian Wilkerson edce10b761 Add an assist to convert from a field formal parameter to a normal parameter
Fixes https://github.com/dart-lang/sdk/issues/60852

Change-Id: Iffc674e61b4df16e80ca71cfd18e12c548770b54
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433220
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-05 12:33:34 -07:00
FMorschel 9d6c5d40d0 [DAS] Fixes "Go to declaration" for undefined new constructor
Fixes: https://github.com/dart-lang/sdk/issues/60773
Change-Id: I7ee7cec371fbf0d0f9de1a4fe2b946929ba80d61
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432741
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Felipe Morschel <git@fmorschel.dev>
2025-06-05 12:08:44 -07:00
Brian Wilkerson 45722db629 Add documentation for dot shorthand diagnostics
Please let me know if there are other diagnostics that I missed.

Change-Id: I87d29f62bcd1dad519c34212a2aa41d4422f1002
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431949
Reviewed-by: Kallen Tu <kallentu@google.com>
Reviewed-by: Amanda Fitch <afitch@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-05 10:58:09 -07:00
Danny Tuppeny 9df000075a [analysis_server] Exclude blocks/switch cases from Inline Values unless execution is within them
This prevents inline values showing up alongside code that didn't execute in conditional blocks. It does also mean they don't know up in conditional blocks that _did_ execute one execution has fallen out of them, but I believe this is the best we can do with the current LSP APIs (unless we try to track execution across requests, but that would probably be complete and not entirely reliable).

Fixes https://github.com/Dart-Code/Dart-Code/issues/5454

Change-Id: Ia1cf2437b76844ff0a6aeeb958d769c9523dc5dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433200
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-05 10:53:12 -07:00
Nicholas Shahan 60d418034a [ddc] Bump language version to 3.8
* Reformat pkg/dev_compiler.
* Re-flow some comments to keep them within 80 characters.

Change-Id: I0849ce113ecf3dce4a2b4405c2b09a17dee4df76
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433081
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2025-06-05 10:40:57 -07:00
Nicholas Shahan 6697075645 [ddc] Fix spelling typos
Change-Id: Iafcf14be1fd3032381b4ced2610230538100ce52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433080
Reviewed-by: Mark Zhou <markzipan@google.com>
2025-06-05 10:40:57 -07:00
Sam Rawlins e76fcdad1a analyzer: Remove TODO that is DONE
Change-Id: I15a85d31b797d99d68c94b3c0fe433c18d9effbe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432905
Commit-Queue: Paul Berry <paulberry@google.com>
Auto-Submit: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-06-05 09:43:32 -07:00
Danny Tuppeny b8daa53fef [analysis_server] Don't rebuild contexts on deletion of an analysis root
This is a partial revert of ca9523058e (it removes the behaviour change and the test that verifies this, but leaves two additional tests that were added relating to roots that are created later).

If we rebuild contexts when a root is deleted, we may get stuck in a loop because we will again try to recreate the same (deleted) root, and then the watcher will close in a way that looks like a deleted folder, and we will repeat.

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

Change-Id: I10289160b341d273e8e409184a1c013c7fb9439d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433140
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-05 09:24:41 -07:00
Nate Biggs 26e9c8201a [dart2js] Don't emit deferred loading logs in part files when flag is disabled.
Change-Id: I70a3a3a3c7bd56d8fd994e766f0ab2ab8c1f9ec4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432820
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2025-06-05 09:17:11 -07:00
Derek Xu c9c8929099 [package:vm_service] Add kTimerSignificantlyOverdue field to EventKind
I overlooked making this additon earlier. This CL also prepares
`package:vm_service 15.0.2` to be published.

TEST=CI

Change-Id: I4d28d87c027d27c4e532e5608f57b62eaa290e44
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433082
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2025-06-05 07:34:51 -07:00
Danny Tuppeny e891cac045 [dds/dap] Handle some additional kinds of errors when the VM Service connection shuts down
This handles an RPC Error -32000 with text "Service connection disposed" as reported in https://github.com/dart-lang/sdk/issues/60851. It extracts some of this logic into an extension on RPCError to simplify checking in multiple places.

Unfortunately I can't reproduce the specific conditions that produce this error in a test (it probably requires terminated the VM Service at just the right time during startup or an isolate starting?).

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

Change-Id: Iae945f60290766164d04b91d851fbb8b58f178c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432944
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2025-06-05 07:26:16 -07:00
Jake Macdonald bf9acedc73 Adds a new helper resolveTestRelativePath for resolving paths relative to the test dir, which works using the package config instead of Platform.script. This allows it to work via dart test as well as the test runner, or when manually invoked.
Replaced usages of Platform.script.resolve with this utility.

Change-Id: I904d281934c3eb42516e891f27a8f3dbe714e7f6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432740
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-06-05 07:23:15 -07:00
Kenzie Davisson 495a2bb694 Update to latest DevTools hash
Change-Id: I3ecb7e661b606907186c0a81b16eecefe4d63a4f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432803
Commit-Queue: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Ivan Inozemtsev <iinozemtsev@google.com>
2025-06-05 04:13:34 -07:00
Sam Rawlins b2beba242d analyzer: Convert callers of InheritanceManager3 to use InterfaceElement API
This includes all callers in analysis_server and analyzer_plugin. And
callers of `getOverridden4`.

Change-Id: Ia744f6c7260b445c6b1e02d3cf5515aaa9c7feeb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432962
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-04 16:30:22 -07:00
Sam Rawlins c4c3a72bd4 analyzer: Move error_supporession_test.dart
Work towards https://github.com/dart-lang/sdk/issues/60635

Also rename the test methods to use camelCase and to read more like
sentences.

Change-Id: If4ef85aeeefc5f1364ffbcba2e73df36981fc951
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432961
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-06-04 16:06:14 -07:00
Brian Wilkerson 1a7617e015 Improve the message for non_exhaustive_switch diagnostics
Fixes https://github.com/dart-lang/sdk/issues/60690

Change-Id: I1431d646a53c39b738369493b6a234df440dc2f0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/433100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-04 15:17:19 -07:00
Brian Wilkerson 0404c6cd08 Add some message scheduler data to the collected report
Change-Id: I086b741a90955a2753efbabdf1c3cb321de98ee0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432903
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2025-06-04 15:08:20 -07:00
Danny Tuppeny 8d36178a43 [analysis_server] Move support for locking requests to the scheduler
This removes the original `lockRequestsWhile` functionality of the LSP server which worked by pausing reading from stdin to instead pause the processing of messages in the scheduler.

Change-Id: I737e977adee11fe6fc70f44185cfaa22c22805da
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432342
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2025-06-04 15:06:12 -07:00
Sam Rawlins 47f7c4fb87 analyzer: expose canBeConst and computeConstantValue as public API
Work towards https://github.com/dart-lang/sdk/issues/50986

These utilities are used by a handful of lint rules, and the analysis
server, which makes me think they could be offered as public API.

Change-Id: I12415c2b86ca6fb96b03def4a304da73c6fb4cae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430300
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-06-04 11:02:17 -07:00
Sam Rawlins 508c35b6f0 linter: unawaited_futures: narrow the reported range, matching discarded_futures
Change-Id: Id8a361a352e409df0a8c9cc9fa73a9f7b5e52c3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431365
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
2025-06-04 09:26:31 -07:00
Kenzie Davisson 0010cc416f Use constants instead of raw strings throughout package:dtd
Change-Id: Ie4b0dfb115a820fb3f0741ce193c70f6b7d560cc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432725
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
2025-06-04 08:52:33 -07:00
Danny Tuppeny b1751e6871 [analysis_server] Update some tests to not required useLineEndingsForPlatform=false
Change-Id: I5eafe194465e20942ebea6989a75679d1a9bb866
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432980
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-04 08:45:59 -07:00
Danny Tuppeny 9756ab92db [dds/dap] Include paging data for variables returned as top-level results to evaluateRequest
This reuses the existing code for child variables for building responses to `evaluate` so that we compute lengths for paging data. We have to copy them over from the variable to the EvaluateResponse because these are two unrelated types that happen to have the same fields for this data.

Fixes https://github.com/Dart-Code/Dart-Code/issues/5532

Change-Id: I7ca4c522cdb27ce8dce3f7c3a78189417eb93bf1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432941
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2025-06-04 08:35:03 -07:00
Keerti Parthasarathy 25b99786d1 [Completion] Fix for adding duplicate keywords like 'dynamic' when in a declaration.
Change-Id: If8e35edd5ee136b0d272f1ea43a705cf04540bbc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432821
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2025-06-04 08:31:37 -07:00
Danny Tuppeny 0f161e3ebe [analysis_server] Allow documentation preferences to be different between completion/hovers
For https://github.com/Dart-Code/Dart-Code/issues/4729 we added a configuration setting to let you control how much documentation was included in responses. The motivation here was to reduce the completion payload sizes when running in remote workspaces (Dart-Code would adjust the default setting if not explicitly set by the user based on the workspace kind).

However in hindsight, forcing no docs on Hovers just because we didn't want them in Completion requests was a bad choice, because these are individual requests where the payload size is less important and seeing the docs is useful.

So this alters the setting to accept a `Map` to allow you to have different preferences for each request that returns docs. Dart-Code will be updated to adjust the defaults accordingly (after this lands) so that Hover/SignatureHelp can default to `"full"` even in remote workspaces.

Work towards https://github.com/Dart-Code/Dart-Code/issues/5499

Change-Id: Ib64f762a0559c7afc7653fad9749fc208beee8b3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431280
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2025-06-04 07:51:45 -07:00
Chloe Stefantsova c542a1e82f [model] Remove support for subtype checks ignoring nullability
Change-Id: I4a43e09094d79c7b5e59eb03cbe7eb676808a5f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/426121
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2025-06-04 06:52:57 -07:00
Paul Berry eec56c088e [flow analysis] Mark false branches of trivial is tests unreachable.
When an `is` test is trivially satisfied (i.e. `expr is T`, when the
static type of `expr` is a subtype of `T`), the `is` test is
guaranteed by soundness to evaluate to `true`, so any code path that
follows from the `is` test evaluating to `false` is unreachable.

This reasoning wasn't valid prior to sound null safety, because in
mixed mode programs, it was possible for an expression to evaluate to
`null` even if its static type wasn't nullable, and hence `expr is T`
might evaluate to `false` even if the static type of `expr` was a
subtype of `T`. So this change is gated on the `sound-flow-analysis`
language flag (which is enabled in Dart 3.9).

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

Change-Id: I66a65580b738162f23b6fb468b71fcac66bfbb95
Bug: https://github.com/dart-lang/sdk/issues/60718
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/431740
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2025-06-04 05:17:21 -07:00
Johnni Winther 27952c5368 [cfe] Remove ConstructorDeclarationBuilder
This interface is no longer needed since SourceConstructorBuilder is the
only implementation.

Change-Id: Ic6426d4c0dbc3820e460a1e4fdc69f323c763885
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/432942
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2025-06-04 04:21:24 -07:00