It is not a huge improvement, because it does not add static safety,
for this we would need to distinguish between unresolved and resolved
expressions, as separate types.
But it is still an improvement.
1. We get to know the node that was not resolved.
Maybe not enough, in case if it was because of the enclosing
now that this node was not resolved. But still something.
2. We group this use case into one place.
Change-Id: I2e8f029e8a5fcd8ccecdd1b6bc9d78ee9eaf12a1
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184103
Reviewed-by: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
SWITCH_EXPRESSION_NOT_ASSIGNABLE is only a pre-null safety code. Under null
safety, CASE_EXPRESSION_TYPE_IS_NOT_SWITCH_EXPRESSION_SUBTYPE is reported
instead, and this case is covered in those tests.
Also tidy up CaseExpressionTypeIsNotSwitchExpressionSubtypeTest.
Change-Id: I7c3b489200b6a8181fdf4ae7b36f826ba0b7bd6c
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184140
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
This also deletes WithNonFunctionTypeAliasesMixin and all mixin
applications.
With how the tests are set up, I had to migrate a few other test cases
to use null safety. A few tests were written in pairs, one
pre-non-function-typedefs, and one post-. These should be combined, but
doing so in this CL would create a much larger diff, with the sorting.
Bug: https://github.com/dart-lang/sdk/issues/44666
Change-Id: Iee7f329ee8d841905f08249888de85256187d84b
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/184080
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
In each included file, there is a test, and a WithNullSafety test which _does
not override_ any test cases from the base test. So the test classes are
combined into one, which is null safe. No test cases are added or removed, but
because of sorting, the diffs may be large.
Bug: https://github.com/dart-lang/sdk/issues/44666
Change-Id: Ia9bd2c512ccaa5b8de6fbe454c1275f1b8e889a9
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183783
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Some tests had some issues migrating to null safety that I
could not immediately hash out, or may warrant some more discussion.
So I've added WithoutNullSafetyMixin, and we can incrementally
migrate these after this CL.
Many tests have little no-op tweaks to make them null safe, like
initializing variables, adding late, making nullable.
Nest steps:
1. Remove `WithNullSafetyMixin` applications.
2. Remove `WithoutNullSafetyMixin` in every position with a TODO for
#44666.
3. For every file with pair(s) of test classes (one pre-null safety,
and one null safety), move around test cases so that they generally
run with null safety, unless they are testing things very specific to
before and after null safety.
Bug: https://github.com/dart-lang/sdk/issues/44666
Change-Id: I0512dedcda42e864fd580af4842702095937bdb6
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183140
Commit-Queue: Samuel Rawlins <srawlins@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Both Brian and Paul noted that in general we should express the
semantics correctly, if something is expected to be not null before
it is used, it would be nice to type it as such. This change makes
`_owner` late final, so that it is always not null, and set only once.
It should not affect performance negatively because almost always
we use `owner` inside `_initialize`, where it is a local variable.
Change-Id: I2abe45f2f98e9ac0ce69d4a65d641334244876ad
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/183044
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
This CL updates the parser so that it allows annotations of the form:
`@` <constructorDesignation> <argumentPart>
Where <argumentPart> can contain type arguments. Previously this was
prohibited at parse time.
Generic annotations are still prohibited in the current language
version, but the error is now generated by the parser listener
(BodyBuilder in the case of CFE, AstBuilder in the case of analyzer);
this should open the door for future CLs to add support for generic
annotations when the `generic-metadata` experimental flag is supplied.
Bug: https://github.com/dart-lang/sdk/issues/44838
Change-Id: I90604f38bcb378fc798c5737e486fb26589d4d1e
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182668
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Reviewed-by: Jens Johansen <jensj@google.com>
This CL changes the semantics of `Pointer<T extends Struct>.ref` to use
the compile-time `T` rather than the runtime `T`.
This enables tree shaking of subtypes of Struct and optimizing `.ref`.
Bug: https://github.com/dart-lang/sdk/issues/38721
TEST=tests/ffi/vmspecific_static_checks_test.dart
TEST=tests/ffi/*struct*test_.dart
Change-Id: Ie19bc3259d1cb721d0ce56d68e82d09dc3a4ad0e
Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try,analyzer-nnbd-linux-release-try,app-kernel-linux-debug-x64-try,dart-sdk-linux-try,front-end-nnbd-linux-release-x64-try,pkg-linux-debug-try,vm-kernel-linux-debug-x64-try,vm-kernel-nnbd-linux-debug-x64-try,vm-kernel-precomp-nnbd-linux-debug-x64-try,vm-kernel-reload-rollback-linux-debug-x64-try
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/180190
Commit-Queue: Daco Harkes <dacoharkes@google.com>
Reviewed-by: Aske Simon Christensen <askesc@google.com>
When generating the file
`pkg/analyzer/lib/src/dart/error/syntactic_errors.g.dart`, we now need
for the top level variable `fastaAnalyzerErrorCodes` to have type
`List<ErrorCode?>`.
The generated file was updated in
9f986d2501 as part of migrating the
analyzer package to null safety; this updates the code generator so
that when it is re-run in the future we won't lose the change.
Change-Id: I893c1fe6f206d5dfbfebbf7bb80d5a00fc7b56be
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/182365
Reviewed-by: Konstantin Shcheglov <scheglov@google.com>
Commit-Queue: Paul Berry <paulberry@google.com>