From 468ff9c0fd341395d39eb57959755fb718990035 Mon Sep 17 00:00:00 2001 From: Nicolas Stucki Date: Tue, 5 Jul 2016 10:50:47 +0200 Subject: Fix #1209: Skip redundant superclasses\supertraits. --- tests/run/redundantParents.check | 8 ++++++++ tests/run/redundantParents.scala | 30 ++++++++++++++++++++++++++++++ 2 files changed, 38 insertions(+) create mode 100644 tests/run/redundantParents.check create mode 100644 tests/run/redundantParents.scala (limited to 'tests') diff --git a/tests/run/redundantParents.check b/tests/run/redundantParents.check new file mode 100644 index 000000000..4c7e367ce --- /dev/null +++ b/tests/run/redundantParents.check @@ -0,0 +1,8 @@ +C1 super class: class java.lang.Object +C1 interfaces: List(interface T2) +C2 super class: class C1 +C2 interfaces: List(interface T4, interface T5) +C3 super class: class C1 +C3 interfaces: List(interface T5) +C4 super class: class C2 +C4 interfaces: List() diff --git a/tests/run/redundantParents.scala b/tests/run/redundantParents.scala new file mode 100644 index 000000000..0cd277bbb --- /dev/null +++ b/tests/run/redundantParents.scala @@ -0,0 +1,30 @@ + +trait T1 +trait T2 extends T1 +trait T3 extends T2 +trait T4 extends T3 + +trait T5 + +class C1 extends T2 +class C2 extends C1 with T4 with T5 with T1 with T2 +class C3 extends C1 with T5 +class C4 extends C2 with T5 + +object Test { + def main(args: Array[String]): Unit = { + val c1 = (new C1).getClass + val c2 = (new C2).getClass + val c3 = (new C3).getClass + val c4 = (new C4).getClass + + println("C1 super class: " + c1.getSuperclass) + println("C1 interfaces: " + c1.getInterfaces.toList) + println("C2 super class: " + c2.getSuperclass) + println("C2 interfaces: " + c2.getInterfaces.toList) + println("C3 super class: " + c3.getSuperclass) + println("C3 interfaces: " + c3.getInterfaces.toList) + println("C4 super class: " + c4.getSuperclass) + println("C4 interfaces: " + c4.getInterfaces.toList) + } +} -- cgit v1.2.3