My favorites | Sign in
Project Home Wiki Issues Source
READ-ONLY: This project has been archived. For more information see this post.
Search
for
  Advanced search   Search tips   Subscriptions
Issue 98: Std.is(comeclass, SomeInterface) always returns true, even when the instance does not implement the interface.
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  May 2011


 
Reported by dionjw, Mar 11, 2011
What steps will reproduce the problem?
class TestStdIs
{
	public function new () {}
	
	public static function main () :Void
	{
	    var foo = new Foo();
		trace(Std.is(foo, Foo)); //true
		trace(Std.is(foo, IFoo)); //true
		trace(Std.is(foo, IBar)); //true .....???????
		trace(Std.is(foo, String)); //false
	}
}

class Foo implements IFoo
{
	public function new ()
	{
	    
	}
	
	public function foo() :Void
	{
	}
}

interface IFoo
{
	function foo() :Void;
}
interface IBar
{
	function bar() :Void;
}

What is the expected output? What do you see instead?
Expected:
true
true
false
false

What I see:
true
true
true
false

What version of the product are you using? On what operating system?
haxe 2.07
hxcpp Version: 2.07.0
OS: OSX Darwin Kernel Version 10.6.0

Please provide any additional information below.


Mar 11, 2011
#1 dionjw
trace(Type.getClassName(IFoo)); //traces: Dynamic

This is why Std.is(instance, IBar) always returns true.  Is this expected behaviour for the cpp target?  Is this mentioned anywhere?  (I'm totally new to C++).
Mar 15, 2011
Project Member #2 gameh...@gmail.com
Yes, this seems to be a problem.  I have have a look.
Hugh
Status: Accepted
May 4, 2011
Project Member #3 gameh...@gmail.com
(No comment was entered for this change.)
Status: Fixed
May 4, 2011
#4 dionjw
I just tested this after updating to the latest version of hxcpp, and
it still doesn't work.  There's no __rtti field on interfaces.

Powered by Google Project Hosting