-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Summoning a mirror for a Tuple produces a class-cast-exception during runtime #12052
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
Comments
Makes sense. Whatever the case, I checked this against the latest Dotty build and it is happening. |
Also, making my methods transparent doesn't fix the problem. |
@odersky @bishabosha I see that the original issue #11542 was created Feb 26th. What are the chances that this will be fixed by the 3.0.0 release? This issue is making it impossible for me to return Tuples from any Quill queries. (Sorry if I sound demanding, I'm just really worried) E.g. the following is impossible due to this issue: inline def q =
quote {
for {
p <- query[Person]
a <- query[Address] if (p.id == a.fk)
} yield {
(p.name, a.street) // Summons a mirror for this tuple which blows up with ClassCast Exception
}
} |
Mirror support runs in PostTyper to add new members to mirrors generated during Typer. But some anonymous mirrors are generated during inlining. We need to add the missing methods for them as well. Fixes scala#11542 Fixes scala#11961 Fixes scala#12052
Mirror support runs in PostTyper to add new members to mirrors generated during Typer. But some anonymous mirrors are generated during inlining. We need to add the missing methods for them as well. Fixes scala#11542 Fixes scala#11961 Fixes scala#12052
This is great. Thank you! |
You are welcome! Glad that we could fix it for 3.0. |
Mirror support runs in PostTyper to add new members to mirrors generated during Typer. But some anonymous mirrors are generated during inlining. We need to add the missing methods for them as well. Fixes scala#11542 Fixes scala#11961 Fixes scala#12052
Uh oh!
There was an error while loading. Please reload this page.
Compiler version
Latest nightly (i.e.
dottyLatestNightlyBuild.get
)Minimized code
Create a simple mirror type object which summons a product mirror, add an extension method for it to be able to be applied to any type:
Then import the context and run it:
Output
A class cast exception will occur
This is probably because I can see that the following code is being spliced:
Expectation
Code should compile and run correctly.
Repository
Code is available here:
https://github.com/deusaquilus/class_cast_issue
The text was updated successfully, but these errors were encountered: