mirror of
https://github.com/dart-lang/sdk
synced 2024-09-16 03:27:43 +00:00
c23ac067eb
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> |
||
---|---|---|
.. | ||
co19 | ||
co19_2 | ||
corelib | ||
corelib_2 | ||
dartdevc | ||
dartdevc_2 | ||
ffi | ||
ffi_2 | ||
language | ||
language_2 | ||
lib | ||
lib_2 | ||
modular | ||
standalone | ||
web | ||
web_2 | ||
legacy_status_dart2js.csv | ||
OWNERS | ||
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.