Skip to content

Wrong ClassTag when tuple is defined using *: #23195

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

Open
eejbyfeldt opened this issue May 20, 2025 · 0 comments
Open

Wrong ClassTag when tuple is defined using *: #23195

eejbyfeldt opened this issue May 20, 2025 · 0 comments

Comments

@eejbyfeldt
Copy link

Compiler version

Tested on: 3.7.1-RC1, 3.7.0, 3.3.5

Minimized code

import scala.reflect.ClassTag

object WrongClassTag {
  def main(args: Array[String]): Unit = {
    val tag1 = summon[ClassTag[(Int, Int)]]
    val tag2 = summon[ClassTag[Int *: Int *: EmptyTuple]]
    assert(tag1 == tag2, s"tag1: $tag1, tag2: $tag2 did not match")
  }    
}

Output

Exception in thread "main" java.lang.AssertionError: assertion failed: tag1: scala.Tuple2, tag2: scala.Product did not match
	at scala.runtime.Scala3RunTime$.assertFailed(Scala3RunTime.scala:8)
	at WrongClassTag$.main(wrong_classtag.scala:7)
	at WrongClassTag.main(wrong_classtag.scala)

Expectation

The code should run without asserting. Which would happen if summon[ClassTag[Int *: Int *: EmptyTuple]] summoned the ClassTag for Tuple2.

@eejbyfeldt eejbyfeldt added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels May 20, 2025
@Gedochao Gedochao added area:typeclass-derivation and removed stat:needs triage Every issue needs to have an "area" and "itype" label labels May 21, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants