Skip to content

Regression in gekomad/itto-csv #16654

Closed
@WojciechMazur

Description

@WojciechMazur

https://scala3.westeurope.cloudapp.azure.com/job/buildCommunityProject/38542/

Scala version: 3.2.2-RC2

Bisect points to 46e3d77

Reproducer:

def toCsvFlat[A <: Product](a: A)(using m: scala.deriving.Mirror.ProductOf[A]) = {
  def flatTuple(any: Any): Tuple = any match
    case p: Product => p.productIterator.map(flatTuple).foldLeft(EmptyTuple: Tuple)(_ ++ _)
    case a          => Tuple1(a)
    
  val tuple = flatTuple(Tuple.fromProductTyped(a)).toList
}

Output:

-- [E007] Type Mismatch Error: /workspace/bisect/test.scala:6:51 ---------------
6 |  val tuple = flatTuple(Tuple.fromProductTyped(a)).toList
  |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  |Found:    List[Tuple.Union[(?1 : Tuple)]]
  |Required: List[
  |  Tuple match {
  |    case EmptyTuple => Nothing
  |    case h *: t => h | scala.Tuple.Fold[t, Nothing, [x, y] =>> x | y]
  |  }
  |]
  |
  |where:    ?1 is an unknown value of type Tuple
  |
  |
  |Note: a match type could not be fully reduced:
  |
  |  trying to reduce  Tuple.Union[(?1 : Tuple)]
  |  trying to reduce  scala.Tuple.Fold[(?1 : Tuple), Nothing, [x, y] =>> x | y]
  |  failed since selector  (?1 : Tuple)
  |  does not match  case EmptyTuple => Nothing
  |  and cannot be shown to be disjoint from it either.
  |  Therefore, reduction cannot advance to the remaining case
  |
  |    case h *: t => h | scala.Tuple.Fold[t, Nothing, [x, y] =>> x | y]
  |

Metadata

Metadata

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions