diff options
author | Guillaume Martres <smarter@ubuntu.com> | 2017-03-11 16:19:31 +0100 |
---|---|---|
committer | Guillaume Martres <smarter@ubuntu.com> | 2017-03-12 13:28:27 +0100 |
commit | e5e691ea2dd53abb64306b91bf172aaa8e2e6b9c (patch) | |
tree | bc6de92440d037bc9e080f97df9c4ff8de025040 /compiler/src/dotty/tools/dotc/Compiler.scala | |
parent | b2d3b8938391516e81f18962e67f5bacf0aa2440 (diff) | |
download | dotty-e5e691ea2dd53abb64306b91bf172aaa8e2e6b9c.tar.gz dotty-e5e691ea2dd53abb64306b91bf172aaa8e2e6b9c.tar.bz2 dotty-e5e691ea2dd53abb64306b91bf172aaa8e2e6b9c.zip |
Fix overriding a Java method with varargs
If A method like:
override def foo(x: Object*)
overrides a Java method, it needs to be rewritten as:
def foo(x: Seq[Object])
override def foo(x: Array[Object]): Object = foo(Predef.wrapRefArray(x))
This should be handled by ElimRepeated but there were two bugs:
- `addVarArgsBridge` was called at phase `thisTransformer.next`, this is
too late to create the bridge since `T*` has already been rewritten as
`Seq[T]`
- The original method symbol needs to have the `override` flag dropped,
since it doesn't override anything.
Furthermore, RefChecks had to be moved after ElimRepeated, otherwise the
testcase would fail the overriding checks.
Diffstat (limited to 'compiler/src/dotty/tools/dotc/Compiler.scala')
-rw-r--r-- | compiler/src/dotty/tools/dotc/Compiler.scala | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/compiler/src/dotty/tools/dotc/Compiler.scala b/compiler/src/dotty/tools/dotc/Compiler.scala index 1d319242b..f413fc902 100644 --- a/compiler/src/dotty/tools/dotc/Compiler.scala +++ b/compiler/src/dotty/tools/dotc/Compiler.scala @@ -48,9 +48,9 @@ class Compiler { List(new Pickler), // Generate TASTY info List(new FirstTransform, // Some transformations to put trees into a canonical form new CheckReentrant), // Internal use only: Check that compiled program has no data races involving global vars - List(new RefChecks, // Various checks mostly related to abstract members and overriding - new CheckStatic, // Check restrictions that apply to @static members + List(new CheckStatic, // Check restrictions that apply to @static members new ElimRepeated, // Rewrite vararg parameters and arguments + new RefChecks, // Various checks mostly related to abstract members and overriding new NormalizeFlags, // Rewrite some definition flags new ExtensionMethods, // Expand methods of value classes with extension methods new ExpandSAMs, // Expand single abstract method closures to anonymous classes |