-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Loop in member type bounds breaks intersection #23165
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
"Allowed" is nebulous. You're allowed to write code that stackoverflows, but that doesn't make it correct. Only one of these definitions succeeds:
Oh, I added your intersection member and look what happened.
It "worked" ("failed") immediately after.
I always use That was So I guess in computing, what doesn't crash is allowed. |
@som-snytt might want to raise the crash repro separately 😅 (couldn't reproduce it myself, but it's unclear to me, how exactly did you cause it) |
"Allowed" is only nebulous insofar as there is (AFAIK) no complete, up-to-date spec for Scala 3. (Though I'm not sure what the existing one says about this either.) Short of pointing to a spec, I've got a slew of reasons for
|
Compiler version
Running Scala 3.7.0.
Minimized code
Here's a slightly less minimized version where the traits are explicitly related and the loop is created by overriding. I would want this example to work too.
Output
(And similar for the other sample.)
Expectation
I'm under the impression there's nothing wrong with either code sample. The cyclic member type bounds are just more complicated F-bounds, and stuff like
trait Allowed { type T <: A[T] }
has always been legal.The text was updated successfully, but these errors were encountered: