This repository was archived by the owner on Sep 1, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 7 files changed +54
-2
lines changed
src/compiler/scala/tools/nsc/transform Expand file tree Collapse file tree 7 files changed +54
-2
lines changed Original file line number Diff line number Diff line change @@ -814,11 +814,10 @@ abstract class Erasure extends AddInterfaces
814
814
// specialized members have no type history before 'specialize', causing double def errors for curried defs
815
815
override def exclude (sym : Symbol ): Boolean = (
816
816
sym.isType
817
- || sym.isPrivate
818
817
|| super .exclude(sym)
819
818
|| ! sym.hasTypeAt(currentRun.refchecksPhase.id)
820
819
)
821
- override def matches (lo : Symbol , high : Symbol ) = true
820
+ override def matches (lo : Symbol , high : Symbol ) = ! high.isPrivate
822
821
}
823
822
def isErasureDoubleDef (pair : SymbolPair ) = {
824
823
import pair ._
Original file line number Diff line number Diff line change
1
+ t9286a.scala:6: error: name clash between defined and inherited member:
2
+ def foo(o: (String,)): Unit in class T and
3
+ private def foo(o: (Any,)): Unit at line 6
4
+ have same type after erasure: (o: Tuple1)Unit
5
+ private def foo(o: Tuple1[Any]) = ()
6
+ ^
7
+ one error found
Original file line number Diff line number Diff line change
1
+ class T {
2
+ def foo (o : Tuple1 [String ]) = ()
3
+ }
4
+
5
+ class U extends T {
6
+ private def foo (o : Tuple1 [Any ]) = ()
7
+ }
8
+
9
+ object Test {
10
+ def main (args : Array [String ]): Unit = {
11
+ new U ().foo(null ) // IllegalAccessError: tried to access method U.foo(Lscala/Tuple1;)V from class Test$
12
+ }
13
+ }
Original file line number Diff line number Diff line change
1
+ t9286b.scala:2: error: name clash between defined and inherited member:
2
+ def foo: Int in class C and
3
+ private def foo[A]: Int at line 2
4
+ have same type after erasure: ()Int
5
+ class D extends C { private def foo[A] = 0 }
6
+ ^
7
+ one error found
Original file line number Diff line number Diff line change
1
+ class C { def foo = 0 }
2
+ class D extends C { private def foo [A ] = 0 }
3
+
4
+ class E { private def foo = 0 }
5
+ class F extends E { def foo [A ] = 0 } // okay
Original file line number Diff line number Diff line change
1
+ t9286c.scala:8: error: name clash between defined and inherited member:
2
+ def foo(m: M[_ >: String]): Int in trait T and
3
+ private def foo(m: M[_ >: Any]): Int at line 8
4
+ have same type after erasure: (m: M)Int
5
+ def foo(m: M[_ >: Any]) = 0 // Expected: "same type after erasure"
6
+ ^
7
+ one error found
Original file line number Diff line number Diff line change
1
+ class M [_]
2
+ trait T {
3
+ def foo (m : M [_ >: String ]) = 42
4
+ }
5
+
6
+ object Test {
7
+ def t : T = new T {
8
+ def foo (m : M [_ >: Any ]) = 0 // Expected: "same type after erasure"
9
+ }
10
+ def main (args : Array [String ]): Unit = {
11
+ val m : M [String ] = null
12
+ t.foo(m) // VeriyError: Duplicate method name&signature
13
+ }
14
+ }
You can’t perform that action at this time.
0 commit comments