Skip to content

summonInline can't find local givens. #12997

Closed
@roald-di

Description

@roald-di

Compiler version

v3.0.0 , v3.0.1-RC1 and v3.0.1-RC2

Minimized code

import scala.compiletime._

// works
val a = {
    given Int = 0
    summon[Int]
}
  
// doesn't
inline def summonInt = {
    given Int = 0
    summonInline[Int]
}
  
val b = summonInt

Output

v3.0.0:

cannot reduce summonFrom with
 patterns :  case given t @ _:Int

v3.0.1-RC1 and v3.0.1-RC2:

no implicit argument of type Int was found

Expectation

The locally introduced given is found

Update

As per #12359 this can currently be achieved with

inline def delayedSummonInline[T] = summonInline[T]

transparent inline def summonInt = {
    given Int = 0
    delayedSummonInline[Int]
}
  
val b = summonInt

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions