From 963414f6ae6b895b41cf4372b2c76cf20389b58a Mon Sep 17 00:00:00 2001 From: Som Snytt Date: Thu, 8 Jan 2015 09:54:10 -0800 Subject: 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. --- test/files/pos/t8462.scala | 11 +++++++++++ 1 file changed, 11 insertions(+) create mode 100644 test/files/pos/t8462.scala (limited to 'test/files/pos') 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 + ) +} -- cgit v1.2.3