-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Regression from March: Incorrect quoted.Type instance required in quotes subclassing an inner trait #17293
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
It appears that the bisect script points to f035f10 as the "first bad commit" |
@nicolasstucki Could you please look into this regression when you have the time? It wouldn't let us update a Scala 3.2 project to 3.3, if 3.3 final includes it - I don't think there's a workaround for it. |
You can work around this by replacing |
@smarter import scala.quoted.{Expr, Quotes, Type, quotes}
trait OuterTrait { self =>
trait X
def exampleMacro[T <: self.type: Type](expr: Expr[T])(using Quotes): Expr[self.X] = {
'{
val prefix: T = ${ expr }
new prefix.X {}
}
}
} because of self.X return type, T cannot be replaced by OuterTrait, it must be self.type. But it appears that this bug was fixed already in 3.3.0, neither variant of the snippet causes an error anymore: https://scastie.scala-lang.org/7Qn2ZOBlTyaoUIPWwboSCA I'm closing this, although it might be prudent to add a test for this to the test suite. |
It was reintroduced again in 3.3.1-RC1+ and still present in 3.3.1-RC4 ... https://scastie.scala-lang.org/KcD6pkn4RhWHewJaSRtmuA (I worked around the issue using smarter's suggestion & asInstanceOf) |
To be exact, 3.3.0 was branched out way before the commit that introduced the bug. Therefore, the bug is a regression introduced in 3.3.1. |
If the prefix of a `TypeRef` is a `TypeRef` we just `mapOver`. Fixes #17293
Compiler version
3.3.1-RC1-bin-20230407-bcaa1ca-NIGHTLY
and3.3.1-RC1-bin-20230416-2f4cc4c-NIGHTLY
Minimized code
https://scastie.scala-lang.org/E3WYTt73Ryqc3pzCY1xapQ
Output
Expectation
Expected to compile as on commit
7262437
(version3.3.1-RC1-bin-20230331-7262437-NIGHTLY
, https://scastie.scala-lang.org/y7mN6SA1REKvXAqIIEAbqw).Constraint
Type[T#X]
is unwriteable since it's an abstract type projection and cannot be satisfied.The text was updated successfully, but these errors were encountered: