-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Avoid assertion failure when forcing LazyRef while printing #12653
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
Fixes scala#12650 The fix that matters for scala#12650 is the one in Checking. The others generally increase robustness of printing diagnostics when triggering a LazyRef recursion.
I can review this, let me know when the PR is ready for review. |
ready for review |
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.
The code LGTM.
However, the snippet from the linked issue was supposed to demonstrate an issue that @Linyxus discovered when working on GADTs. That issue involved a type from our test suite that looked like this:
trait FooBase {
type This <: FooBase { type This <: FooBase.this.This }
}
Shouldn't this type also be considered cyclic?
trait FooBase {
type This <: FooBase { type This <: FooBase.this.This }
} No, direct recursion in a type member is OK. It's the |
🤔 🙏 more simple example trait StandaloneWSRequest {
type Self <: StandaloneWSRequest {
type Self <: StandaloneWSRequest.this.Self
}
def foo: Self
def bar: Self
}
object Main {
def client: StandaloneWSRequest = null
def main(args: Array[String]): Unit = {
client.foo.bar.foo // error
}
} |
@xuwei-k can you open a separate issue for that, and include the stack trace? |
Fixes #12650
The fix that matters for #12650 is the one in Checking. The others generally increase
robustness of printing diagnostics when triggering a LazyRef recursion.