dart-sdk/tests
Paul Berry c23ac067eb Improve the behavior of "why not promoted" when field promotion disabled.
If the user attempts to promote a property, and their language version
does not permit field promotion, the "why not promoted" logic now
checks whether the language version is the sole reason for the failure
in property promotion. In other words, it checks whether the property
would have been promotable *if* field promotion had been enabled. If
it would, then the context message displayed to the user explains that
the property did not promote because field promotion is not supported
by the current language version.

However, if there is some secondary reason why the property failed to
promote (in other words, if the property would not have been
promotable even if field promotion had been enabled), then the context
message now favors the secondary reason.

Rationale: imagine a user is maintaining a package that doesn't yet
support SDK version 3.2, and that package contains some property
that's non-promotable both because the language version is prior to
3.2 *and* for some other reason (e.g., because the property isn't a
private field). It would be quite frustrating if the user saw a
context message suggesting that the property would be promotable in
SDK 3.2, and then went to a lot of effort to bump their minimum SDK
version, only to discover *after* the bump that the property is still
not promotable.

In the process of making this change, I discovered that the CFE
doesn't support field promotion in patch files. This is because patch
files aren't listed in `SourceLoader.sourceLibraryBuilders`, so the
logic in the `FieldPromotability` is never invoked for those
files. Since patch files are an artifact of SDK development, and will
never be used by end users, it doesn't seem worth going to extra
effort to add this support. However, I've taken care to make sure that
the "why not promoted" logic recovers gracefully in patch files (by
simply not generating a context message).

Change-Id: I6c0d1c0f4b8a7690f6f775408cb5e857b2dd7b03
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/330241
Commit-Queue: Paul Berry <paulberry@google.com>
Reviewed-by: Phil Quitslund <pquitslund@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Lasse Nielsen <lrn@google.com>
2023-10-25 19:41:26 +00:00
..
co19 [co19] Roll co19 to 6ec024498b3546c775b65cd2d964eb3c6ff0fb2f 2023-09-29 13:59:53 +00:00
co19_2 [test] Introduce status variable $simulator, and fix some cases missing simarm_x64. 2023-04-04 03:10:26 +00:00
corelib [vm, lib] Fix out-of-bounds access in BigInt.>>. 2023-09-11 21:05:38 +00:00
corelib_2 [dart2js] Add Dart web speciailized expectation helpers. 2023-08-11 20:59:30 +00:00
dartdevc [ddc] Update for extra null safety checks in RTI 2023-10-19 21:32:15 +00:00
dartdevc_2 [cfe] Introduce StructuralParameters 2023-09-25 10:44:41 +00:00
ffi [vm, ffi] Handle MultipleNativeLocations that aren't just byte copies. 2023-10-25 15:57:12 +00:00
ffi_2 [vm, ffi] Round up checking for registers for small structs. 2023-10-17 23:01:17 +00:00
language Improve the behavior of "why not promoted" when field promotion disabled. 2023-10-25 19:41:26 +00:00
language_2 [test] Remove ARM64-specific status entries. 2023-10-09 19:30:29 +00:00
lib [gardening] Remove lib{,_2}/mirrors/typedef_test 2023-10-24 12:17:03 +00:00
lib_2 [gardening] Remove lib{,_2}/mirrors/typedef_test 2023-10-24 12:17:03 +00:00
modular Fix incorrect file reference in license headers 2023-09-18 06:44:08 +00:00
standalone Add a test for the byte truncation behavior of writeAsBytes. 2023-10-19 16:17:03 +00:00
web [web] fix improperly migrated tests. 2023-10-25 15:37:50 +00:00
web_2 [web] fix improperly migrated tests. 2023-10-25 15:37:50 +00:00
legacy_status_dart2js.csv Spelling tests 2022-12-19 12:56:47 +00:00
OWNERS [infra] Add OWNERS to the Dart SDK 2022-02-14 14:06:34 +00:00
README.md

This directory contains tests of the language and core library implementations. For more information, see https://github.com/dart-lang/sdk/wiki/Testing.