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/static_analysis_extension_types_A05_t02 #2384

Closed
scheglov opened this issue Nov 17, 2023 · 2 comments
Closed
Assignees
Labels
bad-test Report tests in need of updates. When closed, the tests should be considered good

Comments

@scheglov
Copy link

FAILED: dart2analyzer-none release_arm64 co19/LanguageFeatures/Extension-types/static_analysis_extension_types_A05_t02
Expected: Pass
Actual: MissingCompileTimeError

--- Command "dart2analyzer" (took 07.000554s):
DART_CONFIGURATION=ReleaseARM64 sdk/bin/dart --packages=.dart_tool/package_config.json pkg/analyzer_cli/bin/analyzer.dart --use-analysis-driver-memory-byte-store --dart-sdk=/Users/scheglov/Source/Dart/sdk.git/sdk/sdk -Dtest_runner.configuration=custom-configuration-1 --enable-experiment=inline-class --ignore-unrecognized-flags --packages=/Users/scheglov/Source/Dart/sdk.git/sdk/.dart_tool/package_config.json --format=json /Users/scheglov/Source/Dart/sdk.git/sdk/tests/co19/src/LanguageFeatures/Extension-types/static_analysis_extension_types_A05_t02.dart

static error failures:
- Unexpected error at line 22, column 18, length 1: COMPILE_TIME_ERROR.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND

--- Re-run this test:
python3 tools/test.py -m release -c dart2analyzer -a arm64 co19/LanguageFeatures/Extension-types/static_analysis_extension_types_A05_t02

@eernstg confirmed in chat that this is a valid diagnostic.

@sgrekhov sgrekhov self-assigned this Nov 20, 2023
@sgrekhov sgrekhov added the bad-test Report tests in need of updates. When closed, the tests should be considered good label Nov 20, 2023
@sgrekhov
Copy link
Contributor

Ok, the test is

// SharedOptions=--enable-experiment=inline-class

extension type V<T extends V<T>>(T id) {} // COMPILE_TIME_ERROR.TYPE_PARAMETER_SUPERTYPE_OF_ITS_BOUND

main() {
  List<V> l = [];
//     ^
// [analyzer] unspecified
// [cfe] unspecified
}

@eernstg please clarify why here T is a supertype of V<T>? If so, then the following should work but it doesn't

extension type V<T extends V<T>>(T id) {
  test(T t) {
    T t0 = V<T>(t); // COMPILE_TIME_ERROR.INVALID_ASSIGNMENT
  }
}

If T is a supertype of its bound (V<T>) then V<T> should be assignable to T but it doesn't

@sgrekhov sgrekhov added the needs-info Additional information needed from the issue author label Nov 20, 2023
@eernstg
Copy link
Member

eernstg commented Nov 20, 2023

extension type V<T extends V<T>>(T id) {} is an error because an extension type declaration must have type parameter declarations that are correct also after extension type erasure. In this case we get extension type V<T extends T>(T id) {}, and the type parameter declaration T extends T is an error.

However, it sounds like error message doesn't mention the extension type erasure, and it would probably be helpful if it did.

@sgrekhov sgrekhov removed the needs-info Additional information needed from the issue author label Nov 20, 2023
sgrekhov added a commit to sgrekhov/co19 that referenced this issue Nov 20, 2023
copybara-service bot pushed a commit to dart-lang/sdk that referenced this issue Nov 24, 2023
2023-11-23 [email protected] Merge pull request dart-lang/co19#2395 from dart-lang/merge-pre-nnbd
2023-11-23 [email protected] Fixes dart-lang/co19#2390. Fix tests according to the new method/setter rules (dart-lang/co19#2392)
2023-11-23 [email protected] Fixes dart-lang/co19#2388. Add tests for the new method/setter rules. Update assertions (dart-lang/co19#2393)
2023-11-23 [email protected] Merge remote-tracking branch 'origin/pre-nnbd' into master
2023-11-22 [email protected] Fixes dart-lang/co19#2389. Add additional error expectation for analyzer (dart-lang/co19#2391)
2023-11-21 [email protected] dart-lang/co19#2342. Update nullability tests according to the new rules (dart-lang/co19#2385)
2023-11-21 [email protected] Fixes dart-lang/co19#2384. Fix not well-bound extension types. Add function-type dynamic test (dart-lang/co19#2387)

Change-Id: Ic3848f6f39fd42b01bfed5feac3d922c6f5a53d5
Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/338120
Reviewed-by: Erik Ernst <[email protected]>
Reviewed-by: 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