Skip to content

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

Merged
merged 1 commit into from
Jun 5, 2021

Conversation

odersky
Copy link
Contributor

@odersky odersky commented May 31, 2021

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.

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.
@abgruszecki
Copy link
Contributor

abgruszecki commented Jun 1, 2021

I can review this, let me know when the PR is ready for review.

@odersky
Copy link
Contributor Author

odersky commented Jun 3, 2021

ready for review

Copy link
Contributor

@abgruszecki abgruszecki left a 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?

@abgruszecki abgruszecki assigned odersky and unassigned abgruszecki Jun 3, 2021
@odersky
Copy link
Contributor Author

odersky commented Jun 5, 2021

trait FooBase {
  type This <: FooBase { type This <: FooBase.this.This }
}

No, direct recursion in a type member is OK. It's the & that causes problems here.

@odersky odersky merged commit 06df92b into scala:master Jun 5, 2021
@odersky odersky deleted the fix-12650 branch June 5, 2021 11:49
@xuwei-k
Copy link
Contributor

xuwei-k commented Jun 5, 2021

No, direct recursion in a type member is OK. It's the & that causes problems here.

#4560 (comment)

🤔 🙏

https://github.com/playframework/play-ws/blob/735b38213011d4905426709205335a515a0333d7/play-ws-standalone/src/main/scala/play/api/libs/ws/StandaloneWSRequest.scala#L23-L24

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
  }
}

@abgruszecki
Copy link
Contributor

@xuwei-k can you open a separate issue for that, and include the stack trace?

@xuwei-k
Copy link
Contributor

xuwei-k commented Jun 7, 2021

@xuwei-k can you open a separate issue for that, and include the stack trace?

done #12731

@Kordyjan Kordyjan added this to the 3.0.2 milestone Aug 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Compiler crash when merging type member bounds involving self references
4 participants