diff options
author | Paul Phillips <paulp@improving.org> | 2012-09-14 13:08:05 -0700 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2012-09-14 13:08:05 -0700 |
commit | 493d16306cf0e836da9c77a4768dd42620dd1a72 (patch) | |
tree | fee4965ed7d69ca25a888875839b2f54445e7338 /test/files/neg | |
parent | 261b1c785668ae42a29d9217cc4a8f305a724e2f (diff) | |
parent | e498fac7fdbda3187a2a4fffcdf7fa4f9ddb7ac8 (diff) | |
download | scala-493d16306cf0e836da9c77a4768dd42620dd1a72.tar.gz scala-493d16306cf0e836da9c77a4768dd42620dd1a72.tar.bz2 scala-493d16306cf0e836da9c77a4768dd42620dd1a72.zip |
Merge pull request #1299 from namin/si-6245
Fix for SI-6245 with workaround for SI-2296.
Diffstat (limited to 'test/files/neg')
-rw-r--r-- | test/files/neg/t2296a.check | 5 | ||||
-rw-r--r-- | test/files/neg/t2296a/J.java | 7 | ||||
-rw-r--r-- | test/files/neg/t2296a/S.scala | 18 | ||||
-rw-r--r-- | test/files/neg/t2296b.check | 5 | ||||
-rw-r--r-- | test/files/neg/t2296b/J_1.java | 7 | ||||
-rw-r--r-- | test/files/neg/t2296b/S_2.scala | 18 |
6 files changed, 60 insertions, 0 deletions
diff --git a/test/files/neg/t2296a.check b/test/files/neg/t2296a.check new file mode 100644 index 0000000000..863b861046 --- /dev/null +++ b/test/files/neg/t2296a.check @@ -0,0 +1,5 @@ +S.scala:6: error: Implementation restriction: trait S accesses protected method foo inside a concrete trait method. +Add an accessor in a class extending class J as a workaround. + foo() + ^ +one error found diff --git a/test/files/neg/t2296a/J.java b/test/files/neg/t2296a/J.java new file mode 100644 index 0000000000..78ff3e9804 --- /dev/null +++ b/test/files/neg/t2296a/J.java @@ -0,0 +1,7 @@ +package j; + +public class J { + protected void foo() { + System.out.println("J.foo()"); + } +}
\ No newline at end of file diff --git a/test/files/neg/t2296a/S.scala b/test/files/neg/t2296a/S.scala new file mode 100644 index 0000000000..532d038a42 --- /dev/null +++ b/test/files/neg/t2296a/S.scala @@ -0,0 +1,18 @@ +package s { + import j.J + + trait S extends J { + def bar() { + foo() + } + } + + class SC extends J with S +} + +object Test { + def main(args : Array[String]) { + (new s.SC).bar() + (new s.S { }).bar() + } +}
\ No newline at end of file diff --git a/test/files/neg/t2296b.check b/test/files/neg/t2296b.check new file mode 100644 index 0000000000..07cc54d573 --- /dev/null +++ b/test/files/neg/t2296b.check @@ -0,0 +1,5 @@ +S_2.scala:6: error: Implementation restriction: trait S accesses protected method foo inside a concrete trait method. +Add an accessor in a class extending class J_1 as a workaround. + foo() + ^ +one error found diff --git a/test/files/neg/t2296b/J_1.java b/test/files/neg/t2296b/J_1.java new file mode 100644 index 0000000000..4c91d47073 --- /dev/null +++ b/test/files/neg/t2296b/J_1.java @@ -0,0 +1,7 @@ +package j; + +public class J_1 { + protected void foo() { + System.out.println("J.foo()"); + } +}
\ No newline at end of file diff --git a/test/files/neg/t2296b/S_2.scala b/test/files/neg/t2296b/S_2.scala new file mode 100644 index 0000000000..6cdb0cfaba --- /dev/null +++ b/test/files/neg/t2296b/S_2.scala @@ -0,0 +1,18 @@ +package s { + import j.J_1 + + trait S extends J_1 { + def bar() { + foo() + } + } + + class SC extends J_1 with S +} + +object Test { + def main(args : Array[String]) { + (new s.SC).bar() + (new s.S { }).bar() + } +} |