comparison graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/ImplicitCastTest.java @ 18758:3912400fc33a

Truffle-DSL: remove type system singleton
author Christian Humer <christian.humer@gmail.com>
date Mon, 29 Dec 2014 23:38:42 +0100
parents 5148aab962af
children 93016f2f3f16
comparison
equal deleted inserted replaced
18757:0ec5f5a2e720 18758:3912400fc33a
36 36
37 @TypeSystem({int.class, String.class, boolean.class}) 37 @TypeSystem({int.class, String.class, boolean.class})
38 static class ImplicitCast0Types { 38 static class ImplicitCast0Types {
39 39
40 @ImplicitCast 40 @ImplicitCast
41 boolean castInt(int intvalue) { 41 static boolean castInt(int intvalue) {
42 return intvalue == 1 ? true : false; 42 return intvalue == 1 ? true : false;
43 } 43 }
44 44
45 @ImplicitCast 45 @ImplicitCast
46 boolean castString(String strvalue) { 46 static boolean castString(String strvalue) {
47 return strvalue.equals("1"); 47 return strvalue.equals("1");
48 } 48 }
49 49
50 } 50 }
51 51
158 @TypeSystem({String.class, boolean.class}) 158 @TypeSystem({String.class, boolean.class})
159 static class ImplicitCastError1 { 159 static class ImplicitCastError1 {
160 160
161 @ImplicitCast 161 @ImplicitCast
162 @ExpectError("Target type and source type of an @ImplicitCast must not be the same type.") 162 @ExpectError("Target type and source type of an @ImplicitCast must not be the same type.")
163 String castInvalid(@SuppressWarnings("unused") String value) { 163 static String castInvalid(@SuppressWarnings("unused") String value) {
164 throw new AssertionError(); 164 throw new AssertionError();
165 } 165 }
166 166
167 } 167 }
168 168