Skip to content

Warn on use of inferred quote type variable bounds #18195

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

Conversation

nicolasstucki
Copy link
Contributor

This kind of inference is not reliable. We can only consider the bounds from type constructor where the type variable is defined but any other constraints are ignored. Therefore it is not possible to properly infer the type bounds of the type variable.

The solution is simple, write the bounds explicitly and just check that those bounds conform to the use site of the type variable. Unfortunately, this does not work yet with type quote pattern as we do not have SIP-53 yet. But in that case, we can also provide better warnings that mention the future support for the patterns they are trying to write.

@nicolasstucki nicolasstucki force-pushed the warn-on-use-of-inferred-quote-type-variable-bounds branch from d2320ea to 4861162 Compare July 12, 2023 14:52
@nicolasstucki nicolasstucki self-assigned this Jul 13, 2023
@nicolasstucki nicolasstucki force-pushed the warn-on-use-of-inferred-quote-type-variable-bounds branch from 4861162 to 42dee9f Compare July 13, 2023 09:43
@nicolasstucki
Copy link
Contributor Author

Will need to rebase on #18199

@nicolasstucki nicolasstucki force-pushed the warn-on-use-of-inferred-quote-type-variable-bounds branch from 42dee9f to 7fbd30b Compare July 20, 2023 14:06
This kind of inference is not reliable. We can only consider the bounds
from type constructor where the type variable is defined but any other
constraints are ignored. Therefore it is not possible to properly infer
the type bounds of the type variable.

The solution is simple, write the bounds explicitly and just check that
those bounds conform to the use site of the type variable.
@nicolasstucki nicolasstucki force-pushed the warn-on-use-of-inferred-quote-type-variable-bounds branch from 7fbd30b to e47f798 Compare July 20, 2023 14:31
@nicolasstucki nicolasstucki added the needs-minor-release This PR cannot be merged until the next minor release label Jul 20, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-minor-release This PR cannot be merged until the next minor release stat:revisit
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant