diff options
author | Lukas Rytz <lukas.rytz@gmail.com> | 2016-08-30 16:26:05 +0200 |
---|---|---|
committer | Lukas Rytz <lukas.rytz@gmail.com> | 2016-09-01 22:38:05 +0200 |
commit | a980fded6806f83bebe2ced31ab1ed70926254b2 (patch) | |
tree | c8885e4db2ad68476eb45291043d2c306961f7ab /test/files/jvm/t8582.scala | |
parent | 505c723b1e0bc282bdfa9cfc41adf24573ed19ad (diff) | |
download | scala-a980fded6806f83bebe2ced31ab1ed70926254b2.tar.gz scala-a980fded6806f83bebe2ced31ab1ed70926254b2.tar.bz2 scala-a980fded6806f83bebe2ced31ab1ed70926254b2.zip |
SD-143 error for super calls that cannot be implemented correctly
If a call super[T].m resolves to a method A.m where A is a class, but
not the direct superclass of the current class, there is no way to
emit an invocation of A.m: `invokespecial A.m` will resolve to B.m
where B is the superclass of the current class.
This commit adds an error message in this case.
Note that this is similar to an existing error message for qualified
super calls to a non-direct superclass:
class A { def m = 1 }
class B extends A { override def m = 2 }
class C extends B { override def m = super[A].m }
Gives "error: A does not name a parent class of class C".
If the user means to call method m in the superclass, he can write an
unqualified `super.m`.
An similar error message is introduced if A is a Java-defined interface
(and m is a default method), and A is not a direct parent of the current
class. In this case `invokespecial A.m` is invalid bytecode. The
solution is to add A as a direct parent of the current class.
Diffstat (limited to 'test/files/jvm/t8582.scala')
0 files changed, 0 insertions, 0 deletions