Commit graph

42402 commits

Author SHA1 Message Date
Johnni Winther 6e16dad3c0 [_fe_shared_analyzer] Use internal constant-to-text
This chances the analyzer and CFE representation of constant values
to use the internal constant-to-text which doesn't include the
node type and in most cases resembles the source code corresponding
to the value.

For now, this is for creating less noise in the test. For the release
of the feature we need a more thorough handling since these texts
can be user facing when producing error messages.

Change-Id: I5b83d8b0c030e4ffb66422057acf5511619368e9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287200
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-03-07 18:52:23 +00:00
Brian Wilkerson 219521d9cd A small optimization for LocalDeclarationVisitor
I doubt that this will have any significant performance impact, but it
seems wasteful to invoke all of the 'generalized' visit methods when
the only important one is `visitNode`.

Change-Id: Ie574d1456a4cccb26090c36f7f6340445bba4006
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287160
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2023-03-07 18:14:23 +00:00
Alexander Markov 110b0f0eba [tfa,dart2wasm] Create separate class for each record shape in TFA
This allows us to better track all kinds of accesses to record
implementation classes in dart2wasm, which generates separate
record implementation class per record shape.

This change also allows us to remove mutable dispatch targets
which were used to implement dynamic accesses to record fields,
and make tracking of record field types more accurate
(record fields are now versioned per shape).

This is also a step towards inferring actual record types.

TEST=pkg/vm/testcases/transformations/type_flow/transformer/records.dart
TEST=pkg/vm/testcases/transformations/type_flow/transformer/records_dart2wasm.dart
TEST=language/records/simple/dynamic_field_access_test

Issue https://github.com/dart-lang/sdk/issues/49719
Fixes https://github.com/dart-lang/sdk/issues/51363

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: Icba62a7ca8cfd8ddbc7f2b7c38aeabbef5caec4b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286950
Reviewed-by: Slava Egorov <vegorov@google.com>
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
2023-03-07 18:06:42 +00:00
Brian Wilkerson 61775822db Add a flag to the diagnostic pages to control developer support
I would prefer to have the code uncommented because it will help prevent
it from becoming stale.

Change-Id: I86dc0c715433cbeab33b3739f826475fcc583bc6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287161
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-03-07 18:06:20 +00:00
Paul Berry 5f8c28e226 Patterns flow analysis: promote to non-nullable when matched value is non-nullable.
Judging by several test cases that have shown up in co19 tests and
informal discussions, it appears to be a common expectation that a
pattern like `int? x?` or `int? x!` should promote `x` to
non-nullable.  Previous to this change, this didn't work in general.
Consider:

    Object? o = ...;
    switch (o) {
      case int? x?:
        print(x.isEven); // (1)
    }

At (1), the null-check happens *before* the required type check of the
variable pattern; therefore it promotes the matched value type to
`Object`.  This is not a subtype of the required type of the variable
pattern (which is `int?`), therefore, previous to this change, `x` was
not promoted.

With this change, since the matched value type of `Object` is
non-nullable, the required type of the variable pattern is
re-interpreted as its non-nullable counterpart, `int`.

In a fully null-safe program, this is sound, because if the matched
value type is non-nullable, that guarantees that the matched value is
not `null`, and therefore it is equivalent to type check against the
non-nullable counterpart of the required type.

In a program that is not fully null-safe, the matched value might have
originated in a non-null-safe library (and thus might be `null` in
violation of its static type).  So, strictly speaking, it is not sound
to re-interpret the required type of the pattern as its non-nullable
counterpart.  However, the only way this unsoundness can manifest is
for the matched value to be promoted to non-nullable when it is in
fact `null`, and that is precisely the sort of unsoundness thta we
permit in mixed-mode programs.  So this change won't result in
unsoundness escalation.

Bug: https://github.com/dart-lang/sdk/issues/51644
Change-Id: I9479e3c29e12f2a62a9e165b32c3480d7e299c29
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287040
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
2023-03-07 17:12:22 +00:00
Sam Rawlins 10b7b0a001 [analyzer] Move 2 more HintCodes to be WarningCodes, ASSIGNMENT_*, MIXIN_ON_*
Bug: https://github.com/dart-lang/sdk/issues/50796
Change-Id: Ifda5fb5f9bf282d6c97fffb34318e84eb84b76c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286346
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-03-07 17:11:24 +00:00
Kallen Tu ef6295df67 [flip-modifiers] CFE test golden file changes from class to mixin.
Change-Id: I58fa6ea3c34dec65e9cc754aeeffbe779314bd3c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286958
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-07 16:54:38 +00:00
Oleh Prypin 47cfe5f97f Roll dart_style into the SDK
Includes just one more commit - "Enable support for inline class syntax"

Change-Id: Ie230fc72b7170d3610bdd7ed7ab8c193338f8a93
Bug: b/271244238
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/287020
Commit-Queue: Oleh Prypin <oprypin@google.com>
Reviewed-by: Slava Egorov <vegorov@google.com>
Auto-Submit: Oleh Prypin <oprypin@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
2023-03-07 16:29:09 +00:00
Jakub Vrána 7e57f7cc60 Use get/setPrototypeOf instead of using __proto__
Closes https://github.com/dart-lang/sdk/pull/51617

GitOrigin-RevId: 6d6e01bf3fe0225682c7fedc53af3ef409791cca
Change-Id: I78435ae7b987e5ab9b87fb7c4700ddd7cf27c3fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286703
Reviewed-by: Stephen Adams <sra@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
2023-03-07 15:01:04 +00:00
Daco Harkes 7cfbfc6a25 [vm/ffi] Change late Finalizable implementation
This CL replaces `late Finalizable` variables with the original and
a nullable non-late variable. Every assignment is done first to the
late variable, and the immediately to the nullable non-late shadow
variable. The reachability fences are then inserted only for the
nullable non-late shadow variable.

The advantage of this is that the semantics are fully valid and none
of the further compiler pipeline has to know about late Finalizables.
(1) We remove the special casing in the VM.
(2) The TFA logic with finalizables is no longer blocked.

The downside of this approach is that we use more memory, we need
two fields at runtime, one storing a null and the other storing a
sentinel on initiazation. Moreover, we get some extra store
instructions.

TEST=pkg/vm/testcases/transformations/ffi/finalizable_late.dart
TEST=pkg/vm/testcases/transformations/ffi/finalizable_late_2.dart
TEST=tests/language/vm/regress_49005_test.dart

Closes: https://github.com/dart-lang/sdk/issues/51511
Change-Id: Ifedd3387a368233a2d01e1bcaa9f5e3eceb76856
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286782
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Alexander Markov <alexmarkov@google.com>
2023-03-07 10:10:25 +00:00
Johnni Winther e80c657dc5 [_fe_shared_analyzer] Improve support for logical and pattern
This improves the support for logical and pattern by making an
approximation of the intersection of spaces. When creating an
intersection between two [SingleSpace]s, if one of the static
types is a subtype of the other, this used for the create
intersection. Otherwise the intersection is modelled by including
an "unknown space" in the result.

Change-Id: Ia9d7324fa13f4b9850aece126de3aab3a1e63d3e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286962
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-07 10:08:47 +00:00
Johnni Winther ed33495a33 [_fe_analyzer_shared] Add SpaceCreator
This adds a [SpaceCreator] mixin used to share the code that creates
the [Space] for each pattern. This is mixed into the [PatternConverter]
in the analyzer and a similar [PatternConverter] is added to the CFE.

Change-Id: I0b284b1473b464167aa84f1948264efc4120001d
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286960
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-07 09:21:44 +00:00
Kallen Tu 7bae7294c9 [cfe/flip-modifiers] Remove error for Function completely. Rely on its modifier errors.
Change-Id: I2532f24b360ea0a2f7afb92f3393719a16fa15e3
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286957
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
2023-03-07 08:13:19 +00:00
Chloe Stefantsova 82237f9483 [cfe] Support final joint variables in switch statements
Part of https://github.com/dart-lang/sdk/issues/49749

Change-Id: I741562bd37cd5f93d4a2d1ccadcb869344bc10a2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286926
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-03-07 07:48:25 +00:00
Nicholas Shahan de44a23dd1 [test_runner] Cleanup unused compiler names
"dartdevc" and "dartdevk" have been replaced with "ddc".

Change-Id: I823bc029a0bbe1295fd731efcc32961e61c6c175
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/282485
Commit-Queue: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-03-07 02:09:16 +00:00
Kallen Tu 3b50e0a921 [cfe] Fix bug where we emit an extra error that we don't want for mixin classes.
Would otherwise emit `CantUseClassAsMixin` and then if the supertype is final or interface, would emit `FinalMixinMixedInOutsideOfLibrary` and `InterfaceMixinMixedInOutsideOfLibrary`respectively. These errors together don't make sense so this CL fixes it.

Change-Id: I5fdf4e260b709e08af53cbda0414cff2ef93d3b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286951
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
2023-03-07 00:58:22 +00:00
Keerti Parthasarathy bd42ae8637 Add tests to class_to_enum and class_to_mixin using class modifiers.
Bug: 51496
Change-Id: Ib37979b39b7c63daa89c0746ac5c231a2269ef46
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286948
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Keerti Parthasarathy <keertip@google.com>
2023-03-06 23:17:51 +00:00
Brian Wilkerson c021746bc4 Automate checking for solo tests
Change-Id: Iba0134f4b31b64d3bf3eb622c57d0e40121494f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286944
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-03-06 22:53:37 +00:00
Johnni Winther c9e29fa85f [_fe_analyzer_shared] Include errors in analysis result
This propagates information about reported error to the caller of
a shared type analysis. This is used to properly turn errors into
invalid expressions/patterns, as is normally done in the CFE in
face of errors.

Change-Id: Ibb8adedccb8314fabfe18ecaa3559e32ad7267ca
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286145
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-03-06 22:06:00 +00:00
Johnni Winther 8617cc68fa [_fe_analyzer_shared] Use subpattern for CastPattern exhaustiveness
This changes the Space computation for CastPattern to just the
Space for the subpattern. For a non-throwing cast, this is exactly
what the pattern will match.

There is still potential for handling the types rejected by the cast.
For instance recognizing that the (yet) unhandled subtypes of a
sealed type are exhausted by the throw.

Change-Id: Ia846895449f37a970f87a7f6c54a0ff8285df6b0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286825
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-06 21:08:11 +00:00
Brian Wilkerson 27e874ad26 Update selection support for patterns
Change-Id: Ib301f4afc5d0989a805b269fdca25dfa527072c9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286941
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-03-06 20:52:27 +00:00
Jake Macdonald af6e1bf5a4 [flip-modifiers]: prep more tests for the class modifiers flag flip
TEST=only test changes

Change-Id: I725bd897e9e749ab6010c99ee74c20ee64e61500
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286981
Commit-Queue: Ben Konyi <bkonyi@google.com>
Reviewed-by: Ben Konyi <bkonyi@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
2023-03-06 20:52:03 +00:00
Johnni Winther 207174cc1b [_fe_analyzer_shared] Add Witness to delay witness text computation.
This adds a [Witness] class as the result of an exhaustiveness test.
This allows for testing exhaustiveness without having to compute the
textual representation of the witness.

Change-Id: I6225b6d35a23792ecc15ae769e4b70cab93e2229
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286824
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-03-06 20:42:20 +00:00
Joshua Litt c36862af90 [js] Specialize optional arguments at call sites.
Change-Id: I59b10242a5d85907c21fc99eaf1eff15b39d7191
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285701
Commit-Queue: Joshua Litt <joshualitt@google.com>
Reviewed-by: Srujan Gaddam <srujzs@google.com>
2023-03-06 19:59:32 +00:00
pq 47cab3d803 + convert_to_switch_expression assist
See: https://github.com/dart-lang/sdk/issues/50417

Initial work to support return conversions.  Arguments and assignments to come and will likely lead to some refactoring but there's enough here to benefit from some early feedback.

Thanks in advance! :D

Change-Id: Ic3d0349aa12d8c951e3afe0da3e00e2777480e38
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286861
Commit-Queue: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-03-06 19:49:13 +00:00
Johnni Winther bd02ce7a7f [cfe] Report error on : for default values
Closes #51576

TEST=pkg/front_end/testcases/general/colon_default_value

Change-Id: Ia8ccdf697d876dbefcbf2c5ed98d01634c075e74
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286183
Reviewed-by: Alexander Markov <alexmarkov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
2023-03-06 19:04:55 +00:00
Brian Wilkerson a4a255e1a9 Reland: Convert the AnalyticsManager to use the analytics package
Change-Id: Id3fd3fa172a77fe081ad3f718ba2c893dfd550e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286600
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Keerti Parthasarathy <keertip@google.com>
2023-03-06 17:24:17 +00:00
Johnni Winther 12ea77b96e [_fe_analyzer_shared] Remove old Space model
This remove the [Space] class from the old algorithm and instead
encodes the patterns into the new model. The [Pattern] and
[Patterns] classes of the new model have been renamed to
[SingleSpace] and [Space], respectively, and a [Path] class is
added to track the path property used in the model of the new
algorithm.

Change-Id: I0c86c738807030be2f9b59f3aefb5bfcf5bbaeee
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286501
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-06 16:57:16 +00:00
Danny Tuppeny 21bf9f4ba6 [analysis_server] Syntax highlight the "inline" keyword
Change-Id: I1b4acaea9e0f74fda8a844bcd4d56d746a7e3bf4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286928
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-03-06 16:09:43 +00:00
William Hesse 9aa70fbdf7 Fix test_runner package unit tests
Fix test_runner's handling of tests passed as
relative native file paths to the test runner command.
Fix failing use of a special executable to test a crashing process.

Change-Id: I0837a0c2c4461883a604aa85083c3098dfbaae2e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286821
Reviewed-by: Devon Carew <devoncarew@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Commit-Queue: William Hesse <whesse@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
2023-03-06 13:57:49 +00:00
Ömer Sinan Ağacan 6a0857952c [dart2wasm] Update type names list type
Change from `List<_StringBase>` to `List<String>`, as that's what
`_getTypeNames` returns.

Change-Id: Ib216796eb0a105e81e45d6217c2a6ddb015129c1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286923
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>
2023-03-06 10:40:48 +00:00
Johnni Winther 6f752165ea [cfe] Handle continue to default case
Closes #51553

Change-Id: I1a1174e786eeb79db42e6da940a03cf05c2dabe5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286823
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
2023-03-06 10:13:31 +00:00
Chloe Stefantsova 874e7ee056 [cfe] Implement matchMapType for the shared analysis of patterns
Part of https://github.com/dart-lang/sdk/issues/49749

Closes https://github.com/dart-lang/sdk/issues/51523

Change-Id: I4875020510246761878e71b969698cbd1baa0de0
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286822
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Chloe Stefantsova <cstefantsova@google.com>
2023-03-06 08:47:38 +00:00
Brian Wilkerson cb7366482c Move some tests from keyword contributor
This proved to be quite a bit more time consuming than I'd realized,
and it was a lot harder to verify the results than I would have
guessed.

But I think it made it easier to see holes in our location coverage
to have the tests split up this way. I decided not to fill those
holes in this CL in the hope that it's easier to see the
correspondence between the old tests and the new tests.

Change-Id: Ia73ce4367fc11ae78310f7ae182bf16591246597
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286871
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-03-04 18:03:58 +00:00
Ömer Sinan Ağacan 22c45b2e0c [dart2wasm] Implement instantiation closure equality
Changes:

- Instantiation context structs now have a common supertype:
  `#InstantiationClosureContextBase`. This supertype is used to check if
  a closure is an instantiation.

- Generic closure vtables now have one more entry for comparing types in
  instantiation contexts.

- All instantiations with same number of types use the same context
  struct type and the vtable entry for comparing types in contexts.

- `_Closure._equals` checks if closures are instantiations (with a type
  test against `#InstantiationClosureContextBase`), and if they are,
  gets the contexts and calls the function in the vtable for comparing
  the types in the contexts.

Fixes #51030

Change-Id: I680041480963381337dcfa1fbf6c3a77ca564205
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285902
Commit-Queue: Ömer Ağacan <omersa@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
2023-03-04 11:55:37 +00:00
Brian Wilkerson 262acf7c90 Allow completion tests to include suggestions of private identifiers
Change-Id: I4b735b75d0ab67598624bab3d340ef2e6ca25f37
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286868
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Brian Wilkerson <brianwilkerson@google.com>
2023-03-04 05:45:19 +00:00
Konstantin Shcheglov 25554cb6e6 Issue 51561. Update SuperContext to check late instance fields of extensions.
Bug: https://github.com/dart-lang/sdk/issues/51561
Change-Id: I6d953cbea3fae8792fecdeb5df3d44b292127c89
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286864
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-03-04 01:59:18 +00:00
Konstantin Shcheglov 08d9d8586a Don't report UNUSED_LOCAL_VARIABLE for already DUPLICATE_VARIABLE_PATTERN.
Change-Id: I14dd9bdd76d006f230653fa74c1410af63d84fd1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286866
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
2023-03-03 20:30:14 +00:00
Ryan Macnak cbb4881f0d [test_runner] Make AppJIT testing work with QEMU.
Change-Id: I784e24c1fbb04fefc09497cbc6006f5d330afec1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/285344
Reviewed-by: Daco Harkes <dacoharkes@google.com>
Commit-Queue: Ryan Macnak <rmacnak@google.com>
Reviewed-by: Jonas Termansen <sortie@google.com>
2023-03-03 18:59:16 +00:00
Robert Nystrom c33ece3515 Roll dart_style into the SDK.
This contains support for all of the 3.0 language features. It also
contains a couple of very minor style changes. Unlike the previous
reverted roll (https://dart-review.googlesource.com/c/sdk/+/285460),
this does *not* contain the style change to support compact switch
statements. This should eliminate most of the style churn.

Change-Id: I95dd73a3a921b4a0cd278a7abb86daf8eea21397
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286701
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Bob Nystrom <rnystrom@google.com>
2023-03-03 18:53:20 +00:00
Derek Xu db556df468 [VM/Service] Start testing mixins in get_object_rpc_test.dart
Change-Id: I1a2f83c197398abc7a568840ba73f63c55f9e9f4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286024
Reviewed-by: Ben Konyi <bkonyi@google.com>
Commit-Queue: Derek Xu <derekx@google.com>
2023-03-03 17:48:21 +00:00
Konstantin Shcheglov f67f7d11d7 Track a reason for a pattern variable inconsistency.
This allows us report more specific errors.

Bug: https://github.com/dart-lang/sdk/issues/51505
Change-Id: I6e40af1fedce55886a58b954721154db933ede17
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286605
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-03-03 16:14:48 +00:00
Johnni Winther 2a746cb51f [_fe_analyzer_shared] Improve exhaustiveness for null-assert
This improves the exhaustiveness handling for null assert patterns
by extending the space of the subpattern with the null space. This
reflects the fact that null assert will throw on `null` and can
therefore be considered to cover that case.

Change-Id: If344eaaa55dcc70474f45519b53586e7d36e6e80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286400
Commit-Queue: Johnni Winther <johnniwinther@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-03-03 12:31:26 +00:00
Lasse R.H. Nielsen cc736dfb65 [flip-modifiers]: Reapply "Enforce current library restrictions."
This reapplies commit 0c05e33836
and reverts the revert 029e0cec71.

Tested: Added few new tests, updated existing. Mainly regression testing.
CoreLibraryReviewExempt: Reviewed in original CL.
Change-Id: Ifcc79ce2f9375f607722643a04957b0961e6c295
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284304
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Lasse Nielsen <lrn@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
2023-03-03 09:37:38 +00:00
Konstantin Shcheglov a3038980d5 Update the list of patterns in DartPatternImpl.
Change-Id: Ieb10c848536d087a7cefb6e537d3e3c33321f644
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286607
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
2023-03-03 02:02:38 +00:00
Nate Biggs 2ba8a4cd2a [dart2js] Use JS '==' operator when one side of an identical operation is typed as definitely null.
Change-Id: I4519684a9750cb47b478dc0c83da836c8cd2dfde
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286680
Commit-Queue: Nate Biggs <natebiggs@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-03-03 01:07:40 +00:00
Nate Biggs 00effc3689 [dart2js] Improve linearized inferrer's type results.
- Only add type as input if the info doesn't have one. This was causing nulls to be added into implementations of `==` where they weren't being added before.
- Add a mechanism to avoid virtual targets for dynamic calls with specified selectors. Inference results suffer when virtual targets are used for the 3 specified selectors as these lead to intercepted calls that cannot be optimized out.

After this change in a big program there are 42 member type differences between the linearized and current algorithms in a program with ~84.5k member types. Some of those 42 are actually improvements on the current algorithm that we get since the new algorithm no longer imposes a refinement limit (except to catch non-converging types).

Change-Id: Ic15d95345e1e2fdc25aa74df00f72e1920fbd3a7
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284860
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Nate Biggs <natebiggs@google.com>
2023-03-03 01:03:44 +00:00
Alexander Markov e27923a5a0 [dart2js] Static weak references to method tearoffs
TEST=language/static_weak_reference_test
TEST=language/static_weak_reference_error_test

Bug: b/269223463

Cq-Include-Trybots: luci.dart.try:vm-kernel-precomp-nnbd-linux-release-x64-try
Change-Id: I760476a7c81751f6c302f21251b525cb5c916c02
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/284489
Reviewed-by: Johnni Winther <johnniwinther@google.com>
Commit-Queue: Alexander Markov <alexmarkov@google.com>
Reviewed-by: Stephen Adams <sra@google.com>
2023-03-02 20:04:19 +00:00
Konstantin Shcheglov 3e62dba022 Issue 50588. Test that EQUAL_KEYS_IN_MAP_PATTERN is reported for double(s).
Bug: https://github.com/dart-lang/sdk/issues/50588
Change-Id: I952d0ec59045c68f63a5f028083cf17c1b633f3f
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286522
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Samuel Rawlins <srawlins@google.com>
2023-03-02 19:56:27 +00:00
Jake Macdonald b83359599e [flip-modifiers]: prep dart2js language tests for class modifiers flag flip
Change-Id: I3eccd65b982628fa9775a94b1ac61b48d8732f80
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/286540
Reviewed-by: Bob Nystrom <rnystrom@google.com>
Auto-Submit: Jake Macdonald <jakemac@google.com>
Commit-Queue: Jake Macdonald <jakemac@google.com>
2023-03-02 19:09:45 +00:00