diff options
author | Som Snytt <som.snytt@gmail.com> | 2015-01-08 09:54:10 -0800 |
---|---|---|
committer | Som Snytt <som.snytt@gmail.com> | 2015-01-09 00:40:28 -0800 |
commit | 963414f6ae6b895b41cf4372b2c76cf20389b58a (patch) | |
tree | d751dd0e656615cc8ceaa627bb5d6f4d0de1db31 /test/files/pos/t8462.scala | |
parent | f13fc65f38821dd06da35c488f2be89efec20a4c (diff) | |
download | scala-963414f6ae6b895b41cf4372b2c76cf20389b58a.tar.gz scala-963414f6ae6b895b41cf4372b2c76cf20389b58a.tar.bz2 scala-963414f6ae6b895b41cf4372b2c76cf20389b58a.zip |
SI-8462: Integral shift Long result type corrected
Constant folding was incorrectly promoting to Long when the
operand was Long, as with other binary ops, but the result
type depends on the receiver.
Per SLS 12.2.1.
This fixes ((1 << 2L): Int) and the other shift ops and
the other integral types.
Diffstat (limited to 'test/files/pos/t8462.scala')
-rw-r--r-- | test/files/pos/t8462.scala | 11 |
1 files changed, 11 insertions, 0 deletions
diff --git a/test/files/pos/t8462.scala b/test/files/pos/t8462.scala new file mode 100644 index 0000000000..6946cf8e5e --- /dev/null +++ b/test/files/pos/t8462.scala @@ -0,0 +1,11 @@ + +trait ConstantOps { + def exprs = ( + 1 << 2L : Int, // was: error: type mismatch; found : Long(4L) + 64 >> 2L : Int, // was: error: type mismatch; found : Long(4L) + 64 >>> 2L : Int, // was: error: type mismatch; found : Long(4L) + 'a' << 2L : Int, + 'a' >> 2L : Int, + 'a'>>> 2L : Int + ) +} |