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

Enable support for derives in Scala 3 for Read, Write and Text #1594

Merged
merged 1 commit into from
Dec 10, 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
2 changes: 1 addition & 1 deletion modules/core/src/main/scala-3/util/ReadPlatform.scala
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ trait ReadPlatform:
)

// Generic Read for products.
given [P <: Product, A](
given derived [P <: Product, A](
using m: Mirror.ProductOf[P],
i: A =:= m.MirroredElemTypes,
w: Read[A]
Expand Down
2 changes: 1 addition & 1 deletion modules/core/src/main/scala-3/util/WritePlatform.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ trait WritePlatform:
)

// Generic write for products.
given [P <: Product, A](
given derived[P <: Product, A](
using m: Mirror.ProductOf[P],
i: m.MirroredElemTypes =:= A,
w: Write[A]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ trait ReadSuitePlatform { self: munit.FunSuite =>
util.Read[Option[(Int, Woozle *: Woozle *: String *: EmptyTuple)]]
}

test("derives") {
case class Foo(a: String, b: Int) derives util.Read
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,7 @@ trait WriteSuitePlatform { self: munit.FunSuite =>
util.Write[Option[(Int, Woozle *: Woozle *: String *: EmptyTuple)]]
}

test("derives") {
case class Foo(a: String, b: Int) derives util.Write
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ trait TextPlatform { this: Text.type =>
(h product t).contramap(l => (l.head, l.tail))

// Put is available for single-element products.
given [P <: Product, A](
given derived[P <: Product, A](
using m: Mirror.ProductOf[P],
i: m.MirroredElemTypes =:= A,
t: Text[A]
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Copyright (c) 2013-2020 Rob Norris and Contributors
// This software is licensed under the MIT License (MIT).
// For more information see LICENSE or https://opensource.org/licenses/MIT

package doobie.postgres

trait TextSuitePlatform { self: munit.FunSuite =>

}
11 changes: 11 additions & 0 deletions modules/postgres/src/test/scala-3/postgres/TextSuitePlatform.scala
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
// Copyright (c) 2013-2020 Rob Norris and Contributors
// This software is licensed under the MIT License (MIT).
// For more information see LICENSE or https://opensource.org/licenses/MIT

package doobie.postgres

trait TextSuitePlatform { self: munit.FunSuite =>
test("derives") {
case class Foo(a: String, b: Int) derives Text
}
}