From 59d6dbc0aac912567d235048b5114cccf965c7ce Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Wed, 25 May 2016 15:21:50 +0200 Subject: clear all flags when resetting a symbol this change is a bit scary because it changes code that's not been changed in 11 years https://github.com/scala/scala/commit/7fa7c93#diff-d5789e5ae5061197d782d08324b260dbL214 --- .../junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala | 11 +++++++++++ 1 file changed, 11 insertions(+) (limited to 'test') diff --git a/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala b/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala index f835e9b140..36bdb759a6 100644 --- a/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala +++ b/test/junit/scala/tools/nsc/backend/jvm/DirectCompileTest.scala @@ -88,4 +88,15 @@ class DirectCompileTest extends BytecodeTesting { def compileErroneous(): Unit = { compileToBytes("class C { def f: String = 1 }", allowMessage = _.msg contains "type mismatch") } + + @Test + def residentRedefineFinalFlag(): Unit = { + val compiler = newCompiler() + val a = "final class C { def c1 = 0 }" + // for re-defined class symbols (C), the compiler did not clear the `final` flag. + // so compiling `D` would give an error `illegal inheritance from final class C`. + val b = "class C; class D extends C" + compiler.compileToBytes(a) + compiler.compileToBytes(b) + } } -- cgit v1.2.3