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

#2956. Update and rename existing tests for type void #2978

Merged
merged 5 commits into from
Nov 19, 2024

Conversation

sgrekhov
Copy link
Contributor

No description provided.

Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

I'm tempted to suggest that each of the situations where void is tested to get a specific treatment is followed up by a test which is identical, except that it uses typedef Void = void;. The purely syntactic cases should then allow Void to be used, but other places (like the implements clause of a class / ... / an extension type) would need to expand the type alias, find void, and report the error for that.

This could be done in these tests, or it could be a separate set of test libraries, in this PR or in another one, whatever is more convenient.

I commented on several cases where a compile-time error is expected, and it is a syntax error, and nothing says "syntax". I think it's useful (for future readers in particular) to explicitly mention that they are syntax errors, because syntax errors behave so differently from other errors. E.g., we would never even attempt to answer questions like "how many syntax errors does this email have, considered as a Dart program?". Also, we can't put several syntax errors together in the same test library, for the same reason.

In short, developers who read (not to mention maintain) tests involving syntax errors should be aware of the fact that they are syntax errors.

Language/Types/Type_Void/type_void_A01_t01.dart Outdated Show resolved Hide resolved
Language/Types/Type_Void/type_void_A02_t01.dart Outdated Show resolved Hide resolved
Language/Types/Type_Void/type_void_A03_t01.dart Outdated Show resolved Hide resolved
Language/Types/Type_Void/type_void_A03_t02.dart Outdated Show resolved Hide resolved
Language/Types/Type_Void/type_void_A03_t03.dart Outdated Show resolved Hide resolved
Copy link
Contributor Author

@sgrekhov sgrekhov left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added notes that some compile errors are actually syntax errors and also added tests for type alias of void. PTAL.

Language/Types/Type_Void/type_void_A01_t01.dart Outdated Show resolved Hide resolved
Language/Types/Type_Void/type_void_A02_t01.dart Outdated Show resolved Hide resolved
Fix typo (written by eernstg)
Copy link
Member

@eernstg eernstg left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@eernstg eernstg merged commit 31124f6 into dart-lang:master Nov 19, 2024
1 of 2 checks passed
copybara-service bot pushed a commit to dart-lang/sdk that referenced this pull request Nov 27, 2024
2024-11-25 sgrekhov22@gmail.com Fixes dart-lang/co19#2994. Fix a typo in type_void_A06_t11.dart (dart-lang/co19#2995)
2024-11-25 sgrekhov22@gmail.com dart-lang/co19#2559. Fix wrong assertion text in augmenting_constructors_A18_*.dart (dart-lang/co19#2993)
2024-11-25 sgrekhov22@gmail.com dart-lang/co19#2976. Add grammar tests (dart-lang/co19#2990)
2024-11-25 sgrekhov22@gmail.com Fixes dart-lang/co19#2991. Fix typos and separate tests with `external` (dart-lang/co19#2992)
2024-11-25 sgrekhov22@gmail.com dart-lang/co19#2559. Update assertions for some Augmenting libraries tests (dart-lang/co19#2989)
2024-11-21 sgrekhov22@gmail.com dart-lang/co19#2119. Update assertion texts in Wildcards tests (dart-lang/co19#2981)
2024-11-20 sgrekhov22@gmail.com dart-lang/co19#2956. Add more type `void` and `dynamic` tests (dart-lang/co19#2987)
2024-11-20 sgrekhov22@gmail.com dart-lang/co19#2979. Update existing and add new tests checking nnbd static errors (dart-lang/co19#2984)
2024-11-20 sgrekhov22@gmail.com dart-lang/co19#2979. Fix CFE failures in nnbd weak-mode tests (dart-lang/co19#2988)
2024-11-19 sgrekhov22@gmail.com dart-lang/co19#2956. Update and rename existing tests for type `void` (dart-lang/co19#2978)
2024-11-19 sgrekhov22@gmail.com dart-lang/co19#2559. Update assertions in some Augmenting libraries tests (dart-lang/co19#2986)
2024-11-19 sgrekhov22@gmail.com Fixes dart-lang/co19#2983. Change expected error in generic_parameter_inference_A01_t05.dart (dart-lang/co19#2985)
2024-11-18 sgrekhov22@gmail.com dart-lang/co19#2979. Update NNBD static errors tests. Part 2 (dart-lang/co19#2982)
2024-11-15 sgrekhov22@gmail.com dart-lang/co19#2979. Update NNBD static errors tests (dart-lang/co19#2980)

Cq-Include-Trybots: luci.dart.try:analyzer-linux-release-try
Change-Id: Ib1dcad2edfa7c6fdd996c6db94173bec91e68368
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/397340
Commit-Queue: Alexander Thomas <athom@google.com>
Reviewed-by: Alexander Thomas <athom@google.com>
Reviewed-by: Erik Ernst <eernst@google.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants