annotate graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TypeSystemErrorsTest.java @ 18782:3ea386a1036f

Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
author Christian Humer <christian.humer@gmail.com>
date Mon, 05 Jan 2015 20:23:22 +0100
parents 64dcb92ee75a
children 7d67a33e1bbb
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
11467
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
1 /*
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
2 * Copyright (c) 2012, 2013, Oracle and/or its affiliates. All rights reserved.
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
4 *
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
8 *
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
13 * accompanied this code).
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
14 *
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
18 *
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
21 * questions.
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
22 */
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
23 package com.oracle.truffle.api.dsl.test;
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
24
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
25 import com.oracle.truffle.api.dsl.*;
14991
64dcb92ee75a Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11479
diff changeset
26 import com.oracle.truffle.api.dsl.test.TypeSystemTest.ValueNode;
11467
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
27
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
28 public class TypeSystemErrorsTest {
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
29
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
30 @TypeSystem({int.class, boolean.class})
11469
88316d1c4644 Truffle-DSL: preparations for implicit casts
Christian Humer <christian.humer@gmail.com>
parents: 11467
diff changeset
31 public static class Types0 {
11467
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
32
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
33 }
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
34
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
35 @ExpectError("Invalid type order. The type(s) [java.lang.String] are inherited from a earlier defined type java.lang.CharSequence.")
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
36 @TypeSystem({CharSequence.class, String.class})
11469
88316d1c4644 Truffle-DSL: preparations for implicit casts
Christian Humer <christian.humer@gmail.com>
parents: 11467
diff changeset
37 public static class Types1 {
11467
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
38
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
39 }
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
40
11479
fce94b1d46f0 Truffle-DSL: fixed the @TypeSystem of child nodes were not checked for equality.
Christian Humer <christian.humer@gmail.com>
parents: 11469
diff changeset
41 @TypeSystemReference(Types0.class)
fce94b1d46f0 Truffle-DSL: fixed the @TypeSystem of child nodes were not checked for equality.
Christian Humer <christian.humer@gmail.com>
parents: 11469
diff changeset
42 @NodeChild
fce94b1d46f0 Truffle-DSL: fixed the @TypeSystem of child nodes were not checked for equality.
Christian Humer <christian.humer@gmail.com>
parents: 11469
diff changeset
43 @ExpectError("The @TypeSystem of the node and the @TypeSystem of the @NodeChild does not match. Types0 != SimpleTypes. ")
fce94b1d46f0 Truffle-DSL: fixed the @TypeSystem of child nodes were not checked for equality.
Christian Humer <christian.humer@gmail.com>
parents: 11469
diff changeset
44 abstract static class ErrorNode1 extends ValueNode {
18782
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
45 }
11479
fce94b1d46f0 Truffle-DSL: fixed the @TypeSystem of child nodes were not checked for equality.
Christian Humer <christian.humer@gmail.com>
parents: 11469
diff changeset
46
18782
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
47 @TypeSystem({int.class})
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
48 public static class CastError1 {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
49 @TypeCast(int.class)
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
50 @ExpectError("The provided return type \"String\" does not match expected return type \"int\".%")
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
51 public static String asInteger(Object value) {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
52 return (String) value;
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
53 }
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
54 }
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
55
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
56 @TypeSystem({int.class})
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
57 public static class CastError2 {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
58 @TypeCast(int.class)
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
59 @ExpectError("The provided return type \"boolean\" does not match expected return type \"int\".%")
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
60 public static boolean asInteger(Object value) {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
61 return (boolean) value;
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
62 }
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
63 }
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
64
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
65 @TypeSystem({boolean.class})
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
66 public static class CastError3 {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
67 @ExpectError("The type 'int' is not declared in the @TypeSystem.")
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
68 @TypeCast(int.class)
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
69 public static int asInt(Object value) {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
70 return (int) value;
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
71 }
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
72 }
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
73
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
74 @TypeSystem({int.class})
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
75 public static class CastError4 {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
76 @ExpectError("@TypeCast annotated method asInt must be public and static.")
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
77 @TypeCast(int.class)
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
78 public int asInt(Object value) {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
79 return (int) value;
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
80 }
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
81 }
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
82
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
83 @TypeSystem({int.class})
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
84 public static class CastError5 {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
85 @ExpectError("@TypeCast annotated method asInt must be public and static.")
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
86 @TypeCast(int.class)
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
87 static int asInt(Object value) {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
88 return (int) value;
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
89 }
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
90 }
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
91
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
92 @TypeSystem({boolean.class})
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
93 public static class CheckError1 {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
94 @ExpectError("The type 'int' is not declared in the @TypeSystem.")
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
95 @TypeCheck(int.class)
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
96 public static boolean isInt(Object value) {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
97 return value instanceof Integer;
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
98 }
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
99 }
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
100
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
101 @TypeSystem({int.class})
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
102 public static class CheckError2 {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
103 @ExpectError("@TypeCheck annotated method isInt must be public and static.")
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
104 @TypeCheck(int.class)
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
105 public boolean isInt(Object value) {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
106 return value instanceof Integer;
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
107 }
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
108 }
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
109
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
110 @TypeSystem({int.class})
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
111 public static class CheckError3 {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
112 @ExpectError("@TypeCheck annotated method isInt must be public and static.")
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
113 @TypeCheck(int.class)
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
114 static boolean isInt(Object value) {
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
115 return value instanceof Integer;
3ea386a1036f Truffle-DSL: breaking: @TypeCheck and @TypeCast now require casted/checked type as explicit parameter. Previously the type was parsed from the method name. (GRAAL-446 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 14991
diff changeset
116 }
11479
fce94b1d46f0 Truffle-DSL: fixed the @TypeSystem of child nodes were not checked for equality.
Christian Humer <christian.humer@gmail.com>
parents: 11469
diff changeset
117 }
fce94b1d46f0 Truffle-DSL: fixed the @TypeSystem of child nodes were not checked for equality.
Christian Humer <christian.humer@gmail.com>
parents: 11469
diff changeset
118
11467
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
119 }