Commit graph

100332 commits

Author SHA1 Message Date
Alexander Markov 17d6ba15b6 [vm] Remove external strings
This change removes support for external strings from the VM along with
Dart_NewExternalLatin1String, Dart_NewExternalUTF16String and
Dart_IsExternalString Dart C API functions.

External strings are not used by the VM nor any known embedder, but
Dart VM was paying the maintenance and performance price for
the external string implementation classes.

TEST=ci

Change-Id: I094cd2d2b7ec0840e9f09e1ca9e5a7acd4e78c28
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358760
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Siva Annamalai <asiva@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2024-03-20 20:08:13 +00:00
Paul Berry 2d1c691625 Propagate non-nullability of contexts through the analyzer codebase.
Now that null contexts are impossible during analyzer resolution
(https://dart-review.googlesource.com/c/sdk/+/357522), it's possible
to make a lot of variables, fields and parameters that represent
contexts non-nullable.

This change propagates non-nullability of contexts through the
analyzer to the extent that can be done reasonably quickly and
safely. In particular, it makes the following changes:

- It changes the following helper methods so that they no longer
  accept a `null` context:
  - TypeSystemImpl.acceptsFunctionType
  - TypeSystemImpl.refineNumericInvocationContext
  - TypeSystemImpl.setupGenericTypeInference
  - TypeSystemImpl._refineNumericInvocationContextNullSafe
  - InvocationInferenceHelper.inferTearOff
  - InvocationInferenceHelper.resolveMethodInvocation
  - ElementResolver.visitMethodInvocation
  - ErrorDetectionHelpers.getImplicitCallMethod
  - ResolverVisitor.insertGenericFunctionInstantiation
  - ResolverVisitor._insertImplicitCallReference
  - ResolverVisitor._resolveRewrittenFunctionExpressionInvocation
  - StaticTypeAnalyzer.visitConditionalExpression
  - StaticTypeAnalyzer.visitIntegerLiteral
  - AstResolver.resolveExpression

- It changes the following classes so that their `resolve` methods no
  longer accept a `null` context (nor do the methods that those
  `resolve` methods defer to):
  - AssignmentExpressionResolver
  - BinaryExpressionResolver
  - ConstructorReferenceResolver
  - FunctionExpressionInvocationResolver
  - FunctionExpressionResolver
  - InstanceCreationExpressionResolver
  - MethodInvocationResolver
  - PostfixExpressionResolver
  - PrefixExpressionResolver
  - PrefixedIdentifierResolver
  - RecordLiteralResolver
  - SimpleIdentifierResolver
  - TypedLiteralResolver

- It changes all the classes in the `InvocationInferrer` class
  hierarchy so that they no longer accept a `null` context.

- It changes the following helper methods so that they no longer
  return a `null` context:
  - AssignmentExpressionResolver._computeRhsContext
  - InvocationInferrer._computeContextForArgument
  - MethodInvocationInferrer._computeContextForArgument
  - YieldStatementResolver._computeContextType

- It changes PropertyElementResolverResult.indexContextType so that it
  no longer can be `null`.

- It ensures that the analyzer always passes a non-null context to the
  _fe_analyzer_shared method `TypeAnalyzer.analyzeExpression`. This
  will pave the way for a follow-up CL that makes that method stop
  accepting `null`.

In many cases, to accomplish this, it was necessary to make explicit
use of the unknown type schema `_`
(UnknownInferredType.instance). Although adding these explicit uses
makes the code a bit more verbose, it's not really fundamentally more
complex than it was before; previously, the code used `null` to
represent `_` in these cases (sometimes implicitly).

Change-Id: I1479e7c59969c59ea67abef30daa6a516b15ed97
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358662
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-03-20 19:58:49 +00:00
pq 200e6d987d rename to unnecessary_library_name
As noted by Lasse, we're not really consistent and the singular is more "correct".

See: 71456592d0 (r140033857)


Change-Id: I55afeab8c42d9f20999e263682f71d54a2302ea5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358682
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-03-20 19:28:52 +00:00
Paul Berry 0abd2f3f75 Make null contexts impossible in analyzer resolution.
The analyzer's mechanism for passing contexts down the stack while
recursively resolving expressions is to add an optional `contextType`
parameter to some of the `visit` methods in `ResolverVisitor`. This
parameter is only included in `visit` methods that would actually use
it (e.g. `visitDoubleLiteral` doesn't have it, since the analysis of a
double literal doesn't depend on the context).

When the resolver needs to analyze a subexpression, if it needs to
supply a context, it uses `ExpressionImpl.resolveExpression` to
dispatch to the appropriate `visit` method; this passes the context
along to the optional `contextType` parameter. If, on the other hand,
it **doesn't** need to supply a context, it uses the standard
AstVisitor mechanism, which dispatches to the `visit` method without
supplying a context type, so the `contextType` parameter takes on its
default value.

Previous to this CL, the default value of each `contextType` parameter
was `null`; this had the unintended consequence of making a
distinction between a `null` context and a context of `_`
(`UnknownInferredType.instance`). The front end, by contrast, has a
visitor paradigm that allows passing a required argument through to
the `visit` method, so its context parameters are all non-nullable,
and it makes no such distinction.

Prior to addressing language issue 3648
(https://github.com/dart-lang/language/issues/3648), the difference
was only observable for `await` expressions. Now that that issue has
been addressed, there is no user-visible difference between `_` and
the null context. But it's easy to imagine a difference accidentally
sneaking in during future development.

To avoid future bugs, this change makes `_` the default value for each
`contextType` parameter. To do this, it was necessary to change
`UnknownInferredType.instance` from a final variable to a const.

To the best of my knowledge, this change should have no user-visible
effect.

Bug: https://github.com/dart-lang/language/issues/3648
Change-Id: Id74a513366831239df2d56ceac57c2dbe5c5084e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357522
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-03-20 18:49:26 +00:00
Paul Berry f7d5d0cfbe Remove special analyzer behavior for await expressions with "null context".
In the front end, type inference of an expression always takes place
with respect to a type schema (the "context"). In the analyzer, type
inference of an expression sometimes takes place with respect to a
context, but sometimes takes place with respect to no context at all;
the latter circumstance arises when the analyzer uses its standard
AstVisitor mechanism to call one of the visit methods in the
ResolverVisitor class, and so the visit method's contextType argument
takes on the value null. Because of this I am calling this situation a
"null context".

In all the circumstances where the analyzer infers an expression using
a null context, the front end infers the same expression using a
context of _. Furthermore, prior to this change, all but one of the
analyzer's visit methods treated a null context the same as they
treated a context of _. The one exception was visitAwaitExpression: in
this method, if the context was the null context, then the analyzer
analyzed the await expression's subexpression using a context of _;
otherwise, it analyzed it using a context of FutureOr<_>. Whereas the
front end, lacking any notion of a "null context", analyzes the await
expression's subexpression using a context of FutureOr<_> in the same
circumstances.

This change brings the analyzer behavior into line with the front end.

Fixes https://github.com/dart-lang/language/issues/3648.

Bug: https://github.com/dart-lang/language/issues/3648
Change-Id: Ifd77988010d4387ce48eaa20dff4356beec03753
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357521
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2024-03-20 17:33:28 +00:00
Konstantin Shcheglov 5120f166f1 Completion. Issue 55224. Fix for suggesting extension members on 'null'.
Bug: https://github.com/dart-lang/sdk/issues/55224
Change-Id: Id2941165dc336411315e009a4bcba913b1e1a7b9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358780
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-20 17:24:15 +00:00
Konstantin Shcheglov ee0a150e57 Issue 55242. Fix ToSourceVisitor and ForEachPartsWithPattern.
Bug: https://github.com/dart-lang/sdk/issues/55242
Change-Id: I235c6b0d0991ea0002d6b0744a78f598705c6381
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358664
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-20 17:12:43 +00:00
Erik Ernst 50ff1c7823 Introduce support for augmentation libraries in Dart.g
Change-Id: Icc4b89f1b25dd633279d87e9d51f85372d962c7b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358450
Commit-Queue: Erik Ernst <eernst@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2024-03-20 17:10:53 +00:00
Brian Wilkerson eb615fc31b Compute the context location in more places
Change-Id: Ic8df3d344afc271615874f6de882d18b5378497a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358600
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2024-03-20 16:57:11 +00:00
pq 71456592d0 + unnecessary_library_names
Fixes: https://github.com/dart-lang/linter/issues/3882

(I'll follow-up with a quick-fix.)

Change-Id: Ice88bfb59a16163b003ce94c73e057d2fd968a9d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358561
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
2024-03-20 16:54:59 +00:00
Konstantin Shcheglov 8be20a0d67 Completion. Speed. Don't create new Set / toList() 'requiredImports' for every suggestion.
Before:
[1710880110645][time: 513 ms][mean: 486.0][stdDev: 24.021][min: 436.0][max: 537.0]

After:
[1710908972390][time: 421 ms][mean: 425.0][stdDev: 21.033][min: 386.0][max: 479.0]

So, about 12% faster.

Change-Id: I75676d5b6a4614ef81b25c0ff4694ff0c711b2cb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358403
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-20 16:03:49 +00:00
Konstantin Shcheglov aa2cd456a3 Completion. Issue 35449. Don't suggest @visibleForTesting instance members when not available.
Bug: https://github.com/dart-lang/sdk/issues/35449
Change-Id: I7e02d7fbbc9477ad98dd87327adf3b562fc0fde8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358328
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-20 16:02:33 +00:00
Srujan Gaddam 2a7fc06c6b Update pkg:web to 0.5.1
Change-Id: I43742a6d597003d694b2789fc75ba79d9d5ff83a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358620
Reviewed-by: Devon Carew <devoncarew@google.com>
Commit-Queue: Srujan Gaddam <srujzs@google.com>
2024-03-20 15:39:59 +00:00
Sam Rawlins f3a47d3123 das: Move findPossibleLocalVariableConflicts; tidy PostfixCompletionProcessor
`CorrectionUtils.findPossibleLocalVariableConflicts` actually does not
use the `eol` utility or the `_buffer` field; it turns out it is a
good candidate for an extension method on CompilationUnit. It is moved
to the existing extension.

In refactoring call sites, PostfixCompletionProcessor didn't have a
perfectly obvious CompilationUnit field, so I refactored it a bit, and
cleaned up it's fields:

* Make the class final.
* Rename `NO_COMPLETION` to `_noCompletion`
* Privatize `node`, `completion`, `eol`, `file`, `key`,
  `selectionOffset`, `typeProvider`, and `typeSystem`.
* While checking whether `change`, `linkedPositionGroups`, and
  `exitPosition` could be private, it turns out they are unused; this
  would have been flagged by static analysis if they had been private.

Change-Id: I29c48c362261b11402cee43464386c3152df7158
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358641
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-03-20 15:00:13 +00:00
David Morgan daf3d61017 [macros] Add flag requirePrebuiltMacros.
R=johnniwinther@google.com

Change-Id: I0549a87bf67f1879826562b87d599372f8a8d044
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357863
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
2024-03-20 14:55:43 +00:00
Johnni Winther 4b21f58d39 [cfe] Don't emit warnings on null-aware access on non-nullable
Change-Id: I94f3011f69330f5b2d8998f29eb9511517e1fffa
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357301
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-03-20 14:04:29 +00:00
Ben Konyi 3a62af40b3 [ package:vm_service* ] Prepare for release of package:vm_service 14.2.0 and package:vm_service_interface 1.1.0
Adds support for 4.15 of the VM service protocol to both packages. Also
adds `yieldControlToDDS` to the `VmServiceInterface` so implementers of
the service protocol can correctly handle DDS connections.

Change-Id: I9253a647c1781f4d52758ecce4984082dfbf4fa0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357720
Reviewed-by: Derek Xu <derekx@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Elliott Brooks <elliottbrooks@google.com>
2024-03-20 13:34:07 +00:00
Konstantin Shcheglov 1a51f41f61 Completion. Speed. Use identical() for elements in InterfaceTypeImpl.==
Before:
[1710810780681][time: 509 ms][mean: 512.2][stdDev: 20.145][min: 460.0][max: 581.0]

After:
[1710880110645][time: 513 ms][mean: 486.0][stdDev: 24.021][min: 436.0][max: 537.0]

So, about 5% faster.

Change-Id: I8378cfd7406efb14877b107e249399e286a9408e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358580
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-03-20 02:37:00 +00:00
TheComputerM 7eddad0708 quick fix for annotations with static getters
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/55066
Change-Id: Ifb2dcaf9610e1123cb65f35cd9f9232f31a6b2a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358080
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-19 23:36:19 +00:00
pq 06c8f2d059 move shared test logic into mixins
Previously I had shared logic in a base reflective test class. This made marking tests (in the base class) as failing difficult.

This just migrates the shared logic to mixins. No test logic is changed.

Do note that the mixins are temporary. When we enable multi-option contexts they will be deleted.

Change-Id: I22f6651a79b6ccc125fb97dc2a0dbc2efa86fe6d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358327
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-19 21:50:38 +00:00
Konstantin Shcheglov 8e8a88db8c CQ. Share isInternal, isProtected for analysis and completion.
Change-Id: I884d854f0dd258019d1c4d96f9db7959f36140c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358521
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-19 21:29:28 +00:00
TheComputerM 27066e6d3b do not quick fix to existing named arguement
R=brianwilkerson@google.com

Bug: https://github.com/dart-lang/sdk/issues/54336
Change-Id: If41d8c239b3375600de6f9245127c2d27b37e40b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357801
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Auto-Submit: Mudit Somani (TheComputerM) <mudit.somani00@gmail.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-03-19 21:22:32 +00:00
Danny Tuppeny dd8c55cc9d [analysis_server] Improve Go-to-Super for constructors and augmentations
This changes Go-to-Super to handle augmentations (jumping to a super-member will go the last augmentation in the chain) and constructors (will jump to the actual super constructor that is called, regardless of name).

Change-Id: I7439fd42ef81983e7a052f250f7ba272fe8c2c86
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357608
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-19 21:22:15 +00:00
Devon Carew 3fb4c338bd Bump csslib to b58e487dda565f4b9bd4ceb3655a963ae197219d
Changes:
```
> git log --format="%C(auto) %h %s" 62ae85e..b58e487
 https://dart.googlesource.com/csslib.git/+/b58e487 Update processFont to handle null expressions. (186)

```

Diff: https://dart.googlesource.com/csslib.git/+/62ae85e84590f61169fddbca650e91a57544834b..b58e487dda565f4b9bd4ceb3655a963ae197219d/
Change-Id: I1300f041a4510638d10325cdc19b9d5a712ea5d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358324
Reviewed-by: Nate Bosch <nbosch@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
2024-03-19 20:55:48 +00:00
Ben Konyi 03a4ad2a28 Updated pinned SDK to 3.4.0-247.0.dev
Change-Id: Ieff638aee139d6ebb1b0fb98444331d115eb91d1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358503
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2024-03-19 20:37:10 +00:00
Konstantin Shcheglov 5865c08285 Augment. Top-level variable augmentation is not a duplicate declaration.
Change-Id: Ie2cc9b776f891131f6e1778f2ed8c2a66e4a708e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358321
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-19 20:34:27 +00:00
Sahil Kachhap 590683660b Fixed the Error message of "extract method" refactoring (#55148).
R=pquitslund@google.com

Fixed: 55148
Change-Id: I51a17b182bbd6e2001a4dfd0130c8ff378f7bdcb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357960
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Sahil Kachhap <sahil.kachhap111989@gmail.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-03-19 20:26:20 +00:00
Konstantin Shcheglov 2792d6e080 Completion. Speed. Cache InterfaceElementImpl.allSupertypes in the element.
Before:
[1710696094848][time: 659 ms][mean: 607.0][stdDev: 28.995][min: 548.0][max: 736.0]

After:
[1710810780681][time: 509 ms][mean: 512.2][stdDev: 20.145][min: 460.0][max: 581.0]

So, about 15% faster.

Change-Id: I220a3c477889062bf3b759815a1d37289eddda38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358381
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-19 19:08:38 +00:00
Sam Rawlins 6896a21216 analyzer plugins: Move DartFixContext and Impl to server_plugin
* Combine DartFixContext and DartFixContextImpl into one class;
  separation seems unnecessary.
* Change constructor (which was on DartFixContextImpl) to use all
  named parameters.
* Change `resolveResult` field to `resolvedResult`, since the type is
  called `ResolvedUnitResult`.
* Start doc comments with third person verbs [1].


[1]: https://dart.dev/effective-dart/documentation#prefer-starting-function-or-method-comments-with-third-person-verbs

Work towards https://github.com/dart-lang/sdk/issues/53402

Change-Id: Idb3c6776f899d5bc9b634c1d9c4b998de2603d04
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358382
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2024-03-19 19:06:33 +00:00
Keerti Parthasarathy d4701442c6 Update changelog for improvements in code completion
Change-Id: I0e90ac68c433b3e7a40fb0f9c7cdff866737ccf9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358260
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-19 17:35:28 +00:00
Ben Konyi 74affcf3ba Updated checked-in SDK to 7c64e31f4c
Includes fix for https://github.com/dart-lang/sdk/issues/55212 which is
causing build breakages.

Change-Id: Ie665b71970fd8ff2103f6fe5d7d1411ac6f8adc0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358540
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2024-03-19 17:28:47 +00:00
Konstantin Shcheglov dbaa922223 Completion. Issue 35449. Don't suggest @internal instance members when not available.
Bug: https://github.com/dart-lang/sdk/issues/35449
Change-Id: I9e65a0075a69e0bbc00e814272099a6810b82ed9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358261
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-19 17:11:23 +00:00
Sam Rawlins a8a42cffd2 Simplify some CorrectionUtils code
The big one is `getIndent`, which I think can be simpler, and also used a handwritten implementation of `String.operator *`. It turns out:

* > 90% of calls to `getIndent` were `getIndent(1)`, which can be
  replaced with a constant `'  '`.
* Then 4 calls to `getIndent` were `getIndent(2)`, which can be replaced
  with a constant `'  ' + '  '`.
* Then one last call, in CorrectionUtils itself, used a variable number
  of indents which can be replaced with `'  ' * n`. This is in the
  `indentRight` function.

Also:

* Privatize `getInsertionLocationTop`, `isClassWithEmptyBody`, `isJustWhitespaceOrComment`, `skipEmptyLinesLeft`
* Rewrite CorrectionUtils.findSimplePrintInvocation as an extension
  method on AstNode; does not need the `_buffer`.

Change-Id: I15c19b8c0cc354adcd4ffea5803b3a182cf28336
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358400
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2024-03-19 17:05:49 +00:00
Dan Chevalier 8f995c27f2 Turn off default logging for dtd daemon
Change-Id: Iddb386017b91024aea51d546f7d729b38d870352
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358502
Commit-Queue: Dan Chevalier <danchevalier@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2024-03-19 17:03:20 +00:00
Jake Macdonald 17454cb118 make ConstructorMetadataAnnotation.type be a TypeAnnotation
Change-Id: I9013340307f6fa3a100b2263e0edaef69c05c437
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358500
Auto-Submit: Jake Macdonald <jakemac@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2024-03-19 16:22:52 +00:00
Daco Harkes d243eb1254 [deps] Roll dart-lang/native
https://github.com/dart-lang/native/pull/1018
https://github.com/dart-lang/native/pull/1019

Change-Id: I0371ebbbba872bf90514f0f2e255957f6a89c8c5
Cq-Include-Trybots: luci.dart.try:pkg-linux-debug-try,pkg-linux-release-arm64-try,pkg-linux-release-try,pkg-mac-release-arm64-try,pkg-mac-release-try,pkg-win-release-arm64-try,pkg-win-release-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357605
Reviewed-by: Moritz Sümmermann <mosum@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
2024-03-19 14:58:26 +00:00
Chloe Stefantsova daa7f82c31 [cfe] Capture argument via matchFutureOrType in constraint gathering
Part of https://github.com/dart-lang/sdk/issues/54902

Change-Id: I90f278fbe1ad4a58b779d0fc199c413e601bd4d6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358461
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2024-03-19 13:48:04 +00:00
David Morgan 8269f13111 [macros] Find platform for Flutter desktop build.
R=jakemac@google.com, johnniwinther@google.com

Change-Id: I78bb5bccc0191986d788da2386484b6128fa256e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357343
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Auto-Submit: Morgan :) <davidmorgan@google.com>
Commit-Queue: Morgan :) <davidmorgan@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2024-03-19 12:36:18 +00:00
Vyacheslav Egorov 4cb67eb009 [tests] Remove debug prints from corelib/date_time7 test
R=whesse@google.com

CoreLibraryReviewExempt: Test changes only
Change-Id: I1013a0a60cb60ef769e041668bac342b0d44283e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357604
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Slava Egorov <vegorov@google.com>
2024-03-19 12:30:56 +00:00
Vyacheslav Egorov 80d8f1d03f [vm] Make dart run --resident work in SDK checkout
Resident runner used to look either for pubspec.yaml
or .dart_tool/package_config.json to find package root.

However it does not make much sense to look for pubspec.yaml
you can't resolve packages using just pubspec anyway - you
need package_config.json. This was making it impossible
to use resident runner with packages in Dart SDK checkout:
each package contains pubspec.yaml, but package_config.json
is generated at the root of SDK checkout instead.

This CL also removes support for .packages file - we have
deprecated and removed this file in 2022.

R=kustermann@google.com

TEST=manually

Change-Id: I18ce7a1a82bc72bbc944d8ab2d40f40cdb15cc1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357620
Commit-Queue: Slava Egorov <vegorov@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-03-19 11:58:05 +00:00
Erik Ernst 20f197dacd Include the most recent updates on type modifiers in Dart.g
The class modifiers feature specification was updated such that mixins
cannot be `sealed`, and several other combinations were eliminated.
This CL makes those changes to Dart.g. The changes have been in effect
for a while (8 months since last update to the spec), but the update
to Dart.g was somehow not performed at the time. This CL fixes that
omission.

Change-Id: Ifd2124583a124cdaaa7822f94f70e707ec33b425
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358460
Reviewed-by: William Hesse <whesse@google.com>
Commit-Queue: Erik Ernst <eernst@google.com>
2024-03-19 11:44:03 +00:00
Jonas Termansen f30a7ade48 Fix allowing Windows newlines in sh files.
llvm.sh must always use Linux newlines due to the #! line as a \r
character is considered part of the invoked program. This change fixes
that by simply forcing Unix newlines on all .sh files, like we do with
other file formats like C++ & Dart already.

Fixes: b/330293090
Change-Id: Iaf044da487261908f96c76d5c62385a033106a0b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358480
Commit-Queue: Jonas Termansen <sortie@google.com>
Commit-Queue: William Hesse <whesse@google.com>
Auto-Submit: Jonas Termansen <sortie@google.com>
Reviewed-by: William Hesse <whesse@google.com>
2024-03-19 11:27:14 +00:00
dependabot[bot] 1b5368f309 Bump actions/checkout from 4.1.1 to 4.1.2
Closes https://github.com/dart-lang/sdk/pull/55223

GitOrigin-RevId: 426ae2e78599d253e86fe12bdf6e3df3b8c219c8
Change-Id: I19cc8e23cfb2772552ffccc0fa9ac3df28aa33c2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358140
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2024-03-19 10:07:23 +00:00
Ömer Sinan Ağacan 44c2e17600 [dart2wasm] Update built-in string imports according to the latest spec
Spec: https://github.com/WebAssembly/js-string-builtins

Change-Id: Idb387e6dd27b203ddca52291c44fb2aa15ee75cf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/357560
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Martin Kustermann <kustermann@google.com>
2024-03-19 08:20:59 +00:00
Konstantin Shcheglov ef07a17210 Augment. Update ElementDisplayStringBuilder.
Change-Id: I50c38ea97712f72af4aeb681ba5394e2f0a3bc5f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358322
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-19 00:50:38 +00:00
pq e006296337 more tests for nested excludes and "inherited" lints
See: https://github.com/dart-lang/sdk/issues/54858

Change-Id: Ied3f8eb61c2a846dee3108d61690c4308b02a96f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/356380
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-19 00:19:58 +00:00
Konstantin Shcheglov 22873be577 Completion. Benchmark for continuously asking completions.
Useful to focus on measuring performance of computing suggestions
only, without any overhead of resolution, protocol conversion, etc.

To be run as is, or with `--observe:xxxx` to see what to optimize.

You need to supply your own Flutter checkout.

Change-Id: Ie143b4ec9c24e05a0de2a14c1b8f0e1c20ef3a8a
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358222
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2024-03-18 22:56:10 +00:00
Konstantin Shcheglov 4ff34de97a Augment. Support for 'augment' on top level variables.
Change-Id: I06504c3d3b7b0a4e3d5e5e7d9587eb266f4496de
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358320
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2024-03-18 22:41:24 +00:00
Kenzie Schmoll 408918d6f5 [dds] Start DTD from DevTools server if it is not already started.
Fixes https://github.com/dart-lang/sdk/issues/54937.

Tested: pkg/dartdev test for `dart devtools` command, and new `dtd_test.dart` in pkg/dds.
Change-Id: I530ba2fe4d5809082378b61c282ba7856974e21e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/354460
Commit-Queue: Kenzie Davisson <kenzieschmoll@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Dan Chevalier <danchevalier@google.com>
2024-03-18 21:50:09 +00:00
Konstantin Shcheglov e46c230aff Augment. Field augmentation is not a duplicate declaration.
Change-Id: I1f8089759598e78d60c523ad1dfbee60e8fc8839
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/358226
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
2024-03-18 21:32:16 +00:00