Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Analyzer tests use factory something() => null; as test code. #40603

Closed
lrhn opened this issue Feb 12, 2020 · 2 comments
Closed

Analyzer tests use factory something() => null; as test code. #40603

lrhn opened this issue Feb 12, 2020 · 2 comments
Assignees
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. NNBD Issues related to NNBD Release

Comments

@lrhn
Copy link
Member

lrhn commented Feb 12, 2020

With null-safety, a factory can no longer return null. The implicit return type is non-nullable, so all these factory constructors become invalid code. The tests need to be fixed before the code can be migrated to null safety.

Example from pkg/analysis_server/test/analysis/notification_highlights2_test.dart:

factory A() => null;

Other occurrences are in the mock_sdk.dart library

@lrhn lrhn added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. NNBD Issues related to NNBD Release labels Feb 12, 2020
@scheglov scheglov self-assigned this Feb 12, 2020
@scheglov
Copy link
Contributor

dart-bot pushed a commit that referenced this issue Feb 12, 2020
I did not change MockSdk, to avoid conflict with
https://dart-review.googlesource.com/c/sdk/+/135241

R=brianwilkerson@google.com

Bug: #40603
Change-Id: I9f0af20f5914b5ac1aefee02aa8052db269529b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/135532
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
@scheglov
Copy link
Contributor

dart-bot pushed a commit that referenced this issue Feb 27, 2020
Bug: #40603
Change-Id: Id1060773d303527424bde02785a5c21651df4c85
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/137422
Reviewed-by: Brian Wilkerson <brianwilkerson@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. NNBD Issues related to NNBD Release
Projects
None yet
Development

No branches or pull requests

2 participants