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