Tue, 15 Jan 2019 10:36:25 +0000
Added tag jdk8u202-ga for changeset 7aeae6eb6236
attila@1092 | 1 | /* |
sundar@1482 | 2 | * Copyright (c) 2014, Oracle and/or its affiliates. All rights reserved. |
attila@1092 | 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
sundar@1482 | 4 | * |
attila@1092 | 5 | * This code is free software; you can redistribute it and/or modify it |
attila@1092 | 6 | * under the terms of the GNU General Public License version 2 only, as |
attila@1092 | 7 | * published by the Free Software Foundation. |
sundar@1482 | 8 | * |
attila@1092 | 9 | * This code is distributed in the hope that it will be useful, but WITHOUT |
attila@1092 | 10 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
attila@1092 | 11 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
attila@1092 | 12 | * version 2 for more details (a copy is included in the LICENSE file that |
attila@1092 | 13 | * accompanied this code). |
sundar@1482 | 14 | * |
attila@1092 | 15 | * You should have received a copy of the GNU General Public License version |
attila@1092 | 16 | * 2 along with this work; if not, write to the Free Software Foundation, |
attila@1092 | 17 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
sundar@1482 | 18 | * |
attila@1092 | 19 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
attila@1092 | 20 | * or visit www.oracle.com if you need additional information or have any |
attila@1092 | 21 | * questions. |
attila@1092 | 22 | */ |
attila@1092 | 23 | |
attila@1092 | 24 | /** |
attila@1092 | 25 | * JDK-8062799: Binary logical expressions can have numeric types |
attila@1092 | 26 | * |
attila@1092 | 27 | * @test |
attila@1092 | 28 | * @run |
attila@1092 | 29 | */ |
attila@1092 | 30 | |
attila@1092 | 31 | (function() { |
attila@1092 | 32 | var inspect = Java.type("jdk.nashorn.test.tools.StaticTypeInspector").inspect; |
attila@1092 | 33 | |
attila@1092 | 34 | var b = true; |
attila@1092 | 35 | var i = 1; |
attila@1092 | 36 | var d = 2.1; |
attila@1092 | 37 | var o = "foo"; |
attila@1092 | 38 | |
attila@1092 | 39 | print(inspect(b || b, "b || b")); |
attila@1092 | 40 | print(inspect(b || i, "b || i")); |
attila@1092 | 41 | print(inspect(b || d, "b || d")); |
attila@1092 | 42 | print(inspect(b || o, "b || o")); |
attila@1092 | 43 | |
attila@1092 | 44 | print(inspect(i || b, "i || b")); |
attila@1092 | 45 | print(inspect(i || i, "i || i")); |
attila@1092 | 46 | print(inspect(i || d, "i || d")); |
attila@1092 | 47 | print(inspect(i || o, "i || o")); |
attila@1092 | 48 | |
attila@1092 | 49 | print(inspect(d || b, "d || b")); |
attila@1092 | 50 | print(inspect(d || i, "d || i")); |
attila@1092 | 51 | print(inspect(d || d, "d || d")); |
attila@1092 | 52 | print(inspect(d || o, "d || o")); |
attila@1092 | 53 | |
attila@1092 | 54 | print(inspect(o || b, "o || b")); |
attila@1092 | 55 | print(inspect(o || i, "o || i")); |
attila@1092 | 56 | print(inspect(o || d, "o || d")); |
attila@1092 | 57 | print(inspect(o || o, "o || o")); |
attila@1092 | 58 | |
attila@1092 | 59 | print(inspect(b && b, "b && b")); |
attila@1092 | 60 | print(inspect(b && i, "b && i")); |
attila@1092 | 61 | print(inspect(b && d, "b && d")); |
attila@1092 | 62 | print(inspect(b && o, "b && o")); |
attila@1092 | 63 | |
attila@1092 | 64 | print(inspect(i && b, "i && b")); |
attila@1092 | 65 | print(inspect(i && i, "i && i")); |
attila@1092 | 66 | print(inspect(i && d, "i && d")); |
attila@1092 | 67 | print(inspect(i && o, "i && o")); |
attila@1092 | 68 | |
attila@1092 | 69 | print(inspect(d && b, "d && b")); |
attila@1092 | 70 | print(inspect(d && i, "d && i")); |
attila@1092 | 71 | print(inspect(d && d, "d && d")); |
attila@1092 | 72 | print(inspect(d && o, "d && o")); |
attila@1092 | 73 | |
attila@1092 | 74 | print(inspect(o && b, "o && b")); |
attila@1092 | 75 | print(inspect(o && i, "o && i")); |
attila@1092 | 76 | print(inspect(o && d, "o && d")); |
attila@1092 | 77 | print(inspect(o && o, "o && o")); |
attila@1092 | 78 | })(); |
attila@1092 | 79 | |
attila@1092 | 80 | |
attila@1092 | 81 | |
sundar@1482 | 82 |