-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Regression in getkyo/kyo
for match types / type inference
#22661
Comments
fyi @fwbrasil |
cc @dwijnand |
I'm not sure this is a bug. The same code before #19761 wouldn't have compiled (that I could find) and there's nothing wrong about the avoidance. The reason it widens all the way to
|
The |
Here's original implementation: https://github.com/getkyo/kyo/blob/c060b4164b24868beaa05b6d01078c6b8b1d3f88/kyo-data/shared/src/main/scala/kyo/internal/TypeIntersection.scala#L68-L85 That's also what I initially thought, but the results were the same either if rhs was only ??? or calling an Inliner[R] returning |
I have minimized it to //> using scala 3.6.4-RC1-bin-20241209-1775d0b-NIGHTLY
case class Field[Name](name: Name)
opaque type AsField[Name] = Field[Name] // is compiling without opaque
def toField[Name](as: AsField[Name]): Unit = ()
type HasAsField[f] /*<: AsField[?]*/ = // is compiling with bound
f match
case Field[name] => AsField[name]
def x: List[HasAsField[Any]] = ???
x.map(toField)
/* compiler error:
Found: (as : tagadt$_.this.HasAsField[Any])
[error] Required: tagadt$_.this.AsField[Name]
*/
def y: HasAsField[Any] = ???
toField(y) // is not compiling even with upper bound Upper type bound also fixes the original issue in this particular case. |
Yeah |
I wonder if we should make |
I'm pretty sure that's what it does. But here it's hidden behind an |
My point is, given an opaque type alias, applied to wildcard args, where all args end up as args of a class type constructor, is that one of those dangerous akin-to-an-existential that we're trying to protect against? Because if it's not, then perhaps we can allow things like AsField. |
I think it is. You can't find a non-existential form for this which does not reveal the opaque type alias, which is also not allowed. |
Based on OpenCB failure in
getkyo/kyo
Compiler version
Last good release: 3.6.4-RC1-bin-20241205-c61897d-NIGHTLY
First bad release: 3.6.4-RC1-bin-20241209-1775d0b-NIGHTLY
Affects 3.6.4-RC1
Bisect points to 2f6e60d
Minimized code
Output
Expectation
Should probably compile
The text was updated successfully, but these errors were encountered: