zio / izumi-reflect

TypeTag without scala-reflect. Supports Scala 2 and Scala 3.
https://zio.dev/izumi-reflect
Other
141 stars 37 forks source link

False-positive subtype checking for Scala 3 opaque types #472

Open kyri-petrou opened 4 months ago

kyri-petrou commented 4 months ago

For some reason, when 2 Scala 3 opaque types have the same underlying type, the subtype check <:< seems to falsely return true. AFAICT, this seems to be what's causing https://github.com/zio/zio/issues/8882 (albeit there might be more to it, but first things first 😅)

Repro:

import izumi.reflect.Tag

type UserName = UserName.T
object UserName {
  opaque type T = String
}

type UserId = UserId.T
object UserId {
  opaque type T = String
}

val idTag   = Tag[UserId]
val nameTag = Tag[UserName]

@main def m = {
  assert(!(idTag =:= nameTag), "idTag =:= nameTag") // passes
  assert(!(idTag <:< nameTag), "idTag <:< nameTag") // fails
}
neko-kai commented 4 months ago

Addressed in https://github.com/zio/izumi-reflect/pull/468

jdegoes commented 2 weeks ago

/bounty $250

algora-pbc[bot] commented 2 weeks ago

💎 $250 bounty • ZIO

Steps to solve:

  1. Start working: Comment /attempt #472 with your implementation plan
  2. Submit work: Create a pull request including /claim #472 in the PR body to claim the bounty
  3. Receive payment: 100% of the bounty is received 2-5 days post-reward. Make sure you are eligible for payouts

Thank you for contributing to zio/izumi-reflect!

Add a bounty • Share on socials

Attempt Started (GMT+0) Solution
🟢 @neko-kai #468
algora-pbc[bot] commented 2 weeks ago

💡 @neko-kai submitted a pull request that claims the bounty. You can visit your bounty board to reward.

algora-pbc[bot] commented 2 weeks ago

🎉🎈 @neko-kai has been awarded $250! 🎈🎊

neko-kai commented 2 weeks ago

@jdegoes Maybe you made a mistake opening the bounty on this issue since the solution was already pending? I can refund the bounty back, although I don't mind either way.

jdegoes commented 2 weeks ago

@neko-kai Keep it, you earned it!

neko-kai commented 2 weeks ago

This still needs to be released