diff options
Diffstat (limited to 'test')
-rw-r--r-- | test/files/neg/t5878.check | 16 | ||||
-rw-r--r-- | test/files/neg/t6337.check | 7 | ||||
-rw-r--r-- | test/files/neg/t6337.scala | 21 |
3 files changed, 36 insertions, 8 deletions
diff --git a/test/files/neg/t5878.check b/test/files/neg/t5878.check index 50dba0d272..c60c4653a2 100644 --- a/test/files/neg/t5878.check +++ b/test/files/neg/t5878.check @@ -1,13 +1,13 @@ -t5878.scala:1: error: value class may not unbox to itself +t5878.scala:1: error: value class may not wrap another user-defined value class case class Foo(x: Bar) extends AnyVal - ^ -t5878.scala:2: error: value class may not unbox to itself + ^ +t5878.scala:2: error: value class may not wrap another user-defined value class case class Bar(x: Foo) extends AnyVal - ^ -t5878.scala:4: error: value class may not unbox to itself + ^ +t5878.scala:4: error: value class may not wrap another user-defined value class class Foo1(val x: Bar1) extends AnyVal - ^ -t5878.scala:5: error: value class may not unbox to itself + ^ +t5878.scala:5: error: value class may not wrap another user-defined value class class Bar1(val x: Foo1) extends AnyVal - ^ + ^ four errors found diff --git a/test/files/neg/t6337.check b/test/files/neg/t6337.check new file mode 100644 index 0000000000..8448f71320 --- /dev/null +++ b/test/files/neg/t6337.check @@ -0,0 +1,7 @@ +t6337.scala:10: error: value class may not wrap another user-defined value class +class X[T](val i: XX[T]) extends AnyVal + ^ +t6337.scala:20: error: value class may not wrap another user-defined value class +class X1[T](val i: XX1[T]) extends AnyVal + ^ +two errors found diff --git a/test/files/neg/t6337.scala b/test/files/neg/t6337.scala new file mode 100644 index 0000000000..c3858f8c04 --- /dev/null +++ b/test/files/neg/t6337.scala @@ -0,0 +1,21 @@ +object C { + + def main(args: Array[String]) = { + val x = new X(new XX(3)) + println(x.i.x + 9) + } + +} + +class X[T](val i: XX[T]) extends AnyVal +class XX[T](val x: T) extends AnyVal + +object C1 { + def main(args: Array[String]) { + val x = new X1(new XX1(Some(3))) + println(x.i.x.get + 9) + } +} + +class X1[T](val i: XX1[T]) extends AnyVal +class XX1[T](val x: Option[T]) extends AnyVal |