- Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:experimental:ccCapture checking relatedCapture checking relatedarea:scala2-library-tastyAny issue generaing or using the Scala 2 library TASTyAny issue generaing or using the Scala 2 library TASTyitype:bug
Description
Compiler version
Latest main
Minimized code
//> using scala 3.7.2-RC1-bin-SNAPSHOT //> using dep org.scala-lang::scala2-library-cc-tasty-experimental::3.7.2-RC1-bin-SNAPSHOT import language.experimental.captureChecking import scala.caps.Capability class A def run(f: PartialFunction[A, A]^): A = f(A()) class File extends Capability: def read() = () def main() = val file = File() run: case a => file.read() aOutput
[error] ./partial-function.scala:17:5 [error] illegal inheritance: self type [error] scala.runtime.AbstractPartialFunction[Option[partialfunctions.A], [error] partialfunctions.A] [error] with Serializable {...}^{file} of anonymous class [error] [error] scala.runtime.AbstractPartialFunction[Option[partialfunctions.A], [error] partialfunctions.A] [error] with [error] Serializable {...} does not conform to self type scala.runtime.AbstractPartialFunction[Option[partialfunctions.A], [error] partialfunctions.A] [error] of parent class AbstractPartialFunctionThis is due to AbstractPartialFunction being declared with a self =>, which assumes a pure self type:
abstract class AbstractPartialFunction[@specialized(Specializable.Arg) -T1, @specialized(Specializable.Return) +R] extends Function1[T1, R] with PartialFunction[T1, R] { self => // ... }Since AbstractPartialFunction is specialized, not sure if we can override this in scala2-library-cc Tasty.
Expectation
Should compile.
Metadata
Metadata
Assignees
Labels
area:experimental:ccCapture checking relatedCapture checking relatedarea:scala2-library-tastyAny issue generaing or using the Scala 2 library TASTyAny issue generaing or using the Scala 2 library TASTyitype:bug