Commit graph

90724 commits

Author SHA1 Message Date
Chloe Stefantsova f27548aa5a [cfe] Coerce expressions in pattern assignment and declaration RHS
Closes https://github.com/dart-lang/sdk/issues/51738

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

Change-Id: I4d496c303b1762c7234d66436daf125e69a34316
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291068
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-03-27 10:01:53 +00:00
Sigurd Meldgaard cc9526fea8 Use platform based path separator in test
Change-Id: I750b236a39bc9338c84a2a6bf1fcfcde1de1aac4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291070
Reviewed-by: Jonas Jensen <jonasfj@google.com>
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
2023-03-27 09:39:19 +00:00
Brian Wilkerson 5d98b0eb9f Enable producing links for new diagnostics
Change-Id: Ia902868bc19a32286df0b0a52aae86c6aa426169
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291052
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-03-26 15:04:22 +00:00
Alexander Markov 5117c45770 [vm/compiler] Combine argument type with static and inferred parameter types during inlining
Previously, when preparing a Parameter stub during inlining, compiler
unconditionally used argument type (from the caller). This type
could be less accurate than static or inferred parameter type of
the callee. For example, the argument could originate from inlined generic ListIterator.current:

  v24 <- LoadField(v23 . _current@9040228) T{X0??}

and static type could be 'int'.

This change combines argument type from callee with a parameter type
from caller during inlining. In order to get parameter type for
optional parameters, ParameterInstr is extended to hold real parameter
index and ParameterIndex::ComputeType is extended to work on
parameters which are not passed directly.

Also, this change fixes the incorrect non-nullable receiver type for
Object and Null methods.

TEST=runtime/tests/vm/dart/regress_51790_il_test.dart
Fixes https://github.com/dart-lang/sdk/issues/51790

Change-Id: I19fff19833a6148ed36a16895626e4e1d8ae62d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290602
Reviewed-by: Slava Egorov <vegorov@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-03-26 03:42:30 +00:00
Alexander Aprelev 7aaad727fa Revert "[build] Don't combine stdout and stderr when consuming git output."
This reverts commit 1ac8b374a2.

Reason for revert: Broken debianpackage bot https://ci.chromium.org/p/dart-internal/builders/ci/debianpackage-linux-main/4682

Original change's description:
> [build] Don't combine stdout and stderr when consuming git output.
>
> When the alternate objects path is broken, `git log -n1 --pretty=format:%cd` will output `error: unable to normalize alternate object path: .git/objects/no/such/path` to stderr, and we don't want this mixed into the version string.
>
> Bug: https://github.com/flutter/flutter/issues/123416
> Change-Id: Ief03e57febd5a42f5cbba2b14a736d949a90ae82
> Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291050
> Reviewed-by: Alexander Aprelev <aam@google.com>
> Commit-Queue: Ryan Macnak <rmacnak@google.com>

Bug: https://github.com/flutter/flutter/issues/123416
Change-Id: If100a66a7b94a2c540aa9e4f28902ce6f6ab8d64
No-Presubmit: true
No-Tree-Checks: true
No-Try: true
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291056
Bot-Commit: Rubber Stamper <rubber-stamper@appspot.gserviceaccount.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-03-25 04:37:43 +00:00
Sam Rawlins 755432f73e Reinstate HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE
This reverts parts of https://dart-review.googlesource.com/c/sdk/+/289444

The code needs to be reinstated as flutter has tests which
verify that certain data-driven fixes work, which happen to
be uses of deprecated members, from the same package. See
this failure for example:
https://logs.chromium.org/logs/dart/buildbucket/cr-buildbucket/8785707696655090305/+/u/analyze_flutter_flutter/stdout?format=raw

The linter bump is kept the same, and some code which was
unnecessarily coupled tightly with
DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE is kept the same.

The big test refactor which was included in 289444 is also
kept the same, only a few tests are added to verify
HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE gets reported.

Bug: https://github.com/dart-lang/sdk/issues/51678
Change-Id: I6852376b299d8375c720ea56dc6a6a6119de3364
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291054
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-03-25 01:39:37 +00:00
Alexander Aprelev 9daa67967f [vm/reload] Ensure we only morph instantiated classes and enums.
Fixes https://github.com/dart-lang/sdk/issues/51835
TEST=IsolateReload_EnumInMainLibraryModified

Change-Id: I4a8993cb44619a552866430b92f3941d49afbae6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291051
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Alexander Aprelev <aam@google.com>
2023-03-25 01:33:07 +00:00
Kallen Tu fd1b48d82e [tests] Remove interface mixin, final mixin, and sealed mixin from language tests.
Change-Id: I8d92758c3a43ed0eff2e0c953ae8a87e65a3a920
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291047
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2023-03-24 23:04:47 +00:00
Ryan Macnak 1ac8b374a2 [build] Don't combine stdout and stderr when consuming git output.
When the alternate objects path is broken, `git log -n1 --pretty=format:%cd` will output `error: unable to normalize alternate object path: .git/objects/no/such/path` to stderr, and we don't want this mixed into the version string.

Bug: https://github.com/flutter/flutter/issues/123416
Change-Id: Ief03e57febd5a42f5cbba2b14a736d949a90ae82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291050
Reviewed-by: Alexander Aprelev <aam@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-24 22:00:11 +00:00
Leaf Petersen 386825ee8c Add tests for the transitivity of the base modifier when applied to
base mixins and base mixin classes.

Change-Id: Idfe7576f38382c5e9a0ff968aae00f48990e1d38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290351
Commit-Queue: Leaf Petersen <leafp@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
2023-03-24 21:59:23 +00:00
Konstantin Shcheglov 84c0f2c880 Sanitize arguments of super/redirecting constructor invocations.
We have a spike of crashes internally.

Change-Id: If7c280692ac0acdd2e4a4acd6096a4669746069c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291120
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-03-24 21:42:37 +00:00
Konstantin Shcheglov edccf64f54 Fix for highlighting mixin names.
Change-Id: Idadb02aa1b86525fde307a5eddc8876f152d1b31
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291045
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-03-24 21:37:57 +00:00
Sam Rawlins 6f3f4b598f Treat warnings more like hints (less like errors) in driver, fixes, and completions.
The presence of errors (and previously, warnings) affects what
completions are offered (or their order?) and what fixes are offered
(or their order?), and the order of re-analysis.

When unused local variables and imports etc are WARNINGS, fixes,
completions, and re-analysis should not regress.

Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: If5141eec7df01f50caee5bf245c031b5a51ea590
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291100
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
2023-03-24 21:03:48 +00:00
Konstantin Shcheglov 6123ac7490 Require the language level >= 2.12 only if the Dart SDK that runs the analyzer is at least 3.0.0
...including any pre-release versions of 3.0.0 too.

Change-Id: Id95c3f126e86be5fe0430ca4adfe22adcafadc0f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291049
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-03-24 20:49:22 +00:00
Paul Berry df7c4bb439 Allow empty switch expressions.
This an experimental change; we haven't yet decided whether we want to
allow this.  See https://github.com/dart-lang/language/issues/2939 for
discussion.

Bug: https://github.com/dart-lang/language/issues/2939
Change-Id: If69ab66d18ae7ec3dfc79496ce13517ef1c15227
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290907
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-03-24 20:22:52 +00:00
Janice Collins ac4790ad7c Update dartdoc to 6.2.1.
Release notes: https://github.com/dart-lang/dartdoc/releases/tag/v6.2.1

Change-Id: I8e6df59e562818d4f5f98f04c0a58342c43f13e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291048
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Janice Collins <jcollins@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Auto-Submit: Janice Collins <jcollins@google.com>
2023-03-24 20:19:20 +00:00
Paul Berry 2c16ff8827 Fix error reporting and recovery for declared variable in pattern assignment.
If a declared variable occurs inside a pattern assignment (e.g. `[a,
var b] = c`), we now recover using the `DeclaredVariablePattern` AST
node.  Normally, a `DeclaredVariablePattern` wouldn't appear inside a
pattern assignment, but it's better to recover in this way because it
avoids dropping the keyword token (`var` or `final`) or type.

Fixes #50927.
Fixes #51529.

Bug: https://github.com/dart-lang/sdk/issues/50927, https://github.com/dart-lang/sdk/issues/51529
Change-Id: Ia65853baeae0e8eb999b7bd82fb2455e10b2b996
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291044
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-03-24 20:14:49 +00:00
Brian Wilkerson f4bbc427c3 Implement the legacy protocol for showing messages and URIs to users
There is a desire to unify the two subclasses of the analysis server,
but I didn't attempt to do that in this CL.

Change-Id: I17bbf4f6247fc547df1c82f02e74c50eabe7aadc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291000
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Jaime Wren <jwren@google.com>
2023-03-24 18:10:17 +00:00
Kallen Tu 24d210a18c [tests] Fix existing on clause tests for final classes.
Disallow using final classes on on-clauses outside of its library.
Update tests to show this behaviour. (Or at least in a state where I can test out the implementation)

Change-Id: I74306c873dbd047c6b94d8e8e75c215562dd9483
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290915
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Leaf Petersen <leafp@google.com>
2023-03-24 18:07:52 +00:00
Ivan Inozemtsev 22f6200fb0 Convert TLS exceptions to HTTP exceptions
Bug: b/270438568
Change-Id: I57af86e42d3dd258186250ff0d6ea45cc51a176d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291067
Auto-Submit: Ivan Inozemtsev <iinozemtsev@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-03-24 17:41:18 +00:00
Brian Wilkerson 4e29f0b339 Add documentation for two more diagnostics
Also adds a dropped link target so that we don't break existing users.

Change-Id: I98e5e9fe2e51730150acfab889245a7b9f6b11d3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290180
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-03-24 17:36:28 +00:00
Sigurd Meldgaard 9e5ba648af Bump pub to 8434b40d6a21dece68c4880e59dbdedfbd6bd7e5
Changes:
```
> git log --format="%C(auto) %h %s" 4bd757c..8434b40
 https://dart.googlesource.com/pub.git/+/8434b40d Be more quiet when doing implicit pub get (3847)
 https://dart.googlesource.com/pub.git/+/29a7c099 Dependency services: preserve pub.dartlang.org in lockfile (3846)
 https://dart.googlesource.com/pub.git/+/41963ddd Api entrypoint for ensuring resolution is up-to-date (3844)
 https://dart.googlesource.com/pub.git/+/92f6bf79 If pinned to an exact version, keep the pin when bumping (3736)
 https://dart.googlesource.com/pub.git/+/c68939ba Add missing closing quote in dependency override example (3843)
 https://dart.googlesource.com/pub.git/+/0cdeb85f Hint if version is not an incremental update (3840)
 https://dart.googlesource.com/pub.git/+/c795dcd8 Upgrade language version to 3.0 (3822)

```

Diff: https://dart.googlesource.com/pub.git/+/4bd757ce1dad04035fb0dbc6156879af23d8b3b8..8434b40d6a21dece68c4880e59dbdedfbd6bd7e5/
Change-Id: Ia0b7e8742522904454c318a381f983398be82838
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291066
Commit-Queue: Sigurd Meldgaard <sigurdm@google.com>
Reviewed-by: Jonas Jensen <jonasfj@google.com>
2023-03-24 17:17:15 +00:00
Kallen Tu 2407f7338d [analysis_server] Remove interface, final, and sealed mixins from the analysis server.
Change-Id: Id774379c92904f27326f502299c67adb825a00b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290914
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-03-24 17:09:24 +00:00
Kallen Tu 2e19faaec9 [cfe] Report an error when implementing a base class through a sealed class.
Bug: https://github.com/dart-lang/sdk/issues/51811
Change-Id: Ifad0519332965d79719173702293b48e94231024
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291040
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-03-24 17:09:09 +00:00
Sam Rawlins fd4602f019 Bump linter to include deprecated_member_use_from_same_package
We also stop reporting
`HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE` and
`HintCode.DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE_WITH_MESSAGE`
as these are now replaced by the new lint rule.

The biggest change here is in the DEPRECATED_MEMBER_USE tests,
as most of these tests have
`DEPRECATED_MEMBER_USE_FROM_SAME_PACKAGE` reported (since it's
easier to write tests with files in one package). We move all
of those tests to `DEPRECATED_MEMBER_USE` tests, without losing
coverage.

Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: I7cada44265cd0e1e47ab77d4354de9a5571db614
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289444
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Kevin Moore <kevmoo@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2023-03-24 16:35:37 +00:00
Paul Berry 8f6325d650 Patterns parsing: handle incomplete identifier . in a pattern.
Bug: https://github.com/Dart-Code/Dart-Code/issues/4407
Change-Id: Ibac9822fa6cf2f15aa67b68a28f399cf4373e782
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291043
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-03-24 16:10:09 +00:00
Ben Konyi c927840920 [ VM ] Add support for samping heap profiler in PRODUCT mode
Requires INCLUDE_SAMPLING_HEAP_PROFILER to be defined.

TEST=DartAPI_HeapSampling_*

Change-Id: I1c95be4747b295823a8fae1f369f9dc5d95a274e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290620
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ryan Macnak <rmacnak@google.com>
2023-03-24 14:02:14 +00:00
Ben Konyi 689042093d [ VM ] Re-work heap sampling profiler APIs to make use of WeakTable
TEST=updated dart_api_impl_test tests

Change-Id: Ibb6789286a88c96151a466617054d703cceed61e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290160
Reviewed-by: Ryan Macnak <rmacnak@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-03-24 14:00:09 +00:00
Ben Konyi fb1516c4ea Reland "[ Observatory ] Disable serving Observatory by default"
This reverts commit 5a8ddc0756.

Reason for reland: fix for failing Flutter test landed upstream
in https://github.com/flutter/flutter/pull/122419

TEST=pkg/dartdev/test/commands/run_test.dart

Change-Id: I1152296828428e118ccba11025f25f6b1dbbb0f3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290921
Reviewed-by: Zach Anderson <zra@google.com>
Commit-Queue: Ben Konyi <bkonyi@google.com>
2023-03-24 13:25:30 +00:00
Paul Berry f9c45af689 Fix nomenclature around upwards/downwards/partial inference to match spec.
The spec uses the terms "upwards" vs "downwards" inference to refer to
whether type constraints come from a return type or parameter types.
Previous to this change the code used the terms "upwards" vs "partial"
inference to refer to whether the types being chosen were preliminary
(and hence might contain `?`s) or were the final inferred types.  This
led to confusion; for example the method
`downwardInferObjectPatternRequiredType` was calling `upwardsInfer`.

This change adjusts the nomenclature so that the methods that choose
types are called `choosePreliminaryTypes` and `chooseFinalTypes`, to
avoid any confusion with the direction of inference.

See discussion here:
https://dart-review.googlesource.com/c/sdk/+/290613/comment/894a767c_e269584e/.

Change-Id: Ie05dcae027ca82b2ce7e5a57f1846412d5b32d50
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290901
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-03-24 12:25:18 +00:00
Paul Berry c175d48343 Front end: fix type inference for object patterns that refer to typedefs.
I've also added some runtime checks to
`tests/language/patterns/object_pattern_inference_test.dart` to verify
that the object patterns match when they should match and don't match
when they shouldn't; this helps verify that not only has the front end
inferred the correct type for the object patterns, but it has also
stored the correct type in the kernel representation.

Fixes #51795.

Bug: https://github.com/dart-lang/sdk/issues/51795
Change-Id: I73ce43e440db50d9942deb4a1eb4ee68a5c23142
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290900
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-03-24 12:20:08 +00:00
Chloe Stefantsova 628ba2ac64 [cfe] Use StateError as the pattern matching error in assignments
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: I9c4fb121526ca40e5809be8f4a8a5770d551cfb1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291063
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-24 11:30:57 +00:00
Alexander Thomas f5aaf580e6 [infra] Update checked-in SDKs to 3.0.0-356.0.dev
Fixes: https://github.com/dart-lang/sdk/issues/51824
Change-Id: Icae09625b14ed3e574aa5f29caf9756e70390a2f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290905
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2023-03-24 10:27:28 +00:00
Johnni Winther 23ff65a79b [cfe] Avoid static type context leak
This ensure that the StaticTypeContext used for 'evaluate' is only
used within the method call and doesn't leak to subsequent evaluations.

Included is a repro for the fix in
https://dart-review.googlesource.com/c/sdk/+/290860 which was triggered
by the same underlying problem of the leaky static type context

Change-Id: Ib603c377b420bd75e6a0737e8933343e61fab65c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290961
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-03-24 09:27:43 +00:00
Johnni Winther b126fad7c4 [cfe] Handle negative length in list/map pattern
Change-Id: Ifb3fbace24ca8d20fce48327c85bb1c4a92054f5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290523
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-24 09:24:25 +00:00
Kevin Chisholm 67cbbd538b [Process] Breaking change form fails to render
Fixes an indentation error in the breaking change issue for which prevented the issue template from rendering.

Change-Id: I317061671f877e562060b3b75b6fa543efc480c7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291041
Reviewed-by: Alexander Thomas <athom@google.com>
2023-03-24 08:09:15 +00:00
Johnni Winther 290706f497 [cfe] Don't cache constant in a lazy region
When unevaluated constants are found in conditions, a lazy region
is created for evaluating the subexpression, ensure that constant
locals are replaced within the subexpressions while still leaving the
subexpressions themselves unevaluated.

In these lazy regions, the result of evaluating the subexpressions
should not be cached, since these subexpressions are not themselves
unevaluated and should be evaluated if encountered elsewhere.

This was previously not done, leading to constants not being
evaluated even when these didn't contain any unevaluated constants.

Closes #51823

Change-Id: Ibfc02fef3ecfcd2f1d2e9e1451f0eb71dde6fb42
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290963
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-24 08:07:57 +00:00
Konstantin Shcheglov 6ef15e48bb Prepare to publish analyzer 5.10.0 and _fe_analyzer_shared 58.0.0
Change-Id: Ia298440a6d4a07fa777fe182c64cf0bb830d31ed
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290910
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-03-24 02:39:22 +00:00
Devon Carew e6ee09e23b [pkg/js_*] use package:lints/recommended.yaml for analysis for pkg/js_shared and pkg/js_runtime
Update the pkg/pkg.dart script to also include information about the size of the pkg/ packages (so we know ~how much code is on older analysis options sets).

Change-Id: Ief1b9a868752a01aef5dd95a4ce1c74795315bc4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290615
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Devon Carew <devoncarew@google.com>
Reviewed-by: Nate Bosch <nbosch@google.com>
2023-03-24 01:10:09 +00:00
Nate Biggs 0ac7c843ee [dart2js] Update experimental inferrer with changes from comments in unfork.
Change-Id: I467f94d17a6d2fa002eb7f506360d6b4a62806a8
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290441
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Sigmund Cherem <sigmund@google.com>
2023-03-24 01:01:44 +00:00
Derek Xu a6a040658c [VM/Service] Remove sealed and final mixin tests from get_object_rpc_test
sealed and final are being changed so that they cannot be applied to
mixins. See https://dart-review.googlesource.com/c/sdk/+/290614.

Change-Id: I738961f153f86e417db4520a02ab401af7563aae
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291001
Commit-Queue: Derek Xu <derekx@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-03-24 00:45:46 +00:00
Joshua Litt 2ca521c64c [js] Add sources js_types and js_annotations for analysis reasons.
Change-Id: If05f8a1b924a00616d5f616ff4a534e9237a6c82
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290916
Reviewed-by: Srujan Gaddam <srujzs@google.com>
Commit-Queue: Joshua Litt <joshualitt@google.com>
2023-03-24 00:39:57 +00:00
Johnni Winther 210275c1fe [cfe] Use AsExpression for AssignedVariablePattern lowering
The lowering previously used a PromotedCachableExpression, therefore
missing the needed check on assignment.

Closes #51432

Change-Id: I9e671326df25add9a8abea03d1e52b1be5740adc
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/289901
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-24 00:10:07 +00:00
Konstantin Shcheglov 04c1d58a4a Use mixins for analyzer packages, to prepate for language 3.0
Change-Id: I28fb5cf51c5dae887f19613d874d1ff264954be0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290912
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-03-23 23:57:53 +00:00
Ryan Macnak fc65f506a8 [vm, compiler] Always reserve x18 on RISC-V.
The extracted runtime offsets can handle architecture differences but not OS differences. Compare handling of x18 on ARM64.

TEST=gen_snapshot_fuchsia
Change-Id: Ide7557fa9f0cb5ed3d65f05a68310b88883957fb
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290704
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
2023-03-23 23:17:50 +00:00
Nicholas Shahan 230ef696eb [ddc] Remove special case for = mixin application
Remove the special case for `class C = Object with M;`
and fall into the same code path that would be used for
`class C2 = BaseClass with M;`

This introduces one new class to the hierarchy but that
class contains the members synthesized on the class. This
ensures they do not get lost during the mixin application at
runtime.

It appears likely that this has been broken for some time and
generating incorrect code when methods require covariant checks.

Fixes: https://github.com/dart-lang/sdk/issues/51768
Change-Id: If499b7abd1f8877b9f420ce74b790555c8d258f2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290402
Reviewed-by: Mark Zhou <markzipan@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
2023-03-23 23:15:36 +00:00
Nate Biggs 3bc19d459b [dart2js] Fix unevaluated const evaluations for record literals.
Change-Id: I72430e012b5053e37894ac64e9e1d642c478abdd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290981
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-03-23 22:56:15 +00:00
Nate Biggs 32c5b81f9c [dart2js] Add unit tests for records.
The expectations set here are updated as fixes/improvements are made in the next 2 CLs.

Change-Id: I0ac251ce09b980cde9e01afc1fa81b987a619747
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290980
Reviewed-by: Stephen Adams <sra@google.com>
2023-03-23 22:56:15 +00:00
Sam Rawlins d8613bba50 [analyzer] Move 3 more HintCodes to be WarningCodes, UNNECESSARY_*
Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: I71291bfa959d7553c64d4a9e1f2918892ae012eb
TEST=trybots
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290403
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
2023-03-23 22:52:36 +00:00
Robert Nystrom c89ec96b96 Fix int-to-double test to work on the web.
Change-Id: I5e208edc53543de8d11aa6e81072ad7f61a23d52
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/290913
Commit-Queue: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Bob Nystrom <rnystrom@google.com>
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
2023-03-23 22:47:49 +00:00