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 in indoorvivants/genovese #22070

Closed
WojciechMazur opened this issue Dec 2, 2024 · 3 comments · Fixed by #22241
Closed

Regression in indoorvivants/genovese #22070

WojciechMazur opened this issue Dec 2, 2024 · 3 comments · Fixed by #22241
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 OpenCB failure in indoorvivants/genovese - build logs

Related issues (same bisect result): #22068 #22062

Compiler version

Last good release: 3.6.4-RC1-bin-20241121-5d1d274-NIGHTLY
First bad release: 3.6.4-RC1-bin-20241122-64411b6-NIGHTLY
Bisect points to 26ecda5

Minimized code

case class Breaks(x: Boolean, y: Boolean) derives Featureful
object types:
  opaque type NormalisedFloat <: Float = Float
import types.*

enum Feature[T]:
  case Bool extends Feature[Boolean]
  def fromNormalisedFloat(value: NormalisedFloat): this.type#T = ???

trait Featureful[T]:
  def features: IArray[Feature[?]]
  def toFeatures(value: T): IArray[NormalisedFloat]

object Featureful:
  inline def derived[T](using scala.deriving.Mirror.Of[T]) = ${ derivedImpl[T] }

  import scala.quoted.*
  private def derivedImpl[T: Type](using Quotes): Expr[Featureful[T]] =
    import quotes.reflect.*
    '{
      new Featureful[T]:
        override val features: IArray[Feature[?]] = IArray.empty

        override def toFeatures(value: T): IArray[NormalisedFloat] =
          val feats = IArray.empty[Featureful[?]]
          val product = value.asInstanceOf[Product]
          product.productIterator.zipWithIndex.foreach: (any, idx) =>
            val error = feats(idx).toFeatures(any.asInstanceOf)
          IArray.empty
    }

Output

Compiling project (Scala 3.6.4-RC1-bin-20241201-6bf4483-NIGHTLY, JVM (17))
[error] ./test-usage.scala:1:51
[error] Found:    Featureful[?]#T
[error] Required: Nothing
[error] case class Breaks(x: Boolean, y: Boolean) derives Featureful
[error]       

Expectation

Should compile

@WojciechMazur WojciechMazur added itype:bug area:typer regression This worked in a previous version but doesn't anymore labels Dec 2, 2024
@WojciechMazur
Copy link
Contributor Author

There are 3 additional projects failing in OpenCB that bisect to the same commit, but are not yet minimized:

@jchyb
Copy link
Contributor

jchyb commented Dec 3, 2024

Another in durban/choam Open CB logs

Minimisation:

abstract class MutHamt[K <: Hamt.HasHash, V <: Hamt.HasKey[K], I <: Hamt[_, _, I]]

abstract class Hamt[K <: Hamt.HasHash, V <: Hamt.HasKey[K], H <: Hamt[K, V, H]]

object Hamt {
  trait HasKey[K <: HasHash]
  trait HasHash
}

Error:

-- [E057] Type Mismatch Error: repr.scala:1:79 ---------------------------------
1 |abstract class MutHamt[K <: Hamt.HasHash, V <: Hamt.HasKey[K], I <: Hamt[_, _, I]]
  |                                                                               ^
  |Type argument I does not conform to upper bound Hamt[? <: Hamt.HasHash, ? <: Hamt.HasKey[Hamt[?, ?, I]#K], I]
  |
  | longer explanation available when compiling with `-explain`

@SethTisue
Copy link
Member

fyi @kubukoz @keynmol

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