You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
➜~ scala
scala>classA { defapply(xs: Int*) =42 }
// defined class A
scala>classBextendsA { defapply(xs: Seq[Int]) =42 }
1|classBextendsA { defapply(xs: Seq[Int]) =42 }
|^| error overriding method apply in classA of type (xs: Seq[Int]):Int;
| method apply of type (xs: Seq[Int]):Int needs `override` modifier
scala>classBextendsA { defapply(xs: Seq[Int]) ="42" }
1|classBextendsA { defapply(xs: Seq[Int]) ="42" }
|^| error overriding method apply in classA of type (xs: Seq[Int]):Int;
| method apply of type (xs: Seq[Int]):String needs `override` modifier
scala>classBextendsA { overridedefapply(xs: Seq[Int]) =17 }
// defined class B
scala>B()(42)
1|B()(42)
|^^|Found: (42:Int)
|Required:Seq[Int]
scala> (B():A)(42)
valres0:Int=17
Output
// TODO add output here
Expectation
Welcome to Scala2.13.6 (OpenJDK64-BitServerVM, Java16.0.1).
Type in expressions for evaluation. Ortry:help.
scala>classA { defapply(xs: Int*) =42 }
classA
scala>classBextendsA { defapply(xs: Seq[Int]) =42 }
^error: name clash between defined and inherited member:
defapply(xs: Int*):Int in classA and
defapply(xs: Seq[Int]):Int at line 1
have same typeaftererasure: (xs: Seq):Int
scala>
Refchecks runs after elimRepeated and did not
error on an attempt to override RepeatedParam with Seq.
Also show RepeatedParam in error message for double definition.
Fixes#12662
Resubmits #13248 which was opened
against old master.
Compiler version
3.0.0
Minimized code
Output
// TODO add output here
Expectation
scala/bug#7052
The text was updated successfully, but these errors were encountered: