If we have a package object that extends other classes, we may have to look member selections among inherited members. This is done by getMember instead of getDecl.
To test this, we need a Scala 2 package object with an extends clause. There is no such thing in the standard library, which is our only source of Scala 2 code, unfortunately. So we don't add a test for that.
Locally, given the following dependency in the testSources:
the following TypeSuite test used to fail before, and now works:
testWithContext("test") {
import Signatures.*
val sttpClientPackage = ctx.findPackage("sttp.client")
val UriContextName = termName("UriContext")
val UriInterpolatorClass = ctx.findTopLevelClass("sttp.model.UriInterpolator")
val UriContextClass = UriInterpolatorClass.findDecl(typeName("UriContext")).asClass
val StringContextClass = ctx.findTopLevelClass("scala.StringContext")
val sig = Signature(List(ParamSig.Term(StringContextClass.signatureName)), UriContextClass.signatureName)
val signedName = SignedName(UriContextName, sig)
println(signedName)
val tpRef = TermRef(sttpClientPackage.packageRef, signedName)
val sym = tpRef.symbol
println(sym)
val tpe = tpRef.underlyingOrMethodic
println(tpe.showBasic)
}
If we have a
package object
that extends other classes, we may have to look member selections among inherited members. This is done bygetMember
instead ofgetDecl
.To test this, we need a Scala 2
package object
with anextends
clause. There is no such thing in the standard library, which is our only source of Scala 2 code, unfortunately. So we don't add a test for that.Locally, given the following dependency in the
testSources
:the following
TypeSuite
test used to fail before, and now works: