You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
deff[T<:Tuple2[Int, Int]](tup: T):T= tup
deftest:Unit=
(1, 2)._1
f((1, 2))._1
(1*:2*:EmptyTuple)._1 // error: `*:` does not have a member `_1` based on our current encoding it is considered ok
f(1*:2*:EmptyTuple)._1 // error: should not fail as `f` returns a subtype of `Tuple2` and should have the member `_1`
f[Int*:Int*:EmptyTuple](1*:2*:EmptyTuple)._1 // error
f[Int*:Int*:EmptyTuple]((1, 2))._1 // error
f[Tuple2[Int, Int]](1*:2*:EmptyTuple)._1
Output
-- [E008] NotFoundError:Foo.scala:7:25--------------------------------------7| (1*:2*:EmptyTuple)._1 // error: `*:` does not have a member `_1` based on our current encoding it is considered ok|^^^^^^^^^^^^^^^^^^^^^^^^^| value _1 is not a member of (Int, Int)
-- [E008] NotFoundError:Foo.scala:8:26--------------------------------------8| f(1*:2*:EmptyTuple)._1 // error: should not fail as `f` returns a subtype of `Tuple2` and should have the member `_1`|^^^^^^^^^^^^^^^^^^^^^^^^^^| value _1 is not a member of (Int, Int)
-- [E008] NotFoundError:Foo.scala:9:52--------------------------------------9| f[Int*:Int*:EmptyTuple](1*:2*:EmptyTuple)._1 // error|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^| value _1 is not a member of Int*:Int*:EmptyTuple-- [E008] NotFoundError:Foo.scala:11:38-------------------------------------11| f[Int*:Int*:EmptyTuple]((1, 2))._1 // error|^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^| value _1 is
Expectation
Ideally, they should all work.
The text was updated successfully, but these errors were encountered:
The main issue is that Tuple2[Int, Int] <:< Int *: Int *: EmptyTuple because we extend Tuple2 explicitly and from another side we also assume that Int *: Int *: EmptyTuple <:< Tuple2[Int, Int]; therefore Tuple2[Int, Int] =:= Int *: Int *: EmptyTuple. But Int *: Int *: EmptyTuple does not have access to the members of Tuple2[Int, Int]. This creates inconsistency depending on how/when we check for the members.
Compiler version
3.1.0
Minimized code
Output
Expectation
Ideally, they should all work.
The text was updated successfully, but these errors were encountered: