scala3 icon indicating copy to clipboard operation
scala3 copied to clipboard

Typer regression in `gnieh/fs2-data` when accessing existing symbols

Open WojciechMazur opened this issue 5 days ago • 0 comments

Based on the OpenCB failure in gnieh/fs2-data - build logs

Might affect most of the typelevel ecosystem. Problem exists when using com.disneystreaming::weaver-cats:0.8.4 , but it's absent when using org.typelevel::weaver-cats:0.11.2 (probably was fixed in 0.9.0)

Compiler version

Last good release: 3.8.0-RC1-bin-20251103-714f3b6-NIGHTLY First bad release: 3.8.0-RC1-bin-20251104-b83b3d9-NIGHTLY

Bisect points to one of: f3aea49b6f7754ffa79beab007fcdac4a37dc4c5 5b03dca156e523a20ca232d9c03dc8d53dd4588e Both are commits from #24231

Not present in 3.8.0-RCs, merged after 3.8.0 cutoff, but before change of build developed version

Minimized code

Requires split of sources into 2 stages, it can reproduced the most easily using

scala compile --test repro.scala repro.test.scala 

(test targets are a separate compilation unit)

// repro.scala 

trait Show[T]
object Show:
  given [A: Show]: Show[List[A]] = ???

trait Eq[A] extends Any, Serializable
object Eq:
  def fromUniversalEquals[A]: Eq[A] = ???

object expect:
  def same[A](expected: A, found: A)(using
      eqA: Eq[A] = Eq.fromUniversalEquals[A],
      showA: Show[A]
  ): Unit = ???

sealed trait XmlEvent
object XmlEvent:
  given Show[XmlEvent] = ???
// repro.test.scala

def test(input: Option[List[XmlEvent]]) = 
  val works = 
      expect.same(List.empty[XmlEvent], input.get)
  val fails = input.map: tokens =>
      expect.same(List.empty[XmlEvent], tokens)

Output

> scala compile --test test.scala test.test.scala -S 3.nightly
Compiling project (Scala 3.8.1-RC1-bin-20251207-68396ca-NIGHTLY, JVM (21))
Compiled project (Scala 3.8.1-RC1-bin-20251207-68396ca-NIGHTLY, JVM (21))
Compiling project (test, Scala 3.8.1-RC1-bin-20251207-68396ca-NIGHTLY, JVM (21))
[error] ./test.test.scala:5:48
[error] Found:    Show[List[A]]
[error] Required: Show[List[XmlEvent]]
[error]       expect.same(List.empty[XmlEvent], tokens)
[error]                                                ^
Error compiling project (test, Scala 3.8.1-RC1-bin-20251207-68396ca-NIGHTLY, JVM (21))
Compilation failed

Expectation

Should compile

WojciechMazur avatar Dec 07 '25 15:12 WojciechMazur