From 997ef56058d8c44d2b9c5f561edf2aa65221c150 Mon Sep 17 00:00:00 2001 From: Antoine Gourlay Date: Thu, 28 Aug 2014 10:40:05 +0200 Subject: SI-8828 fix regression in Xlint visibility warning for sealed classes 5dfcf5e reverted a change to `Symbol#isEffectivelyFinal` (made in adeffda) that broke overriding checks, and moved the new enhanced version to a new method. However, the test for inaccessible type access still uses the old one, so it lost the ability to see that the owner of some method is either final or sealed and not overridden. This just makes it use the new `isEffectivelyFinalOrNotOverriden`. --- test/files/pos/t8828.flags | 1 + test/files/pos/t8828.scala | 20 ++++++++++++++++++++ 2 files changed, 21 insertions(+) create mode 100644 test/files/pos/t8828.flags create mode 100644 test/files/pos/t8828.scala (limited to 'test/files/pos') diff --git a/test/files/pos/t8828.flags b/test/files/pos/t8828.flags new file mode 100644 index 0000000000..e68991f643 --- /dev/null +++ b/test/files/pos/t8828.flags @@ -0,0 +1 @@ +-Xlint:inaccessible -Xfatal-warnings diff --git a/test/files/pos/t8828.scala b/test/files/pos/t8828.scala new file mode 100644 index 0000000000..92092b4dd4 --- /dev/null +++ b/test/files/pos/t8828.scala @@ -0,0 +1,20 @@ + +package outer + +package inner { + + private[inner] class A + + // the class is final: no warning + private[outer] final class B { + def doWork(a: A): A = a + } + + // the trait is sealed and doWork is not + // and cannot be overriden: no warning + private[outer] sealed trait C { + def doWork(a: A): A = a + } + + private[outer] final class D extends C +} -- cgit v1.2.3