-
Notifications
You must be signed in to change notification settings - Fork 28
A potentially spurious expected upper bound in an extension types test #2313
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
Comments
/cc @eernstg |
Right, However, I think the specification fails to make this work in cases like this one. We have the following rule:
This is sufficient to give rise to the desired superinterface graph for an extension type with no
It may well be a seemingly redundant edge in the superinterface graph because there is some other way to So please consider the specification to be adjusted as mentioned above, and keep an eye on dart-lang/language#3402. |
The intention is that an extension type is non-nullable if its representation type is, because we make it have I agree that the current text fails to capture that. Whether an extension type is non-nullable is a property of the type, not the declaration. It doesn't necessarily make sense to ask whether a generic extension type declaration is non-nullable or not. Sometimes it's easy, and we can see that the declared representation type is non-nullable, which means that it will be non-nullable no matter how the type variables are instantiated. Other times the representation type is trivially always nullable. But in cases like: extension type E<T>(T _) {
void foo() {
this ?? print("really?"); // Valid code, shouldn't have warnings.
}
} we can't say whether |
Fixed by #2314. But I'm not closing this issue. First, please note that the tests is still failing in both analyzer and CFE co19/LanguageFeatures/Extension-types/upper_bound_A01_t05.dart Lines 32 to 33 in 9d347fd
Tools are expecting I'm also going to add more tests regarding nullability as part of this issue. In particular we have no test that there should be no warning in case of extension type E<T>(T _) {
void foo() {
this ?? print("really?"); // Valid code, shouldn't have warnings. But we have!
}
} |
Sounds good! The fact that |
The CFE compiles line 33 without emitting an error message. That may be due to the landing of dart-lang/sdk@c658b46 earlier today. |
Yes, confirming. No CFE issue on the top SDK. Analyzer issue only |
2023-10-23 [email protected] Fixes dart-lang/co19#2319. Fix roll failures (dart-lang/co19#2321) 2023-10-23 [email protected] dart-lang/co19#1400. [Extension types] Add more top types tests (dart-lang/co19#2322) 2023-10-18 [email protected] dart-lang/co19#1400. [Extension types] Add more superinterfaces tests (dart-lang/co19#2315) 2023-10-18 [email protected] dart-lang/co19#2291. Add more Link.createSync() tests. Part 2 (dart-lang/co19#2316) 2023-10-17 [email protected] Fixes dart-lang/co19#2304. Add more `Object` member tests (dart-lang/co19#2312) 2023-10-17 [email protected] dart-lang/co19#2313. Fix expected static type in upper_bound_A01_t05.dart (dart-lang/co19#2314) Change-Id: Id5279b7bad5e45c7e8a5d2fa7cbffe49bd1b2093 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/331860 Reviewed-by: Erik Ernst <[email protected]> Reviewed-by: Alexander Thomas <[email protected]>
2023-10-25 [email protected] Fixes dart-lang/co19#2329. Fix FileSystemEntity.type() on Windows (dart-lang/co19#2332) 2023-10-25 [email protected] Fixes dart-lang/co19#2330. Remove obsolete error expectation (dart-lang/co19#2331) 2023-10-25 [email protected] Fixes dart-lang/co19#2317. Add tests for extension type type parameters in non-covariant position (dart-lang/co19#2318) 2023-10-25 [email protected] dart-lang/co19#2291. Update `Link.createSync()` according to the new documentation. Part 1 (dart-lang/co19#2305) 2023-10-24 [email protected] dart-lang/co19#2313. [Extension types] Add nullability tests (dart-lang/co19#2324) 2023-10-24 [email protected] dart-lang/co19#2323. Delete obsolete test (dart-lang/co19#2327) 2023-10-24 [email protected] Fixes dart-lang/co19#2323. Don't test datagram size more than 65503 (dart-lang/co19#2325) Change-Id: I23b57a58b5cd6452e2beb923dd8cde6fd587f051 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/332206 Reviewed-by: Alexander Thomas <[email protected]> Reviewed-by: Erik Ernst <[email protected]> Commit-Queue: Alexander Thomas <[email protected]>
It seems that in the following lines
Object
should be the expected upper bound betweenET3("String")
andET4(3)
, notObject?
, because both types are non-nullable.co19/LanguageFeatures/Extension-types/upper_bound_A01_t05.dart
Lines 35 to 36 in 9d347fd
The text was updated successfully, but these errors were encountered: