Skip to content
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 for type inference of cyclic non-inlined methods #21568

Open
WojciechMazur opened this issue Sep 9, 2024 · 1 comment · May be fixed by #21597
Open

Regression for type inference of cyclic non-inlined methods #21568

WojciechMazur opened this issue Sep 9, 2024 · 1 comment · May be fixed by #21597
Assignees
Labels
area:typer itype:bug regression This worked in a previous version but doesn't anymore

Comments

@WojciechMazur
Copy link
Contributor

Compiler version

Last good release: 3.6.0-RC1-bin-20240821-a2c53a1-NIGHTLY
First bad release: 3.6.0-RC1-bin-20240822-d490d13-NIGHTLY
Bisect points to b34df4d

Minimized code

class Lang(name: String)
object Lang {
  val Default = Lang("")
  def apply(language: String): Lang = Lang(language)
  def apply(maybeLang: Option[String], default: Lang = Default): Lang = maybeLang.map(apply).getOrElse(default)
}

Output

[error] ./test.scala:5:56
[error] Recursive value Default needs type
[error] 
[error] The error occurred while trying to compute the signature of value Default
[error]   which required to type the right hand side of value Default since no explicit type was given
[error]   which required to compute the signature of method apply$default$2
[error]   which required to type the right hand side of method apply$default$2 since no explicit type was given
[error]   which required to compute the signature of value Default
[error] 
[error]  Run with both -explain-cyclic and -Ydebug-cyclic to see full stack trace.
[error]   def apply(maybeLang: Option[String], default: Lang = Default): Lang = maybeLang.map(apply).getOrElse(default)
[error]                                                        ^
Error compiling project (Scala 3.6.0-RC1-bin-20240907-614170f-NIGHTLY, JVM (17))

Expectation

Non inlined methods should not require explicit rhs type.

@WojciechMazur WojciechMazur added itype:bug area:typer regression This worked in a previous version but doesn't anymore stat:needs triage Every issue needs to have an "area" and "itype" label labels Sep 9, 2024
@Gedochao
Copy link
Contributor

cc @dwijnand

@Gedochao Gedochao removed the stat:needs triage Every issue needs to have an "area" and "itype" label label Sep 10, 2024
@dwijnand dwijnand self-assigned this Sep 10, 2024
@dwijnand dwijnand linked a pull request Sep 16, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:typer itype:bug regression This worked in a previous version but doesn't anymore
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants