Skip to content

Tuple.Filter doesn't work if the result tuple type is of length more than 1 #10896

Closed
@prolativ

Description

@prolativ

Minimized code

import Tuple.Filter

type IsString[x] = x match {
  case String => true
  case _ => false
}

val x = summon[Filter[(Char, Int), IsString] =:= EmptyTuple]
val y = summon[Filter[("abc", Int), IsString] =:= Tuple1["abc"]]
val z = summon[Filter[("abc", "def"), IsString] =:= Tuple2["abc", "def"]]

Output

val z = summon[Filter[("abc", "def"), IsString] =:= Tuple2["abc", "def"]]
                                                                         ^
Type argument IsString does not conform to upper bound [_$6] =>> Boolean in subpart scala.Tuple.Filter[scala.Tuple$package.EmptyTuple.type, IsString] of inferred type 
  (("abc" : String) *: ("def" : String) *: 
    scala.Tuple.Filter[scala.Tuple$package.EmptyTuple.type, IsString]
  )

Expectation

This should compile and an evidence for type equality should be correctly synthesized

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