-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Is this a bug in opaque types? #23050
Unanswered
mwisnicki
asked this question in
General Question
-
trait Entity[T <: Entity[?]] { def id: Types.Id[T] = Types.defaultId } object Types { opaque type Id[T <: Entity[?]] = Long def defaultId[T <: Entity[?]]: Id[T] = 0L } List[Entity[?]]().groupBy(_.id).get("not an opaque long")
The above code compiles but maybe shouldn't?
The key of that map should be of opaque type Id but instead becomes Any.
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 1 comment 2 replies
-
What behavior do you get and what did you expect instead?
If you don't know whether it's a bug or not, then there are more chances that its is correct than buggy. Perhaps ask on https://users.scala-lang.org/ instead?
Beta Was this translation helpful? Give feedback.
All reactions
2 replies
-
I updated my question with expectation and actual behavior. Will try posting on the other site, thanks.
Beta Was this translation helpful? Give feedback.
All reactions
-
Beta Was this translation helpful? Give feedback.
All reactions
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment