-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Expr.summon does not work with imported givens from a class instance #11557
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
If I'm not totally mistaken and this is a real issue, RC1 is totally unusable for me 😢 |
Okay, so this doesn't work with object either. Say that I do this: object Ctx {
given intEncoder: MyEncoder[Int] = new MyEncoder[Int] { def encode(t: Int) = s"${t}" }
} Then I do this: def doEncoding: Unit = {
import Ctx.{given,*}
println(MyMacro.getAndEncode(123))
} It does not work either: [error] 20 | println(MyMacro.getAndEncode(123))
[error] | ^^^^^^^^^^^^^^^^^^^^^^^^^
[error] | Can't find encoder |
@nicolasstucki @liufengyun @odersky For the 3.0.0 release, can we have some kind of Scala 3 stage-gate making sure Dotty-Quill builds before the release is cut? Dotty-Quill seems to be the only thing constantly blowing up on the metaprogramming bugs in new releases. So it really needs to be double-checked. |
I think usually a release is an actual release candidate that has no issues
reported for a few weeks
…On Sun, Feb 28, 2021, 1:24 PM Alexander Ioffe ***@***.***> wrote:
@nicolasstucki <https://github.com/nicolasstucki> @liufengyun
<https://github.com/liufengyun> @odersky <https://github.com/odersky>
This really, really scares me!
I was building just fine on the Feb 02 build (20210202-8d43a9c-NIGHTLY),
then comes the RC1 release and Boom! This bug happens and everything I'm
doing is completely broken.
I keep thinking, what if something like this happens in the 3.0.0 release!?
For the 3.0.0 release, can we have some kind of Scala 3 stage-gate making
sure Dotty-Quill builds before the release is cut? Dotty-Quill seems to be
the only thing constantly blowing up on the metaprogramming bugs in new
releases. So it really needs to be double-checked.
Or maybe we bring Dotty-Quill into the Community Build ASAP and do it that
way?
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#11557 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAAYAUCIQMGZUC3YKCDBIG3TBKC5PANCNFSM4YK7AQPA>
.
|
Minimized type MyEncoder
class MyContext:
given intEncoder: MyEncoder = ???
def doEncoding(ctx: MyContext): Unit =
import ctx.{*, given}
summon[MyEncoder]
summonInlineMyEncoder()
inline def summonInlineMyEncoder(): Unit =
compiletime.summonInline[MyEncoder] |
Closes scala#11563 Possibly fixed by scala#11557
that certainly sounds like the right thing to do it's also possible to add latest-Scala-3-nightly to your own CI matrix |
Uh oh!
There was an error while loading. Please reload this page.
Compiler version
3.0.0-RC1
also on 3.0.0-RC2-bin-20210227-07d9dd2-NIGHTLY
Minimized code
Create some kind of typeclass with an implementation inside of a class-instance
Then make a macro that summons this using Expr.summon.
Then import the context and use the macro:
Output
Compilation fails, report error case "Can't find encoder" is hit.
Expectation
Compile should work and the given should be correctly summoned.
Note that if instead of using a macro I use a regular method, it will work:
Why the discrepancy?
Also, note that if you declare the given directly in the doEncoding method it will work:
Why the discrepancy?
Code
Full code sample is available here:
https://github.com/deusaquilus/expr_summon_issue
The text was updated successfully, but these errors were encountered: