-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
"Could not find proxy for implicit evidence" when using doubly nested quotes #17026
Labels
Milestone
Comments
kitlangton
added
itype:bug
stat:needs triage
Every issue needs to have an "area" and "itype" label
labels
Feb 28, 2023
Thank you for reporting! |
szymon-rd
added
area:metaprogramming:quotes
Issues related to quotes and splices
and removed
stat:needs triage
Every issue needs to have an "area" and "itype" label
labels
Mar 1, 2023
Minimizedimport scala.quoted.*
def macroImpl(using Quotes) =
'{ def weird[A: Type](using Quotes) = Type.of[A] } |
The issue is that in the staging phase we generate The solution is not to create [[syntax trees at end of staging]]
package <empty> {
import scala.quoted.*
final lazy module val Macro_1$package: Macro_1$package = new Macro_1$package()
@SourceFile("t/Macro_1.scala") final module class Macro_1$package() extends
Object() { this: Macro_1$package.type =>
private def writeReplace(): AnyRef =
new scala.runtime.ModuleSerializationProxy(classOf[Macro_1$package.type])
def macroImpl(using x$1: quoted.Quotes): quoted.Expr[Unit] =
'{
{
@SplicedType type evidence$1$_$1 = evidence$1.Underlying
{
def weird[A >: Nothing <: Any](implicit evidence$1: quoted.Type[A],
x$1: quoted.Quotes): quoted.Type[A] =
quoted.Type.of[evidence$1$_$1](x$1)
()
}
}
}.apply(x$1)
}
} |
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Mar 6, 2023
The type declarations annotated with `@SplicedType` are only meant for types that come from outside the quote. If the reference to the `Type[T]` is to a definition within the quote (i.e. its level is grater than 0) we can use it directly. The `@SplicedType` for that type will be generated in a future compilation phase when the `Type[T]` definition reaches level 0. Fixes scala#17026
nicolasstucki
added a commit
to dotty-staging/dotty
that referenced
this issue
Mar 14, 2023
The type declarations annotated with `@SplicedType` are only meant for types that come from outside the quote. If the reference to the `Type[T]` is to a definition within the quote (i.e. its level is grater than 0) we can use it directly. The `@SplicedType` for that type will be generated in a future compilation phase when the `Type[T]` definition reaches level 0. Fixes scala#17026
nicolasstucki
added a commit
that referenced
this issue
Mar 15, 2023
The type declarations annotated with `@SplicedType` are only meant for types that come from outside the quote. If the reference to the `Type[T]` is to a definition within the quote (i.e. its level is grater than 0) we can use it directly. The `@SplicedType` for that type will be generated in a future compilation phase when the `Type[T]` definition reaches level 0. Fixes #17026
Dedelweiss
pushed a commit
to Dedelweiss/dotty
that referenced
this issue
Apr 17, 2023
The type declarations annotated with `@SplicedType` are only meant for types that come from outside the quote. If the reference to the `Type[T]` is to a definition within the quote (i.e. its level is grater than 0) we can use it directly. The `@SplicedType` for that type will be generated in a future compilation phase when the `Type[T]` definition reaches level 0. Fixes scala#17026
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler version
3.2.2
Minimized code
Output
Expectation
Well, it'd be great if it somehow compiled 😄
I'm certainly doing some weird stuff, what with the doubly nested quotes and all. For context, I wrote some macros for deriving
ToExpr
andFromExpr
(https://github.com/kitlangton/quotidian). However, they don't work with parameterized types.The text was updated successfully, but these errors were encountered: