diff options
author | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2014-02-24 14:42:33 +0100 |
---|---|---|
committer | Grzegorz Kossakowski <grzegorz.kossakowski@gmail.com> | 2014-02-24 14:45:00 +0100 |
commit | 7def1a90a01f5ac1e6e4e6b0c0cd58f131874a2f (patch) | |
tree | 3568d312ba462cb0b61992cd7d657dc829b48843 /test/files/run/t8233-bcode.scala | |
parent | 718a8974f4de14e52006ff152a0f4679fe5318c9 (diff) | |
download | scala-7def1a90a01f5ac1e6e4e6b0c0cd58f131874a2f.tar.gz scala-7def1a90a01f5ac1e6e4e6b0c0cd58f131874a2f.tar.bz2 scala-7def1a90a01f5ac1e6e4e6b0c0cd58f131874a2f.zip |
SI-8330: Mismatch in stack heights
The SI-8233 / 9506d52 missed one case when we need to DROP a null from
a stack: when unboxed Unit is an expected type. If we forgot to do that
in a context where two branches were involved we could end up with
unbalanced stack sizes.
Let's fix that omission and a test covering that specific case to the
original test for SI-8233.
Fixes SI-8330.
Diffstat (limited to 'test/files/run/t8233-bcode.scala')
-rw-r--r-- | test/files/run/t8233-bcode.scala | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/test/files/run/t8233-bcode.scala b/test/files/run/t8233-bcode.scala index fae1c2b702..72d013e553 100644 --- a/test/files/run/t8233-bcode.scala +++ b/test/files/run/t8233-bcode.scala @@ -11,8 +11,21 @@ object Test { bar(a) } - def main(args: Array[String]) = { + /** Check SI-8330 for details */ + def expectedUnitInABranch(b: Boolean): Boolean = { + if (b) { + val x = 12 + () + } else { + // here expected type is (unboxed) Unit + null + } + true + } + + def main(args: Array[String]): Unit = { try { nullReference } catch { case _: NoSuchElementException => } literal + expectedUnitInABranch(true) } } |