diff options
author | Paul Phillips <paulp@improving.org> | 2013-02-23 04:46:26 -0800 |
---|---|---|
committer | Paul Phillips <paulp@improving.org> | 2013-02-23 05:47:37 -0800 |
commit | ed2a0ac9a169b13a10cb4eed0a5a5b3904766ec5 (patch) | |
tree | bd21f50f57c8aa7a1ce76bca2fc3469937ee4c41 /test | |
parent | 6e2f0fa09dc7f264865433865238661657facf09 (diff) | |
parent | 88b2915790a6a2ccfa490de6e36aa355148a42b2 (diff) | |
download | scala-ed2a0ac9a169b13a10cb4eed0a5a5b3904766ec5.tar.gz scala-ed2a0ac9a169b13a10cb4eed0a5a5b3904766ec5.tar.bz2 scala-ed2a0ac9a169b13a10cb4eed0a5a5b3904766ec5.zip |
Merge remote-tracking branch 'origin/2.10.x' into master
* origin/2.10.x:
SI-7171 Consider prefix when assessing type finality.
please ant with filenames, add comments
Fixed error in reflection API docs about linearization order on method baseClasses
Shadowed Implict typo (fixes no issue)
remove unused imports
Conflicts:
src/reflect/scala/reflect/internal/Types.scala
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/t7171.check | 6 | ||||
-rw-r--r-- | test/files/neg/t7171.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t7171.scala | 11 | ||||
-rw-r--r-- | test/files/neg/t7171b.check | 6 | ||||
-rw-r--r-- | test/files/neg/t7171b.flags | 1 | ||||
-rw-r--r-- | test/files/neg/t7171b.scala | 15 | ||||
-rw-r--r-- | test/files/run/t7171.scala | 22 |
7 files changed, 62 insertions, 0 deletions
diff --git a/test/files/neg/t7171.check b/test/files/neg/t7171.check new file mode 100644 index 0000000000..ecd768afda --- /dev/null +++ b/test/files/neg/t7171.check @@ -0,0 +1,6 @@ +t7171.scala:2: warning: The outer reference in this type test cannot be checked at run time. + final case class A() + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/t7171.flags b/test/files/neg/t7171.flags new file mode 100644 index 0000000000..464cc20ea6 --- /dev/null +++ b/test/files/neg/t7171.flags @@ -0,0 +1 @@ +-Xfatal-warnings -unchecked
\ No newline at end of file diff --git a/test/files/neg/t7171.scala b/test/files/neg/t7171.scala new file mode 100644 index 0000000000..534b2070a3 --- /dev/null +++ b/test/files/neg/t7171.scala @@ -0,0 +1,11 @@ +trait T { + final case class A() + + // Was: + // error: scrutinee is incompatible with pattern type; + // found : T.this.A + // required: T#A + def foo(a: T#A) = a match { + case _: A => true; case _ => false + } +} diff --git a/test/files/neg/t7171b.check b/test/files/neg/t7171b.check new file mode 100644 index 0000000000..bf695afea7 --- /dev/null +++ b/test/files/neg/t7171b.check @@ -0,0 +1,6 @@ +t7171b.scala:2: warning: The outer reference in this type test cannot be checked at run time. + final case class A() + ^ +error: No warnings can be incurred under -Xfatal-warnings. +one warning found +one error found diff --git a/test/files/neg/t7171b.flags b/test/files/neg/t7171b.flags new file mode 100644 index 0000000000..464cc20ea6 --- /dev/null +++ b/test/files/neg/t7171b.flags @@ -0,0 +1 @@ +-Xfatal-warnings -unchecked
\ No newline at end of file diff --git a/test/files/neg/t7171b.scala b/test/files/neg/t7171b.scala new file mode 100644 index 0000000000..53c7787f8b --- /dev/null +++ b/test/files/neg/t7171b.scala @@ -0,0 +1,15 @@ +trait T { + final case class A() +} + +final class U extends T { + // this match should also not be deemed impossible + def foo(a: U#A) = a match { + case _: A => true; case _ => false + } + + // this match should also not be deemed impossible + def bar(a: T#A) = a match { + case _: A => true; case _ => false + } +} diff --git a/test/files/run/t7171.scala b/test/files/run/t7171.scala new file mode 100644 index 0000000000..97585b9860 --- /dev/null +++ b/test/files/run/t7171.scala @@ -0,0 +1,22 @@ +trait T { + final case class A() + + // Was: + // error: scrutinee is incompatible with pattern type; + // found : T.this.A + // required: T#A + def foo(a: T#A) = a match { + case _: A => true; case _ => false + } +} + +object Test extends App { + val t1 = new T {} + val t2 = new T {} + val a1 = new t1.A() + val a2 = new t1.A() + assert(t1.foo(a1)) + // as noted in the unchecked warning (tested in the corresponding neg test), + // the outer pointer isn't checked + assert(t1.foo(a2)) +} |