Closed
Description
import Tuple._
class Foo {
implicit def (`this`: This) #: [This <: Tuple, T](elem: T): T *: This = ???
val a: Tuple1[Int] = 1 #: ()
val b: Tuple2[Int, Int] = 2 #: a
}
fails with
-- [E007] Type Mismatch Error: Foo.scala:14:23 ---------------------------------
14 | val a: Tuple1[Int] = 1 #: ()
| ^
| Found: Int(1)
| Required: Tuple
-- [E007] Type Mismatch Error: Foo.scala:15:28 ---------------------------------
15 | val b: Tuple2[Int, Int] = 2 #: a
| ^
| Found: Int(2)
| Required: Tuple
result of Foo.scala after frontend:
package <empty> {
import Tuple._
class Foo() extends Object() {
implicit def #:[This >: Nothing <: Tuple, T >: Nothing <: Any](this: This):
*:[T, This]
= ???
val a: Tuple1[Int] = this.#:[Tuple, Unit](())(1)
val b: Tuple2[Int, Int] = this.#:[Nothing, Tuple1[Int]](this.a)(2)
}
}
Note that it should be
val a: Tuple1[Int] = this.#:[Unit, Int](())(1)
val b: Tuple2[Int, Int] = this.#:[Tuple1[Int], Int](this.a)(2)