Hello everyone, I just stumbled across something.When I try to query a Long-variable/value whether it is an instance of Arithmetic[Long] or not, the call returns a "false", but it should return "true", if I am not mistaken.
With self-written interfaces or self-written classes implementing the Interface Arithmetic[T] the call returns "true".
The same behaviour occurs for the Interfaces Bitwise[T] and Ordered[T] Comparable[T] seems to work fine (for me). A minimum working example is attached. I tested this with Native X10 only.I am using revision 27689 from the svn-repository (https://svn.code.sourceforge.net/p/x10/code/trunk), as well as gcc-4.8.2.
Do I have a misconception about "instanceof" in X10 or is this a bug? Cheers and thanks in advance for any help, Marco Bungart
public class InstanceOf{ public static def main(args:Rail[String]) { ex:Ex[Long] = new Ex[Long](10); // returning "true": Console.OUT.println(ex instanceof IEx[Long]); var ex2:Ex2 = new Ex2(10); // returning "true": Console.OUT.println(ex2 instanceof Arithmetic[Ex2]); var ex3:Long = 10n; // returning "false": Console.OUT.println(ex3 instanceof Arithmetic[Long]); // returning "false": Console.OUT.println(ex3 instanceof Bitwise[Long]); // returning "false": Console.OUT.println(ex3 instanceof x10.util.Ordered[Long]); // returning "true": Console.OUT.println(ex3 instanceof Comparable[Long]); } } class Ex[T] implements IEx[T] { public val t:T; public def this(t:T) { this.t = t; } public def getT() = t; } interface IEx[T]{ public def getT():T; } class Ex2 implements Arithmetic[Ex2] { public val value:Long; public def this(value:Long) { this.value = value; } public operator this + (that:Ex2) = new Ex2(this.value + that.value); public operator +this = new Ex2(this.value); public operator this - (that:Ex2) = new Ex2(this.value - that.value); public operator -this = new Ex2(-this.value); public operator this * (that:Ex2) = new Ex2(this.value * that.value); public operator this / (that:Ex2) = new Ex2(this.value / that.value); }
------------------------------------------------------------------------------ "Accelerate Dev Cycles with Automated Cross-Browser Testing - For FREE Instantly run your Selenium tests across 300+ browser/OS combos. Get unparalleled scalability from the best Selenium testing platform available Simple to use. Nothing to install. Get started now for free." http://p.sf.net/sfu/SauceLabs
_______________________________________________ X10-users mailing list X10-users@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/x10-users