-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
Another is not a class type
error when creating an anonymous subclass of an abstract class via new
through a type alias
#19745
Comments
Since it looked similar #18623, I had a look at it. Unfortunately, here we see a completely different code path since this is a |
@odersky As with the previous issues in this series, this also affects https://scastie.scala-lang.org/jn9DzwGoR4WW7wrFB4ERFg final abstract class ForcedRecompilationToken[T]
object ForcedRecompilationToken {
implicit def default: ForcedRecompilationToken["abc"] = null
}
object x {
abstract class GoodNoParens[T](implicit ev: ForcedRecompilationToken[T])
}
export x.GoodNoParens as BadNoParens
object App extends App {
// error
new BadNoParens {}
// ok
new BadNoParens() {}
new x.GoodNoParens {}
println("compiled")
} This worked correctly on Scala 2 and is still blocking me from porting existing library code to Scala 3...[1] |
Can't you just write |
@odersky Well, not really, in the real-world use case the type parameter, the implicit, the parens (that aren't even actually present in the class header either) are all implementation details that the user doesn't have to even know about. In worst case, I will have to remove the export - not force the user to write parentheses. In the abstract case, I'm not sure export has to be leaky - especially in cases where type aliases worked correctly before, in Scala 2. |
…Def,BootstrapPluginDef}` aliases on Scala 3
* Revert "Disable recompilation trigger functionality on Scala 3 completely due to bug scala/scala3#15976" This reverts commit 2ab8bf4. * use random token again. Waiting on usability fix for scala/scala3#18623 before merge * CI workaround for scala/scala3#19745 * Due to Scala 3 bug scala/scala3#19745 remove `distage.plugins.{PluginDef,BootstrapPluginDef}` aliases on Scala 3
So far I had to remove type aliases / exports in our Scala 3 port because of this issue. Maybe this could be addressed at some point? It really breaks the export abstraction for classes if their constructors are used in a DSL. |
Compiler version
3.4.0
Minimized code
https://scastie.scala-lang.org/gxYxc2GGSL2Kakv3xDQyKA
Output
Expectation
Same issue as in #18623, but this time it's when instantiating via
new
instead of declaring an object.The text was updated successfully, but these errors were encountered: