Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Revert source breaking change in TupleOps #1167

Merged
merged 1 commit into from
May 15, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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])
}
}