diff options
author | Martin Odersky <odersky@gmail.com> | 2012-09-16 21:13:12 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2012-09-16 22:04:50 +0200 |
commit | 344215b92d22d2101067d6abd8172ac791a30f09 (patch) | |
tree | 67e9e6a90bc206d8706946ce964133d63c18eeaa /test/files | |
parent | 4d8d2e52361586f32a1a52b9a78728aca0d5bf0c (diff) | |
download | scala-344215b92d22d2101067d6abd8172ac791a30f09.tar.gz scala-344215b92d22d2101067d6abd8172ac791a30f09.tar.bz2 scala-344215b92d22d2101067d6abd8172ac791a30f09.zip |
SI-6336 Disallows value types in structuralal refinements
Structural refinements already have a number of restrictions, e.g. cannot refer to
type parameters of enclosing classes. We need to disallow value classes as well.
Diffstat (limited to 'test/files')
-rw-r--r-- | test/files/neg/t6336.check | 4 | ||||
-rw-r--r-- | test/files/neg/t6336.scala | 11 |
2 files changed, 15 insertions, 0 deletions
diff --git a/test/files/neg/t6336.check b/test/files/neg/t6336.check new file mode 100644 index 0000000000..f6b35ad232 --- /dev/null +++ b/test/files/neg/t6336.check @@ -0,0 +1,4 @@ +t6336.scala:3: error: Parameter type in structural refinement may not refer to a user-defined value class + val a = new { def y[T](x: X[T]) = x.i } + ^ +one error found diff --git a/test/files/neg/t6336.scala b/test/files/neg/t6336.scala new file mode 100644 index 0000000000..a9844ff94f --- /dev/null +++ b/test/files/neg/t6336.scala @@ -0,0 +1,11 @@ +object D { + def main(args: Array[String]) { + val a = new { def y[T](x: X[T]) = x.i } + val x = new X(3) + val t = a.y(x) + println(t) + } +} + +class X[T](val i: Int) extends AnyVal + |