Closed
Description
Based on the community build failure https://scala3.westeurope.cloudapp.azure.com/blue/organizations/jenkins/buildCommunityProject/detail/buildCommunityProject/1136/pipeline/
Library maintainer @tabdulradi
Problem exists only if both open classes define extension methods using type matching
Compiler version
Works in 3.1.3
Fails in 3.2.0-RC1 and RC2
Fails in 3.2.1-RC1-bin-20220706-9d07d52-NIGHTLY
Minimized code
import scala.reflect.TypeTest
open class ForSyntax[E](using E: TypeTest[E | Any, E]):
extension [A](aOrE: E | A)
inline def flatMap[B](f: A => E | B): E | B =
aOrE match
case e: E => ???
case _ => ???
open class UnhappyCase[E](using E: TypeTest[E | Any, E]) extends ForSyntax[E]:
extension [A](aOrE: E | A)
inline def fold[B](inline fe: E => B, inline fa: A => B): B =
aOrE match
case e: E => ???
case _ => ???
Output
[error] ./test.scala:11:33: error overriding method inline$E in class ForSyntax of type => reflect.TypeTest[E | Any, E];
[error] method inline$E of type => reflect.TypeTest[E | Any, E] cannot override final member method inline$E in class ForSyntax
[error] open class UnhappyCase[E](using E: TypeTest[E | Any, E]) extends ForSyntax[E]:
[error] ^
Error compiling project (Scala 3.2.1-RC1-bin-20220706-9d07d52-NIGHTLY, JVM)
Expectation
Should compile