This adds the implicit casts to the result of relational pattern
matching and guards in if-case elements/map entries.
Closes#51724
Change-Id: I368528534341194555f091174151d8510b136358
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291221
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
TEST=pkg/analyzer/test/src/diagnostics/subtype_of_ffi_class_test.dart
Shows how duplicate errors are removed.
TEST=pkg/analysis_server/test/src/services/correction/fix/remove_name_from_declaration_clause_test.dart
Note that two of the dartfix tests automatically suggest the same fix
for the class-modifier based errors instead. However, the two other
tests do not suggest a REMOVE_NAME_FROM_DECLARATION_CLAUSE fix.
Bug: https://github.com/dart-lang/sdk/issues/51683
Change-Id: Ic0a577d6d13ca8aa899d404f97db38029a5e8de4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291062
Reviewed-by: Kallen Tu <kallentu@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Tests are in the following files 3.0 and pre-3.0 respectively.
TEST=tests/ffi/vmspecific_static_checks_test.dart
TEST=tests/ffi_2/vmspecific_static_checks_test.dart
Bug: https://github.com/dart-lang/sdk/issues/51683
Change-Id: Ib0b27590748ef788c5475929fde585c790f64e63
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/291064
Reviewed-by: Martin Kustermann <kustermann@google.com>
Reviewed-by: Kallen Tu <kallentu@google.com>
Commit-Queue: Daco Harkes <dacoharkes@google.com>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>