-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix #8067: Don't constrain with types of wrong kinds #8130
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
+ refactoring: account for Bivariance + refactpring: collect variance related ops in Variances, move Variances to core.
This is meant as a better alternative to encode variances in parameter names.
Encode them instead in the upper bound lambda of a TypeBounds type. For now, we also encode them in the alias of a Typealias type, but this will be dropped one we pass to structural lambda variance.
The old encoding using semantic parameter name is still in place. The new recording inside TypeBounds exists alongside the old one.
Needs to be passed as a parameter since Namer does not construct a bounds immediately.
These can hopefully be revived once the variance changes have completed
... unless they are on the right hand side of type bounds or match aliases or they are type aliases where some variance is given explicitly with a `+` or `-`.
This reverts commit 7d6e75e.
Type lambdas don't print with variances anymore
Since variances are associated conceptually with higher-kinded type variables, it makes no sense to write them on type lambdas. I believe it's better to disallow writing variances there because it will only need to variance-bike-shedding otherwise.
A refinement type would previously qualify as an `isRef` of Any, AnyKind, or AnyRef. Often that is not what was intended. Break out `isAny`, `isAnyKind`, and `isAnyRef` methods for tests that don't go through refinements.
The example got into a pickle since it tried to constrain a type variable A[_] with a type (G[_] => G[String]). It should have rejected this outright. Instead the constraint addition succeeded and the compiler got into a dead-end with it afterwards.
make it work for al kinds of ParamInfos.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hello, and thank you for opening this PR! 🎉
All contributors have signed the CLA, thank you! ❤️
Commit Messages
We want to keep history, but for that to actually be useful we have
some rules on how to format our commit messages (relevant xkcd).
Please stick to these guidelines for commit messages:
- Separate subject from body with a blank line
- When fixing an issue, start your commit message with
Fix #<ISSUE-NBR>:
- Limit the subject line to 72 characters
- Capitalize the subject line
- Do not end the subject line with a period
- Use the imperative mood in the subject line ("Add" instead of "Added")
- Wrap the body at 80 characters
- Use the body to explain what and why vs. how
adapted from https://chris.beams.io/posts/git-commit
Have an awesome day! ☀️
- Need to take of AnyKind - need to also copmare results
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Last three commits LGTM, so this PR is good to go once #8082 gets in.
The example got into a pickle since it tried to constrain a type variable
A[_]
with a type(G[_] => G[String])
. It should have rejected this outright sinceA if of kind * -> * and the bound is of kind (* -> *) -> *.
Instead the constraint addition succeeded and the compiler got into a dead-end
with it afterwards.
Based on #8082. Only last two commits are new.