-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Regression in scalamock/scalamock
for accessing nested types
#22424
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
Comments
@jchyb Can you take a look at it? You're having the most expertise with both scalamock codebase and quotes-reflection |
Minimised: import scala.quoted.*
object MockMaker:
inline def mock[T]: T = ${instance[T]}
def instance[T: Type](using quotes: Quotes): Expr[T] =
import quotes.reflect._
val tpe = TypeRepr.of[T]
val symbol = tpe.typeSymbol.methodMember("innerTraitInOptions").head
val a = tpe.memberType(symbol)
println(a.show)
'{???}
trait PolymorphicTrait {
trait Embedded {
trait ATrait[A, B]
def innerTraitInOptions(x: ATrait[String, Int]): ATrait[String, Int]
}
} Test.scala @main def Test =
val m = new PolymorphicTrait {}
val e = MockMaker.mock[m.Embedded] In 3.6.3 the shown method type is:
In 3.7.0-RC1-bin-20250120-db23c08-NIGHTLY:
For some reason we lose the information about the method argument, which later causes issues in ScalaMock. |
Bisect script points to 26ecda5 (I adjusted the minimisation slightly to error on arguments of type |
The issue lies with asSeenFrom used by the |
…cala#22448) To achieve this, we substitute This types in `member.info` referencing classSymbol with TypeReprs actual self (which may or may not be a This type) Fixes scala#22424
…cala#22448) To achieve this, we substitute This types in `member.info` referencing classSymbol with TypeReprs actual self (which may or may not be a This type) Fixes scala#22424 [Cherry-picked 2685750][modified]
Based on OpenCB failure
scalamock/scalamock
, version 7.1.0Compiler version
Fails in 3.7.0-RC1-bin-20250120-db23c08-NIGHTL
Works in 3.6.3
Minimized code
Not minimized yet
Output
Expectation
The text was updated successfully, but these errors were encountered: