Skip to content

Commit 2a5ea0a

Browse files
committed
Adap implicit resolution change in 3.5
There is a conflict between opaqueHandler and userIdOfWriter for UserId Both are sastify for BSONWriter[UserId]. In this case of conflicting, before 3.5 the compiler will pick the more specific type (in this case opaqueHandler: BSONHandler[UserId] because it's more specific than BSONWriter[UserId]). In 3.6 they will flip the priority, a.k.a pic the most general. So, this specific case doesn't really affect us. But removing implicit ambiguity is good anyway I guess. More detail on the implicit resolution change here: scala/scala3#19300
1 parent e9a1beb commit 2a5ea0a

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

modules/db/src/main/Handlers.scala

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,9 @@ trait Handlers:
3333
given userIdOfWriter[U: UserIdOf, T](using writer: BSONWriter[UserId]): BSONWriter[U] with
3434
inline def writeTry(u: U) = writer.writeTry(u.id)
3535

36+
given NoDbHandler[UserId] with {}
37+
given userIdHandler: BSONHandler[UserId] = stringIsoHandler
38+
3639
given dateTimeHandler: BSONHandler[LocalDateTime] = quickHandler[LocalDateTime](
3740
{ case v: BSONDateTime => millisToDateTime(v.value) },
3841
v => BSONDateTime(v.toMillis)

0 commit comments

Comments
 (0)