1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/test/script/basic/JDK-8062799.js Tue Nov 11 17:27:44 2014 +0100 1.3 @@ -0,0 +1,103 @@ 1.4 +/* 1.5 + * Copyright (c) 2014 Oracle and/or its affiliates. All rights reserved. 1.6 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 1.7 + * 1.8 + * This code is free software; you can redistribute it and/or modify it 1.9 + * under the terms of the GNU General Public License version 2 only, as 1.10 + * published by the Free Software Foundation. 1.11 + * 1.12 + * This code is distributed in the hope that it will be useful, but WITHOUT 1.13 + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 1.14 + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 1.15 + * version 2 for more details (a copy is included in the LICENSE file that 1.16 + * accompanied this code). 1.17 + * 1.18 + * You should have received a copy of the GNU General Public License version 1.19 + * 2 along with this work; if not, write to the Free Software Foundation, 1.20 + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 1.21 + * 1.22 + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 1.23 + * or visit www.oracle.com if you need additional information or have any 1.24 + * questions. 1.25 + */ 1.26 + 1.27 +/** 1.28 + * JDK-8062799: Binary logical expressions can have numeric types 1.29 + * 1.30 + * @test 1.31 + * @run 1.32 + */ 1.33 + 1.34 +(function() { 1.35 + var inspect = Java.type("jdk.nashorn.test.tools.StaticTypeInspector").inspect; 1.36 + 1.37 + var b = true; 1.38 + var i = 1; 1.39 + var l = 4294967296; 1.40 + var d = 2.1; 1.41 + var o = "foo"; 1.42 + 1.43 + print(inspect(b || b, "b || b")); 1.44 + print(inspect(b || i, "b || i")); 1.45 + print(inspect(b || l, "b || l")); 1.46 + print(inspect(b || d, "b || d")); 1.47 + print(inspect(b || o, "b || o")); 1.48 + 1.49 + print(inspect(i || b, "i || b")); 1.50 + print(inspect(i || i, "i || i")); 1.51 + print(inspect(i || l, "i || l")); 1.52 + print(inspect(i || d, "i || d")); 1.53 + print(inspect(i || o, "i || o")); 1.54 + 1.55 + print(inspect(l || b, "l || b")); 1.56 + print(inspect(l || i, "l || i")); 1.57 + print(inspect(l || l, "l || l")); 1.58 + print(inspect(l || d, "l || d")); 1.59 + print(inspect(l || o, "l || o")); 1.60 + 1.61 + print(inspect(d || b, "d || b")); 1.62 + print(inspect(d || i, "d || i")); 1.63 + print(inspect(d || l, "d || l")); 1.64 + print(inspect(d || d, "d || d")); 1.65 + print(inspect(d || o, "d || o")); 1.66 + 1.67 + print(inspect(o || b, "o || b")); 1.68 + print(inspect(o || i, "o || i")); 1.69 + print(inspect(o || l, "o || l")); 1.70 + print(inspect(o || d, "o || d")); 1.71 + print(inspect(o || o, "o || o")); 1.72 + 1.73 + print(inspect(b && b, "b && b")); 1.74 + print(inspect(b && i, "b && i")); 1.75 + print(inspect(b && l, "b && l")); 1.76 + print(inspect(b && d, "b && d")); 1.77 + print(inspect(b && o, "b && o")); 1.78 + 1.79 + print(inspect(i && b, "i && b")); 1.80 + print(inspect(i && i, "i && i")); 1.81 + print(inspect(i && l, "i && l")); 1.82 + print(inspect(i && d, "i && d")); 1.83 + print(inspect(i && o, "i && o")); 1.84 + 1.85 + print(inspect(l && b, "l && b")); 1.86 + print(inspect(l && i, "l && i")); 1.87 + print(inspect(l && l, "l && l")); 1.88 + print(inspect(l && d, "l && d")); 1.89 + print(inspect(l && o, "l && o")); 1.90 + 1.91 + print(inspect(d && b, "d && b")); 1.92 + print(inspect(d && i, "d && i")); 1.93 + print(inspect(d && l, "d && l")); 1.94 + print(inspect(d && d, "d && d")); 1.95 + print(inspect(d && o, "d && o")); 1.96 + 1.97 + print(inspect(o && b, "o && b")); 1.98 + print(inspect(o && i, "o && i")); 1.99 + print(inspect(o && l, "o && l")); 1.100 + print(inspect(o && d, "o && d")); 1.101 + print(inspect(o && o, "o && o")); 1.102 +})(); 1.103 + 1.104 + 1.105 + 1.106 + 1.107 \ No newline at end of file