diff options
author | odersky <odersky@gmail.com> | 2017-02-01 18:21:58 +1100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-01 18:21:58 +1100 |
commit | af7fdb32df34b352bf39f01a26653b169e0d55cf (patch) | |
tree | 4307381bb799db513dd07a0f40aec968ae99e877 /tests/neg/structural.scala | |
parent | bb2e99cdfa9876561df912d26e9870526de3dd5d (diff) | |
parent | 678e8e47b630786df7548c1be5bee744342f826c (diff) | |
download | dotty-af7fdb32df34b352bf39f01a26653b169e0d55cf.tar.gz dotty-af7fdb32df34b352bf39f01a26653b169e0d55cf.tar.bz2 dotty-af7fdb32df34b352bf39f01a26653b169e0d55cf.zip |
Merge pull request #1881 from dotty-staging/add-structural-select
Implement structural type member access
Diffstat (limited to 'tests/neg/structural.scala')
-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 + +} |