We add the `dart.tool.dart2wasm.minify` environment define (analogous to
how dart2js exposes `dart.tool.dart2js.minify`).
We make `package:expect/variations.dart` then expose to tests what
guarantees they can assume, namely
* `readableTypeStrings`
* `preciseErrorsWithDetails`
Change-Id: I43da09ed924ca9137721f4d70b7a494e01bf36e4
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/430680
Reviewed-by: Ömer Ağacan <omersa@google.com>
Commit-Queue: Martin Kustermann <kustermann@google.com>
The way this is accomplished is that in
`_FlowAnalysisImpl.nullAwareAccess_rightBegin`, any expression
reference associated with the target of the null-aware access is
restored, and the corresponding SSA node is associated with the guard
variable (if any). These changes ensure that if the null-aware access
is a property get, the subsequent call to `propertyGet` will pick up
the appropriate SSA node, so it will be able to locate the promotion
key for the property.
This functionality is only enabled when the language feature
`sound-flow-analysis` is enabled.
To prevent test regressions, a few related changes need to be made at
the same time:
- `_FlowAnalysisImpl.nullAwareAccess_end` is changed so that it clears
any expression info or expression reference that was associated with
the null-aware access expression. This prevents flow analysis
information from being erroneously propagated out of a null-aware
expression, which would have led to assertion failures when
analyzing null-aware expressions inside of conditional
expressions. This wasn't previously a problem because the expression
reference used to be consumed by
`_FlowAnalysisImpl.nullAwareAccess_rightBegin`, preventing further
expression references and expression infos from being recorded
further along in the null-aware access.
- The test framework in `mini_ast.dart` is fixed so that `!` is
considered to participate in null shorting. This was a bug in the
test framework that wasn't previously caught because it happened not
to produce any test failures.
- The analyzer's method `PostfixExpressionResolver._resolveNullCheck`
is changed so that it calls `nonNullAssert_end` before terminating
null-aware access. Previously, the order was swapped, causing
`nullAwareAccess_end` to be called before `nonNullAssert_end` when
analyzing expressions like `a?.b!`. This used to be benign, but now
that non-cascaded field accesses participate in field promotion,
flow analysis needs the methods to be called in the correct order.
Fixes https://github.com/dart-lang/language/issues/4344.
Bug: https://github.com/dart-lang/language/issues/4344
Change-Id: I523be1b4be1af3f68654a745187a546728c878fe
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427820
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
`_potentiallyAssertNotNull` would insert null checks to catch issues
from mixing libraries sound and unsound null safety. The null checks
are now always optimized away so we might as well never insert them.
Bug: #60327
Change-Id: I092a4fb336e46bf33b9b3cd9867dd7b6d8f9c65e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/427569
Reviewed-by: Mayank Patke <fishythefish@google.com>
Commit-Queue: Stephen Adams <sra@google.com>
Reviewed-by: Jake Macdonald <jakemac@google.com>
As discussed in https://github.com/dart-lang/language/issues/4344, the
current implementation has some inconsistencies in how null-aware
accesses interact with field promotion. I intend to fix these
inconsistencies as part of the `sound-flow-analysis` language feature.
In this CL, I'm adding a regression test of the behavior that's
currently implemented (as of Dart 3.8), to help me make sure that when
I implement the new behavior, the changes will only take effect when
`sound-flow-analysis` is enabled.
Bug: https://github.com/dart-lang/language/issues/4344
Change-Id: If52a0ad044399904e3389af2130ca802efdd7058
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425922
Reviewed-by: Lasse Nielsen <lrn@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
This is a bug fix of the current implementation of dot shorthands type argument resolution. We want to make sure we're doing inference with the proper context type given at that point (with the element based on the dot shorthand context type we've saved).
Then I made sure there was proper argument checking, not just for `FunctionExpressionInvocation`s, but with `DotShorthandInvocation`s as well.
Tested with unit tests and language tests.
Bug: https://github.com/dart-lang/sdk/issues/59835
Change-Id: I795046502214628389c6471e9424aca7152657e2
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425780
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Added `DOT_SHORTHAND_MISSING_CONTEXT` error code for when we don't find a valid context type to resolve the dot shorthand head with. `DOT_SHORTHAND_UNDEFINED_GETTER` is used for being unable to find a static getter or field with a certain context type and name.
Unit tests added and a few language error + co19 tests passing (eg `simple_identifier_extends_error_test`).
Bug: https://github.com/dart-lang/sdk/issues/59835
Change-Id: Ic515b57dd0f4243b049e02bd58b694a500d57975
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/425181
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
Context:
A while back, I inserted a synthetic token in the parser to allow us to parse without crashing the analyzer while I worked on the CFE. Now that both implementations are up and working, we can remove this synthetic token and allow the parser to parse as if we had enabled dot shorthands by default, and produce an error if the experiment isn't enabled.
This change allows a bunch of different language tests to start passing since they were blocked on the weird synthetic token messing up the parsing stream.
Bug: https://github.com/dart-lang/sdk/issues/59758
Change-Id: I792e3b917a76241b04ee708de06f670bbde64036
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423563
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Commit-Queue: Kallen Tu <kallentu@google.com>
The tests that don't end in `_disabled_test.dart` exercise all the new
behaviors introduced with the `sound-flow-analysis` feature. The tests
that _do_ end in `_disabled_test.dart` verify that when the language
version is 3.8, the old behavior of flow analysis is preserved.
For the sake of thoroughness, I've also elected to include tests for a
few behaviors that aren't new, just because they seem logically
related to the new behaviors (for example, in the tests for the `==`
and `!=` operator, I've included a test that `null == null` is known
to evaluate to `true`, even though this behavior existed even before
the `sound-flow-analysis` feature was implemented). These tests are
marked with the comment "(this behavior predates sound-flow-analysis)"
in the `_disabled_test.dart` files.
Bug: https://github.com/dart-lang/sdk/issues/60438
Change-Id: If2895355bb1a2eeb2415a5a1012d73ae87c244dd
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/423040
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>
Allows the resolution of `.new` constructor references and static property accesses, using the existing `PropertyElementResolver` resolution logic.
Testing includes an AST builder test, and the `DotShorthandPropertyAccess` resolution tests. Some property access language tests are now passing.
Bug: https://github.com/dart-lang/sdk/issues/59835
Change-Id: Idb576ef7fa0866bc4b2d155bbf867886ae2b4df6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/421964
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
This replaces the individual lookups of getables and setables in LookupScope and NameSpace with single lookup that returns a LookupResult holding both the getable and the setable. This prepares for having getter/setter pairs in the same SourcePropertyBuilder and avoids the need for AccessErrorBuilder for handling lookups of getters where only setters exist and vice versa.
Change-Id: I2b1e2477ed43506d9f94c48acd4b44277b490540
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/420080
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Commit-Queue: Johnni Winther <johnniwinther@google.com>
This CL adds support for constructor tearoffs in dot shorthands. If there's any type parameters on the tearoff and it's a constructor, we produce an error.
I also updated the expectations of existing tests due to an early return of `InvalidExpression`s and added language + cfe tests for the new behavior.
This CL fixes the following co19 tests and is a follow up to https://github.com/dart-lang/co19/issues/3122
co19/LanguageFeatures/Static-access-shorthand/constant_expression_A03_t01
co19/LanguageFeatures/Static-access-shorthand/constant_expression_A04_t01
co19/LanguageFeatures/Static-access-shorthand/semantics_A05_t01
co19/LanguageFeatures/Static-access-shorthand/constant_expression_A03_t02
Bug: https://github.com/dart-lang/sdk/issues/59758, https://github.com/dart-lang/co19/issues/3122
Change-Id: I1ea837342ad818cd3b1de9e422065f42e8a61d6b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/419782
Commit-Queue: Kallen Tu <kallentu@google.com>
Reviewed-by: Chloe Stefantsova <cstefantsova@google.com>
This removes the 'bind' and 'bindCall' methods in our runtime in favor of extending 'tearoff' to support their behavior. Also introduces 'superTearoff' for invoking torn off super members late.
Change-Id: I52ab797558a225c57cc2c6197c7b1bfa7f05a3c6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/416763
Commit-Queue: Mark Zhou <markzipan@google.com>
Reviewed-by: Nicholas Shahan <nshahan@google.com>
Reviewed-by: Bob Nystrom <rnystrom@google.com>
With symbols as function parameter names we can improve the happy path
in function type and shape checks by using `identical` instead of
`compareTo` when comparing names.
We also minify constant symbols by giving them fresh indices (starting
from 0) and changing symbol values as base64 encoding of the indices.
Change-Id: I6457c1db94444e3d6e45c4f6dd832c6c73ff2844
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/414740
Reviewed-by: Martin Kustermann <kustermann@google.com>
Commit-Queue: Ömer Ağacan <omersa@google.com>