Skip to content

Regression in typer or constructor alternatives #15802

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

Closed
WojciechMazur opened this issue Aug 2, 2022 · 4 comments · Fixed by #15856
Closed

Regression in typer or constructor alternatives #15802

WojciechMazur opened this issue Aug 2, 2022 · 4 comments · Fixed by #15856
Assignees
Labels
area:typer itype:bug regression This worked in a previous version but doesn't anymore
Milestone

Comments

@WojciechMazur
Copy link
Contributor

Based on the issue found in softwaremill/tapir based on Open CB #7872

Compiler version

Works in 3.2.0-RC2
Fails in 3.2.0-RC3

Minimized code

//> using scala "3.2.0-RC3"

sealed trait ZIO[-R, +E, +A]
object ZIO{
  def fail[E](error: E): ZIO[Any, E, Nothing] = ???
}

trait Endpoint[INPUT, ERROR_OUTPUT, OUTPUT]{
  sealed trait ZServerEndpoint[R]
  def zServerLogic[R](logic: INPUT => ZIO[R, ERROR_OUTPUT, OUTPUT]): ZServerEndpoint[R] = ???
}

@main def Test() = 
  val x: Endpoint[_, Unit, Unit] = ???
  x.zServerLogic[Any](_ => ZIO.fail(new RuntimeException("boom")))

Output

[error] ./test.scala:15:41: None of the overloaded alternatives of constructor RuntimeException in class RuntimeException with types
[error]  (x$0: Throwable): RuntimeException
[error]  (x$0: String, x$1: Throwable): RuntimeException
[error]  (x$0: String): RuntimeException
[error]  (): RuntimeException
[error] match arguments (("boom" : String)) and expected result type E
[error]   x.zServerLogic[Any](_ => ZIO.fail(new RuntimeException("boom")))
[error]                                         ^^^^^^^^^^^^^^^^
Error compiling project (Scala 3.2.0-RC3, JVM)

Expectation

Should compile

@WojciechMazur WojciechMazur added itype:bug area:typer regression This worked in a previous version but doesn't anymore labels Aug 2, 2022
@WojciechMazur WojciechMazur changed the title Regression in typer or selection of constructor alternatives Regression in typer or constructor alternatives Aug 2, 2022
@Kordyjan Kordyjan added this to the 3.2.0 backports milestone Aug 2, 2022
@KacperFKorban
Copy link
Member

The commit that introduced this is: b009f42

@Kordyjan
Copy link
Contributor

@odersky Do you have time to take a look?

@odersky
Copy link
Contributor

odersky commented Aug 11, 2022

Is it urgent? I am just coming back from vacation and there's a long backlog.

@Kordyjan
Copy link
Contributor

Kordyjan commented Aug 11, 2022

It can be considered a blocker for 3.2.0, as it makes it impossible to build tapir with 3.2.

odersky added a commit to dotty-staging/dotty that referenced this issue Aug 14, 2022
Kordyjan pushed a commit to dotty-staging/dotty that referenced this issue Aug 16, 2022
bishabosha pushed a commit to dotty-staging/dotty that referenced this issue Oct 18, 2022
@Kordyjan Kordyjan modified the milestones: 3.2.0 backports, 3.2.1 Aug 1, 2023
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.

4 participants