Closed
Description
Compiler version
Both:
- 3.0.0-RC1
- 3.0.1-RC1-bin-20210406-b0061c4-NIGHTLY
Minimized code
import scala.quoted.*
inline def inspect[A]: Unit =
${ inspect2[A] }
def inspect2[A: Type](using Quotes): Expr[Unit] = {
import quotes.reflect.*
val DefDef(_, List(Nil, ps: TermParamClause), _, _) =
TypeRepr.of[A].typeSymbol.primaryConstructor.tree
val names = ps.params.map(p => s"${p.name}: ${p.tpt.show}").mkString("(", ", ", ")")
println(s"${Type.show[A]}: $names isImplicit = ${ps.isImplicit}")
'{()}
}
class X1(implicit i: Int)
class X2(using i: Int)
def test = {
inspect[X1]
inspect[X2]
}
Output
X1: (i: scala.Int) isImplicit = true
X2: (i: scala.Int) isImplicit = false
Expectation
Currently there's no way to tell whether an parameter clause is marked with using
or not.
I expect one of the following. Either:
TermParamClause
should returntrue
forisImplicit
in theX2
caseTermParamClause
should have aisGiven
method