-
-
Notifications
You must be signed in to change notification settings - Fork 206
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
Ambient opaque type
breaks MkFocus
#1306
Comments
opaque type
breaks GenLens
opaque type
breaks MkFocus
Workaround. //> using scala "3.2.0"
//> using lib "dev.optics::monocle-macro::3.1.0"
trait Qux
object Foo {
opaque type Bar = Qux
case class Baz(id: String)
object Baz {
implicit val bazId: monocle.Lens[Foo.Baz, String] = {
type Bla = Foo.Baz // <-- workaround
new monocle.Focus.MkFocus[Bla].apply(_.id)
}
}
} |
Users aren't expected to use
It is really weird that a useless opaque type break the macro. Was it also the case in previous version of Scala 3? Thanks for reporting the issue. |
Right, sorry :) if you check the edit history the initial report was in terms of
I think so, but I will doube-check. Edit: I can reproduce with Scala 3.1.0. FWIW this is likely a compiler bug. |
I think this is possibly intended behaviour by the compiler but weird as heck. Here's the error message which we get in
It looks as though we capture the opaque type within the The real fix is to add variance properly if it works imo, but I think we ran into issues with that previously with inference problems in scala 2. @julien-truffaut will remember better than me. We could probably strip the captured opaque type for now. |
The text was updated successfully, but these errors were encountered: