-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
Check type variable bounds of self types #2351
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
#2381 should reject TC, but will accept T. I don't think I understand why should T be rejected. |
Another complication - if the function is overloaded, it is the union of the self-types that should be considered. |
@JukkaL do you consider the current behavior problematic/incomplete? |
I don't think that allowing |
I've written code like this using just |
Me too. I think the assumption about implicit bounds is "infer" rather than "object". |
Hmm inferring the bound might be reasonable thing, at least when there is no explicit conflicting bound. However, that's not how self types work right now, and it would be a little ad hoc. |
As follow-up to #2193, check that if self is declared with a type variable type, the type variable has a compatible bound. For example, some of these should be rejected:
(We may also want to check variance, but it's a separate issue and less clear.)
The text was updated successfully, but these errors were encountered: