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

Do not report missing members for Never #40057

Closed
eernstg opened this issue Jan 10, 2020 · 6 comments
Closed

Do not report missing members for Never #40057

eernstg opened this issue Jan 10, 2020 · 6 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 type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)

Comments

@eernstg
Copy link
Member

eernstg commented Jan 10, 2020

Member accesses on Never should be allowed (cf. dart-lang/language#711 (comment)) and issues arising because the resulting code is likely to be a bug should be handled by detecting and flagging unreachable code with a warning.

So a receiver of type Never is treated as if it had all member signatures, just like a receiver of type dynamic. For example, it is also assumed to have a setter named s= whose parameter type admits the argument 1.

However, the analyzer reports in this log concerning static_errors_A13_t01 that specific members do not exist for a receiver of type Never, and it is implied that there is a setter s=, but that it has argument type Never (cf. the error about line 24):

ERROR|STATIC_TYPE_WARNING|UNDEFINED_SETTER|/b/s/w/ir/cache/builder/sdk/tests/co19/src/LanguageFeatures/nnbd/static_errors_A13_t01.dart|30|9|1|The setter 's' isn't defined for the class 'Never'.
ERROR|STATIC_TYPE_WARNING|UNDEFINED_SETTER|/b/s/w/ir/cache/builder/sdk/tests/co19/src/LanguageFeatures/nnbd/static_errors_A13_t01.dart|27|8|1|The setter 's' isn't defined for the class 'Never'.
ERROR|STATIC_TYPE_WARNING|INVALID_ASSIGNMENT|/b/s/w/ir/cache/builder/sdk/tests/co19/src/LanguageFeatures/nnbd/static_errors_A13_t01.dart|24|11|1|A value of type 'int' can't be assigned to a variable of type 'Never'.
ERROR|STATIC_TYPE_WARNING|UNDEFINED_SETTER|/b/s/w/ir/cache/builder/sdk/tests/co19/src/LanguageFeatures/nnbd/static_errors_A13_t01.dart|24|7|1|The setter 's' isn't defined for the class 'Never'.
@eernstg
Copy link
Member Author

eernstg commented Jan 10, 2020

static_errors_A13_t02 shows the same issue.

dart-bot pushed a commit that referenced this issue Jan 10, 2020
2019-12-30 sgrekhov@unipro.ru Requirements=nnbd-strong added to NNBD tests
2019-12-27 sgrekhov@unipro.ru NNBD. Minor wording change
2019-12-26 sgrekhov@unipro.ru Override checking NNBD tests fixed
2019-12-26 irina.arkhipets@gmail.com Fixed Issue 465: Needless Issue tag removed.
2019-12-26 irina.arkhipets@gmail.com Fixed Issue 465: tests for overriding with NNBD re-named and corrected. New tests added.
2019-12-25 sgrekhov@unipro.ru Issue numbers added to some NNBD tests
2019-12-24 irina.arkhipets@gmail.com Fixed Issue 465: tests for overriding with NNBD re-named and corrected. New tests added.
2019-12-23 irina.arkhipets@gmail.com Fixed Issue 465: tests for overriding with NNBD re-named and corrected. New tests added.
2019-12-19 sgrekhov@unipro.ru Analyzer failures triaged. Some tests fixed, for some issue numbers added
2019-12-19 sgrekhov@unipro.ru Requirements=nnbd-strong flag added to the 'late' tests
2019-12-19 sgrekhov@unipro.ru Late variables tests fixed and new ones added

Reported issues:
#40055
#40057
dart-lang/co19#510
dart-lang/co19#511

Change-Id: I4c2737ce3b9fb392d9035079611f85db0b116351
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131060
Reviewed-by: William Hesse <whesse@google.com>
@eernstg eernstg added area-analyzer Use area-analyzer for Dart analyzer issues, including the analysis server and code completion. type-bug Incorrect behavior (everything from a crash to more subtle misbehavior) labels Jan 14, 2020
@eernstg
Copy link
Member Author

eernstg commented Jan 14, 2020

Note that #40126 reports the same issue, and includes more details about the output from the analyzer.

@bwilkerson
Copy link
Member

@scheglov

@scheglov
Copy link
Contributor

static_errors_A13_t02 uses non-function typedef, so is not supported.

@scheglov
Copy link
Contributor

@scheglov scheglov self-assigned this Jan 14, 2020
@scheglov scheglov added the NNBD Issues related to NNBD Release label Jan 14, 2020
dart-bot pushed a commit that referenced this issue Jan 14, 2020
Bug: #40057
Change-Id: Ia53e01b7aa5e41a80e88b14aabdffc31cbc683b5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131706
Reviewed-by: Paul Berry <paulberry@google.com>
Commit-Queue: Konstantin Shcheglov <scheglov@google.com>
@scheglov
Copy link
Contributor

https://dart-review.googlesource.com/c/sdk/+/131721 will downgrade it from a warning to a hint.

dart-bot pushed a commit that referenced this issue Jan 15, 2020
Bug: #40057
Change-Id: I49f56b7efa4c88a86fda071c6063b308062784bf
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/131721
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 type-bug Incorrect behavior (everything from a crash to more subtle misbehavior)
Projects
None yet
Development

No branches or pull requests

3 participants