diff options
author | Martin Odersky <odersky@gmail.com> | 2016-07-09 19:46:39 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2016-07-09 21:27:14 +0200 |
commit | 490cc5ff508b45e5b32bced5f4e760258450358e (patch) | |
tree | 81bfdfe51d2ce52c890d4e6dc4092737ee8845eb /tests | |
parent | 17191782afa2cdc2f0b018ecf4429ba18eeafc73 (diff) | |
download | dotty-490cc5ff508b45e5b32bced5f4e760258450358e.tar.gz dotty-490cc5ff508b45e5b32bced5f4e760258450358e.tar.bz2 dotty-490cc5ff508b45e5b32bced5f4e760258450358e.zip |
Fix 1365: Fix bindings in patterns
We need to compare pattern types with expected types in order
to derive knowledge about pattern-bound variables. This is done
use the mechanism of gadt bounds.
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pos/i1365.scala | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/tests/pos/i1365.scala b/tests/pos/i1365.scala new file mode 100644 index 000000000..e7d47da4b --- /dev/null +++ b/tests/pos/i1365.scala @@ -0,0 +1,13 @@ +import scala.collection.mutable.ArrayBuffer + +trait Message[M] +class Script[S] extends ArrayBuffer[Message[S]] with Message[S] + +class Test[A] { + def f(cmd: Message[A]): Unit = cmd match { + case s: Script[_] => s.iterator.foreach(x => f(x)) + } + def g(cmd: Message[A]): Unit = cmd match { + case s: Script[z] => s.iterator.foreach(x => g(x)) + } +} |