Skip to content

Inconsistency of in inlined implicits in scope #16372

Open
@nicolasstucki

Description

@nicolasstucki

Compiler version

3.2.1, a1729b0

Minimized code

inline def f()(using Int): Int =
  compiletime.summonInline[Int]
inline def g(): Int = {
  given Int = 10
  compiletime.summonInline[Int]
}
def test =
  f()
  g()

Output

-- Error: tests/pos/i16372.scala:9:5 -----------------------------------
9 |  f()
  |     ^
  |     No given instance of type Int was found for parameter x$1 of method f

Expectation

Both examples should find the implicit Int. I expect the binding for the argument of f to be implicitly available.

Larger example
inline def f()(using Int): Int = compiletime.summonInline[Int]
inline def g(): Int = {
  given Int = 10
  compiletime.summonInline[Int]
}
inline def a(): Int = compiletime.summonInline[Int]
inline def h(): Int = {
  given Int = 10
  a()
}
inline def i(using Int): Int = a()
def test =
  f()
  g()
  h()
  i()

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions