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

co19/LanguageFeatures/Extension-types/promotion_A01_t01 #2271

Closed
scheglov opened this issue Sep 11, 2023 · 3 comments
Closed

co19/LanguageFeatures/Extension-types/promotion_A01_t01 #2271

scheglov opened this issue Sep 11, 2023 · 3 comments
Assignees
Labels
bad-test Report tests in need of updates. When closed, the tests should be considered good

Comments

@scheglov
Copy link

  ET2<num?> et2 = ET2(2);
  if (et2.id != null) {
    et2.id.isEven;
  }

Do we expect promotion of et2 to ET2<int> in the declaration?
I think this does not happen, by two reasons:

  1. ET2(2) is inferred as ET2<num?>, not ET2<int>.
  2. The declaration of et2 does not promote it to ET2<int> anyway, because it is not a type of interest.
@sgrekhov sgrekhov self-assigned this Sep 12, 2023
@sgrekhov sgrekhov added the bad-test Report tests in need of updates. When closed, the tests should be considered good label Sep 12, 2023
sgrekhov added a commit to sgrekhov/co19 that referenced this issue Sep 12, 2023
@eernstg
Copy link
Member

eernstg commented Sep 12, 2023

(This test will be updated one more time, because promotion of a representation variable isn't sound in the first place.)

Edit: That wasn't true, cf. dart-lang/sdk#53446, promotion of a representation variable is sound. However, it's still not determined exactly when the promotion is allowed to take place.

If et2.id is allowed to be promoted in the example then isEven should still be a compile-time error, but et2.id should be promoted from num? to num, and it should then be allowed to invoke a method like floor().

@sgrekhov sgrekhov reopened this Sep 12, 2023
sgrekhov added a commit to sgrekhov/co19 that referenced this issue Sep 12, 2023
@eernstg
Copy link
Member

eernstg commented Sep 12, 2023

I can see that the test has now been updated to promote et2.id to int. That should work if promotion of et2.id is allowed in the first place.

Awaiting the discussion in dart-lang/sdk#53446 for that.

@sgrekhov
Copy link
Contributor

Resolved by #2279

copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Sep 18, 2023
2023-09-15 [email protected] dart-lang/co19#1400. Update error expectations for CFE (dart-lang/co19#2282)
2023-09-15 [email protected] Fixes dart-lang/co19#2147. Add access to this tests (dart-lang/co19#2280)
2023-09-15 [email protected] dart-lang/co19#2258. Add missing experimental flag (dart-lang/co19#2281)
2023-09-14 [email protected] dart-lang/co19#2258. Only private field of an extension type is promotable (dart-lang/co19#2279)
2023-09-14 [email protected] Fixes dart-lang/co19#2261. Remove obsolete inference-update-2 experimental flag (dart-lang/co19#2278)
2023-09-14 [email protected] dart-lang/co19#2258. No error ib case of the `noSuchMethod` forwarder of a method (dart-lang/co19#2277)
2023-09-13 [email protected] dart-lang/co19#2258. Add more private fields promotion tests (dart-lang/co19#2276)
2023-09-13 [email protected] Fixes dart-lang/co19#2265. Extension types. Add more member conflict tests (dart-lang/co19#2270)
2023-09-12 [email protected] dart-lang/co19#1400. Add type aliases test (dart-lang/co19#2274)
2023-09-12 [email protected] Fixes dart-lang/co19#2271. Fix typo in promotion_A01_t01.dart (dart-lang/co19#2272)

Change-Id: Icc18b7b8e8c7aea103fc255e0da01a5f15601dac
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/326303
Reviewed-by: Alexander Thomas <[email protected]>
Reviewed-by: Erik Ernst <[email protected]>
Commit-Queue: Alexander Thomas <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bad-test Report tests in need of updates. When closed, the tests should be considered good
Projects
None yet
Development

No branches or pull requests

3 participants