Skip to content

Fix generic type mismatch caused by missing type argument.#62368

Closed
SeifShaheen wants to merge 2 commits intodart-lang:mainfrom
SeifShaheen:main
Closed

Fix generic type mismatch caused by missing type argument.#62368
SeifShaheen wants to merge 2 commits intodart-lang:mainfrom
SeifShaheen:main

Conversation

@SeifShaheen
Copy link

@SeifShaheen SeifShaheen commented Jan 7, 2026

This pull request introduces enhancements to the type inference and subtyping logic for extension types and Fixes #62242 , adds new targeted test cases for extension type inference and subtyping. The most important changes are grouped below by theme.

Type Inference and Subtyping Improvements

  • Updated TypeConstraintGenerator in type_analyzer_operations.dart to handle subtype constraint generation for extension type declarations, ensuring correct erasure and comparison logic.
  • Modified TypeSchemaEnvironment in type_schema_environment.dart to add a fallback subtype check for extension type variables, allowing legacy/undetermined extension type parameters to be assignable to their non-nullable equivalents when the bound is valid.

Extension Type Test Coverage

  • Added a new test case issue_inference.dart to verify inference and behavior for classes and extensions using extension types as type parameters.
  • Added a new test case test_rep_subtyping.dart to check subtyping relationships between extension types and their representation types.

… the next contributions

Solved this issue and edited the type_analyzer_operations.dart and type_schema_environment.dart on the specified lines in the diff here and ran all testcases to make sure everything is the same + solving the issue.
@google-cla
Copy link

google-cla bot commented Jan 7, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@copybara-service
Copy link

Thank you for your contribution! This project uses Gerrit for code reviews. Your pull request has automatically been converted into a code review at:

https://dart-review.googlesource.com/c/sdk/+/471322

Please wait for a developer to review your code review at the above link; you can speed up the review if you sign into Gerrit and manually add a reviewer that has recently worked on the relevant code. See CONTRIBUTING.md to learn how to upload changes to Gerrit directly.

Additional commits pushed to this PR will update both the PR and the corresponding Gerrit CL. After the review is complete on the CL, your reviewer will merge the CL (automatically closing this PR).

@copybara-service
Copy link

https://dart-review.googlesource.com/c/sdk/+/471322 has been updated with the latest commits from this pull request.

@SeifShaheen SeifShaheen changed the title Fix generic type mismatch caused by missing type argument. Issue #62242 Fix generic type mismatch caused by missing type argument. Jan 7, 2026
@copybara-service
Copy link

https://dart-review.googlesource.com/c/sdk/+/471322 has been updated with the latest commits from this pull request.

@mraleph
Copy link
Member

mraleph commented Jan 14, 2026

@SeifShaheen Thank you for your contribution, unfortunately it is fixing things in the wrong way - an engineer on the front-end team will submit the proper fix instead. Type system and inference rules are rather complex so next time consider choosing a simpler target as your first contribution.

@mraleph mraleph closed this Jan 14, 2026
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.

Strange error when using extension types as generic types

2 participants