Skip to content

Wrong ClassTag when tuple is defined using *: #23195

Open
@eejbyfeldt

Description

@eejbyfeldt

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.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions