Skip to content
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

summonFrom should be usable in a macro quote block #21224

Open
joan38 opened this issue Jul 18, 2024 · 2 comments
Open

summonFrom should be usable in a macro quote block #21224

joan38 opened this issue Jul 18, 2024 · 2 comments
Labels
area:inline area:metaprogramming:other Issues tied to metaprogramming/macros not covered by the other labels. itype:enhancement

Comments

@joan38
Copy link
Contributor

joan38 commented Jul 18, 2024

Compiler version

3.4.2

Minimized code

inline def mySummonfrom: Option[DummyImplicit] = ${ mySummonfromImpl }

private def mySummonfromImpl(using Quotes): Expr[Option[DummyImplicit]] =
  import quotes.reflect.*

  '{
    summonFrom {
      case x: DummyImplicit => Some(x)
      case _                => None
    }
  }

Output

summonFrom can only be used in an inline method

Expectation

summonFrom should be usable in a macro quote block

Thanks

@joan38 joan38 added itype:bug stat:needs triage Every issue needs to have an "area" and "itype" label labels Jul 18, 2024
@bishabosha
Copy link
Member

until a decision is made - you can try a chain of Expr.summon which is an identical operation

@joan38
Copy link
Contributor Author

joan38 commented Jul 18, 2024

Unless I get hit by #21199 haha.
Thanks for the tip tho!

@Gedochao Gedochao added area:inline area:metaprogramming:other Issues tied to metaprogramming/macros not covered by the other labels. itype:enhancement and removed stat:needs triage Every issue needs to have an "area" and "itype" label itype:bug labels Jul 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:inline area:metaprogramming:other Issues tied to metaprogramming/macros not covered by the other labels. itype:enhancement
Projects
None yet
Development

No branches or pull requests

3 participants