Mercurial > hg > graal-compiler
comparison graal/com.oracle.truffle.api.dsl.test/src/com/oracle/truffle/api/dsl/test/TypeSystemTest.java @ 18221:2c68474cc893
Truffle: add a test to track an ImplicitCast bug
author | Benoit Daloze <benoit.daloze@jku.at> |
---|---|
date | Fri, 31 Oct 2014 10:44:05 +0100 |
parents | c5db657d93c1 |
children | 59953a46c56f |
comparison
equal
deleted
inserted
replaced
18220:890d284b2771 | 18221:2c68474cc893 |
---|---|
30 import com.oracle.truffle.api.nodes.*; | 30 import com.oracle.truffle.api.nodes.*; |
31 import com.oracle.truffle.api.source.*; | 31 import com.oracle.truffle.api.source.*; |
32 | 32 |
33 public class TypeSystemTest { | 33 public class TypeSystemTest { |
34 | 34 |
35 @TypeSystem({int.class, double.class, boolean.class, BigInteger.class, String.class, CallTarget.class, BExtendsAbstract.class, CExtendsAbstract.class, Abstract.class, Interface.class, | 35 @TypeSystem({int.class, long.class, double.class, boolean.class, BigInteger.class, String.class, CallTarget.class, BExtendsAbstract.class, CExtendsAbstract.class, Abstract.class, Interface.class, |
36 Object[].class}) | 36 Object[].class}) |
37 static class SimpleTypes { | 37 static class SimpleTypes { |
38 | 38 |
39 static int intCheck; | 39 static int intCheck; |
40 static int intCast; | 40 static int intCast; |
55 public double castDouble(int value) { | 55 public double castDouble(int value) { |
56 return value; | 56 return value; |
57 } | 57 } |
58 | 58 |
59 @ImplicitCast | 59 @ImplicitCast |
60 public long castLong(int value) { | |
61 return value; | |
62 } | |
63 | |
64 @ImplicitCast | |
60 public BigInteger castBigInteger(int value) { | 65 public BigInteger castBigInteger(int value) { |
61 return BigInteger.valueOf(value); | 66 return BigInteger.valueOf(value); |
62 } | 67 } |
63 | 68 |
64 } | 69 } |
74 super(sourceSection); | 79 super(sourceSection); |
75 } | 80 } |
76 | 81 |
77 public int executeInt(VirtualFrame frame) throws UnexpectedResultException { | 82 public int executeInt(VirtualFrame frame) throws UnexpectedResultException { |
78 return SimpleTypesGen.SIMPLETYPES.expectInteger(execute(frame)); | 83 return SimpleTypesGen.SIMPLETYPES.expectInteger(execute(frame)); |
84 } | |
85 | |
86 public long executeLong(VirtualFrame frame) throws UnexpectedResultException { | |
87 return SimpleTypesGen.SIMPLETYPES.expectLong(execute(frame)); | |
79 } | 88 } |
80 | 89 |
81 public String executeString(VirtualFrame frame) throws UnexpectedResultException { | 90 public String executeString(VirtualFrame frame) throws UnexpectedResultException { |
82 return SimpleTypesGen.SIMPLETYPES.expectString(execute(frame)); | 91 return SimpleTypesGen.SIMPLETYPES.expectString(execute(frame)); |
83 } | 92 } |