diff options
author | Paul Phillips <paulp@improving.org> | 2013-01-02 07:36:58 -0800 |
---|---|---|
committer | Adriaan Moors <adriaan.moors@typesafe.com> | 2013-01-28 15:05:10 -0800 |
commit | f6d90a8a2502c0e1f0ecf72a2fd4258c4f52ec84 (patch) | |
tree | e98828f2ddf4402f7637af3fde85c5fc5e9e5ddf /test/files/neg/t5378.check | |
parent | cc3b9a23ebb453b827197e5ab5cba46a9e770f0c (diff) | |
download | scala-f6d90a8a2502c0e1f0ecf72a2fd4258c4f52ec84.tar.gz scala-f6d90a8a2502c0e1f0ecf72a2fd4258c4f52ec84.tar.bz2 scala-f6d90a8a2502c0e1f0ecf72a2fd4258c4f52ec84.zip |
[backport] SI-5378, unsoundness with type bounds in refinements.
As the comment says:
Not enough to look for abstract types; have to recursively check
the bounds of each abstract type for more abstract types. Almost
certainly there are other exploitable type soundness bugs which
can be seen by bounding a type parameter by an abstract type which
itself is bounded by an abstract type.
SPECIAL: BUY ONE UNSOUNDNESS, GET ONE FREE
In refinement types, only the first parameter list of methods
was being analyzed for unsound uses of abstract types. Second
parameter list and beyond had free unsoundness reign. That bug
as well is fixed here.
Diffstat (limited to 'test/files/neg/t5378.check')
-rw-r--r-- | test/files/neg/t5378.check | 31 |
1 files changed, 31 insertions, 0 deletions
diff --git a/test/files/neg/t5378.check b/test/files/neg/t5378.check new file mode 100644 index 0000000000..c1460083f6 --- /dev/null +++ b/test/files/neg/t5378.check @@ -0,0 +1,31 @@ +t5378.scala:7: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + def contains = new { def apply[T1 <: T](value: T1) = ??? } + ^ +t5378.scala:8: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + def contains1 = new { def apply[T1 <: A1](value: T1) = ??? } + ^ +t5378.scala:9: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + def contains2 = new { def apply[T1 <: A2](value: T1) = ??? } + ^ +t5378.scala:15: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + new Bippy { def apply[T1 <: T](value: T1) = ??? } + ^ +t5378.scala:16: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + new Bippy { def apply[T1 <: B1](value: T1) = ??? } + ^ +t5378.scala:17: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + new Bippy { def apply[T1 <: B2](value: T1) = ??? } + ^ +t5378.scala:21: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + def apply1[T1 <: B3](value: T1) = ??? + ^ +t5378.scala:23: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement + def apply3(value: B3) = ??? + ^ +t5378.scala:28: error: Parameter type in structural refinement may not refer to an abstract type defined outside that refinement + def apply1(s: String)(x: Int)(value: T) = ??? + ^ +t5378.scala:29: error: Type bound in structural refinement may not refer to an abstract type defined outside that refinement + def apply2[T1 <: T](s: String)(x: Int)(value: T1) = ??? + ^ +10 errors found |