diff options
author | Martin Odersky <odersky@gmail.com> | 2017-01-28 17:11:56 +1100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2017-01-28 17:12:05 +1100 |
commit | 678e8e47b630786df7548c1be5bee744342f826c (patch) | |
tree | b747291c10d1d5f3bbea7cb12576e1ffedd5ba6c /tests | |
parent | 2bbf9ca068dd550ac68a83f33f7fc94505e6cfcc (diff) | |
download | dotty-678e8e47b630786df7548c1be5bee744342f826c.tar.gz dotty-678e8e47b630786df7548c1be5bee744342f826c.tar.bz2 dotty-678e8e47b630786df7548c1be5bee744342f826c.zip |
Disallow polymorphic refinements in stuctural types.
We can't handle them with the proposed scheme. I made a note in #1886.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/neg/structural.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/tests/neg/structural.scala b/tests/neg/structural.scala new file mode 100644 index 000000000..aab52b2cb --- /dev/null +++ b/tests/neg/structural.scala @@ -0,0 +1,11 @@ +object Test3 { + import scala.reflect.Selectable.reflectiveSelectable + def g(x: { type T ; def t: T ; def f(a: T): Boolean }) = x.f(x.t) // error: no ClassTag for x.T + g(new { type T = Int; def t = 4; def f(a:T) = true }) + g(new { type T = Any; def t = 4; def f(a:T) = true }) + val y: { type T = Int; def t = 4; def f(a:T) = true } + = new { type T = Int; def t = 4; def f(a:T) = true } + + def h(x: { def f[T](a: T): Int }) = x.f[Int](4) // error: polymorphic refinement method ... no longer allowed + +} |