annotate truffle/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TypeSystemErrorsTest.java @ 21951:9c8c0937da41

Moving all sources into truffle subdirectory
author Jaroslav Tulach <jaroslav.tulach@oracle.com>
date Wed, 17 Jun 2015 10:58:08 +0200
parents graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TypeSystemErrorsTest.java@18c0f02fa4d2
children dc83cc1f94f2
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.*;
18783
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
26 import com.oracle.truffle.api.dsl.test.TypeSystemErrorsTest.Types1.Type1;
14991
64dcb92ee75a Truffle: Change signature for Truffle calls from (PackedFrame, Arguments) to (Object[]).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 11479
diff changeset
27 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
28
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
29 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
30
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
31 @TypeSystem({int.class, boolean.class})
18783
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
32 public static class ErrorTypes0 {
11467
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
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
36 @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
37 @TypeSystem({CharSequence.class, String.class})
18783
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
38 public static class ErrorTypes1 {
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
39
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
40 }
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
41
11469
88316d1c4644 Truffle-DSL: preparations for implicit casts
Christian Humer <christian.humer@gmail.com>
parents: 11467
diff changeset
42 public static class Types1 {
18783
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
43 public static class Type1 {
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
44 }
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
45 }
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
46
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
47 public static class Types2 {
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
48 public static class Type1 {
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
49 }
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
50 }
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
51
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
52 // verify boxed type overlay
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
53 @ExpectError("Two types result in the same boxed name: Type1.")
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
54 @TypeSystem({Type1.class, com.oracle.truffle.api.dsl.test.TypeSystemErrorsTest.Types2.Type1.class})
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
55 public static class ErrorTypes2 {
11467
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
56
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
57 }
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
58
18783
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
59 public static class Types3 {
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
60 public static class Object {
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
61 }
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
62 }
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
63
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
64 // verify Object name cannot appear
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
65 @ExpectError("Two types result in the same boxed name: Object.")
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
66 @TypeSystem({com.oracle.truffle.api.dsl.test.TypeSystemErrorsTest.Types3.Object.class})
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
67 public static class ErrorTypes3 {
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
68 }
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
69
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
70 public static class Types4 {
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
71 public static class Integer {
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
72 }
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
73 }
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
74
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
75 // verify int boxed name
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
76 @ExpectError("Two types result in the same boxed name: Integer.")
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
77 @TypeSystem({int.class, com.oracle.truffle.api.dsl.test.TypeSystemErrorsTest.Types4.Integer.class})
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
78 public static class ErrorTypes4 {
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
79 }
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
80
7d67a33e1bbb Truffle-DSL: made type name verification more robust. Added some tests. (GRAAL-468 #resolve)
Christian Humer <christian.humer@gmail.com>
parents: 18782
diff changeset
81 @TypeSystemReference(ErrorTypes0.class)
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
82 @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
83 @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
84 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
85 }
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
86
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
87 @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
88 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
89 @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
90 @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
91 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
92 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
93 }
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 }
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
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 @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
97 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
98 @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
99 @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
100 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
101 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
102 }
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 }
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
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 @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
106 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
107 @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
108 @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
109 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
110 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
111 }
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 }
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
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 @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
115 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
116 @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
117 @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
118 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
119 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
120 }
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
121 }
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
122
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
123 @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
124 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
125 @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
126 @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
127 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
128 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
129 }
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
130 }
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
131
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
132 @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
133 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
134 @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
135 @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
136 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
137 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
138 }
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
139 }
fce94b1d46f0 Truffle-DSL: fixed the @TypeSystem of child nodes were not checked for equality.
Christian Humer <christian.humer@gmail.com>
parents: 11469
diff changeset
140
11467
43eab069ca9b Truffle-DSL: improved error recovery of type systems and improved error testability infrastructure.
Christian Humer <christian.humer@gmail.com>
parents:
diff changeset
141 }