Closed
Description
Regression found in Open CB #167 for giiita/refuel
It seems that during the transformation information about the exact tuple type is lost. In this case Tuple27 is trimmed to Tuple23
Compiler version
Works in 3.1.1
Fails since 3.1.2
Bisect points to: 584c05b
Minimized code
There are 2 failing cases, but they seem to be related. I'm providing both of them to allow for proper testing of the fix
Case 1
Input
trait JsonVal
val value = ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, "k", "l", "m", "n", "o", "p", "q")
val tree: JsonVal = ???
def Case1 = {
sealed trait Read[T]
object ReadOf:
final inline def tuple[T <: Tuple]: Read[T] = ???
given JsonTreeToEntry: scala.Conversion[JsonVal, JsonRowEntry] = ???
trait JsonRowEntry:
def readAs[E](using Read[E]): util.Try[E] = ???
extension [T, U](leftSideValue: T)
def shouldBe(rhs: U)(using CanEqual[T, U]) = ???
tree
.readAs(using ReadOf.tuple[String *: String *: String *: String *: String *: String *: String *: String *: String *: String *: Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *: String *: String *: String *: String *: String *: String *: String *: EmptyTuple])
.fold(_ => ???, _.shouldBe(value))
}
Output
[error] ./test.scala:22:36: Values of types (String, String, String, String, String, String, String, String, String, String
[error] ,
[error] Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, String, String, String) and (String, String, String, String, String, String, String, String, String, String
[error] ,
[error] Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, String, String, String, String
[error] ,
[error] String, String, String) cannot be compared with == or !=.
Tuple(10xString, 10xInt, 3xString)
cannot be compared with Tuple(10xString, 10xInt, 7xString)
Case 2
Input
trait JsonVal
val value = ("a", "b", "c", "d", "e", "f", "g", "h", "i", "j", 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, "k", "l", "m", "n", "o", "p", "q")
val tree: JsonVal = ???
def Case2 = {
sealed trait Write[T]
object WriteOf:
final inline def tuple[T <: Tuple]: Write[T] = ???
given EntryToJson[T]: scala.Conversion[T, JsonStructureEntry[T]] = ???
class JsonStructureEntry[T](t: T):
def writeAs[X >: T](using Write[X]): util.Try[JsonVal] = ???
value
.writeAs(using WriteOf.tuple[String *: String *: String *: String *: String *: String *: String *: String *: String *: String *: Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *: String *: String *: String *: String *: String *: String *: String *: EmptyTuple])
.fold(_ => ???, _ == tree)
}
Output
[error] ./test.scala:35:18: Found: Write[String *: String *: String *: String *: String *: String *: String *:
[error] String
[error] *: String *: String *: Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *:
[error] Int
[error] *: Int *: String *: String *: String *: String *: String *: String *: String *:
[error]
[error] EmptyTuple]
[error] Required: Write[(String, String, String, String, String, String, String, String, String,
[error] String
[error] , Int, Int, Int, Int, Int, Int, Int, Int, Int, Int, String, String, String)]
[error] .writeAs(using WriteOf.tuple[String *: String *: String *: String *: String *: String *: String *: String *: String *: String *: Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *: Int *: String *: String *: String *: String *: String *: String *: String *: EmptyTuple])
[error] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Found Write[Tuple(10xString, 10xInt, 3xString)]
, required Write[Tuple(10xString, 10xInt, 7xString)]
Expectation
Should compile