Skip to content

Commit

Permalink
Merge pull request #1167 from joroKr21/tuple-ops
Browse files Browse the repository at this point in the history
Revert source breaking change in TupleOps
  • Loading branch information
joroKr21 authored May 15, 2021
2 parents dd765c5 + 893a00c commit 5c59097
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 13 deletions.
8 changes: 3 additions & 5 deletions core/src/main/scala/shapeless/syntax/std/tuples.scala
Original file line number Diff line number Diff line change
Expand Up @@ -21,18 +21,16 @@ package std
import shapeless.ops.hlist.ProductToHList

trait LowPriorityTuple {
@deprecated("Ambiguous with productOps", "2.3.5")
def productTupleOps[P <: Product](p: P): TupleOps[P] = new TupleOps(p)
implicit def productTupleOps[P <: Product](p: P): TupleOps[P] = new TupleOps(p)
}

object tuple extends LowPriorityTuple {
@deprecated("Redundant with tupleOps", "2.3.5")
def unitTupleOps(u: Unit): TupleOps[Unit] = new TupleOps(u)
implicit def unitTupleOps(u: Unit): TupleOps[Unit] = new TupleOps(u)

// Duplicated here from shapeless.HList so that explicit imports of tuple._ don't
// clobber the conversion to HListOps.
implicit def hlistOps[L <: HList](l : L) : HListOps[L] = new HListOps(l)
implicit def tupleOps[P: IsTuple](p: P): TupleOps[P] = new TupleOps(p)
private[shapeless] def tupleOps[P: IsTuple](p: P): TupleOps[P] = new TupleOps(p)
}

final class TupleOps[T](t: T) extends Serializable {
Expand Down
9 changes: 1 addition & 8 deletions core/src/test/scala/shapeless/tuples.scala
Original file line number Diff line number Diff line change
Expand Up @@ -1463,7 +1463,7 @@ class TupleTests {

@Test
def testPropagation: Unit = {
def useHead[P: IsTuple: IsComposite](p: P) = p.head
def useHead[P <: Product: IsComposite](p: P) = p.head
val h = useHead((23, "foo", true))
typed[Int](h)
}
Expand Down Expand Up @@ -1973,11 +1973,4 @@ class TupleTests {
(23, "foo").align[(String, String)]
""")
}

@Test
def testCompatibilityWithProductSyntax: Unit = {
import syntax.std.product._
assertEquals(List(2, "a"), Foo(2, "a").to[List])
assertEquals(List(2, "a"), (2, "a").to[List])
}
}

0 comments on commit 5c59097

Please sign in to comment.