Skip to content

summonFrom and summon use different scopes for implicit search #11538

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

Closed
heksesang opened this issue Feb 25, 2021 · 3 comments · Fixed by #11591
Closed

summonFrom and summon use different scopes for implicit search #11538

heksesang opened this issue Feb 25, 2021 · 3 comments · Fixed by #11591
Milestone

Comments

@heksesang
Copy link

Compiler version

3.0.0-RC1

Minimized code

https://scastie.scala-lang.org/KfWryGwAT3SW7xwpv6k6OA

Output

Compiler error due to the fact that summonFrom only seems to do the implicit search within the closest enclosing scope (it compiles if the given is imported in the same scope as the summonFrom call).

Expectation

The calls to summon and summonFrom should obey the same rules for implicit search.

@nicolasstucki

This comment has been minimized.

@nicolasstucki
Copy link
Contributor

Minimized

package a:
  type Foo
  given foo: Foo = ???

import a.{Foo, given}
object test:
  inline def summonInlineFoo = scala.compiletime.summonInline[Foo]
  val summoned = summon[Foo]
  val summonedInline = summonInlineFoo

Moving the import into test fixed the issue

@nicolasstucki
Copy link
Contributor

nicolasstucki commented Feb 26, 2021

It is related but not exactly #11479

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants