Skip to content

Regression in 3.3.3 and 3.4.0 #20080

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
lbialy opened this issue Apr 3, 2024 · 6 comments · Fixed by #20092
Closed

Regression in 3.3.3 and 3.4.0 #20080

lbialy opened this issue Apr 3, 2024 · 6 comments · Fixed by #20092
Assignees
Labels
area:typer itype:bug regression This worked in a previous version but doesn't anymore
Milestone

Comments

@lbialy
Copy link

lbialy commented Apr 3, 2024

Compiler version

3.3.3 and 3.4.0

Minimized code

trait Zippable[-A, -B]:
  type Out
  def zip(left: A, right: B): Out

object Zippable extends ZippableLowPrio:
  given append[A <: Tuple, B]: (Zippable[A, B] { type Out = Tuple.Append[A, B] }) =
    (left, right) => left :* right

trait ZippableLowPrio:
  given pair[A, B]: (Zippable[A, B] { type Out = (A, B) }) =
    (left, right) => (left, right)

@main def main =
  println("ok")

Output

λ scala-cli -S 3.3.1 main.scala
Compiling project (Scala 3.3.1, JVM (17))
Compiled project (Scala 3.3.1, JVM (17))
ok
λ scala-cli -S 3.3.3 main.scala
Compiling project (Scala 3.3.3, JVM (17))
[error] ./main.scala:7:22
[error] value :* is not a member of A
[error]     (left, right) => left :* right
[error]                      ^^^^^^^
[error] ./main.scala:11:22
[error] Found:    (A, B)
[error] Required: Zippable.this.Out
[error]     (left, right) => (left, right)
[error]                      ^^^^^^^^^^^^^
Error compiling project (Scala 3.3.3, JVM (17))
Compilation failed
λ scala-cli -S 3.4.0 main.scala
Compiling project (Scala 3.4.0, JVM (17))
[error] ./main.scala:7:22
[error] value :* is not a member of A
[error]     (left, right) => left :* right
[error]                      ^^^^^^^
Error compiling project (Scala 3.4.0, JVM (17))
Compilation failed

Expectation

No regressions 🙏

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

Gedochao commented Apr 3, 2024

full output (the initial post has adjustments made by Bloop)

-- [E008] Not Found Error: /Users/pchabelski/IdeaProjects/scala-cli-tests/compiler-repro/repro.scala:7:26 
7 |    (left, right) => left :* right
  |                     ^^^^^^^
  |                     value :* is not a member of A

@Gedochao Gedochao added area:typer and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels Apr 3, 2024
@odersky
Copy link
Contributor

odersky commented Apr 3, 2024

Should this not be *:?

@lbialy
Copy link
Author

lbialy commented Apr 4, 2024

A <: Tuple and A is in left position. After changing to *: it stops compiling on any version.

@prolativ
Copy link
Contributor

prolativ commented Apr 4, 2024

The bisect script seems to point to 18f90d9 (back-ported to LTS in 66f8992)

@odersky
Copy link
Contributor

odersky commented Apr 4, 2024

@lbialy Ah sorry, I thought this was left-cons. I was not aware there was also the symmetric operation :*.

@EugeneFlesselle
Copy link
Contributor

Minimisation:

trait Fun1:
  type Out
  def apply(x: Any): Out

type M[X] = X match
  case String => X

def works[A]: Fun1 { type Out = M[A] } =
  new Fun1:
    type Out = M[A]
    def apply(x: Any): Out = ???

def fails[A]: Fun1 { type Out = M[A] } =
  (x: Any) => ???

EugeneFlesselle added a commit to dotty-staging/dotty that referenced this issue Apr 4, 2024
@Kordyjan Kordyjan added this to the 3.5.0 milestone May 10, 2024
WojciechMazur pushed a commit to WojciechMazur/dotty that referenced this issue Sep 6, 2024
WojciechMazur pushed a commit to WojciechMazur/dotty that referenced this issue Sep 6, 2024
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.

6 participants