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 123: Array<Dynamic> as method arg silently ignores (and creates new) passed typed Arrays.
1 person starred this issue and may be notified of changes. Back to list
Status:  Fixed
Owner:  ----
Closed:  Aug 2011


 
Reported by dionjw, Jun 2, 2011
What steps will reproduce the problem?

Complete program illustrating the problem:
package ;

class Demo 
{
	var _someArr :Array<Int>;
	
	function addToArr (x :Int, arr :Array<Dynamic>) :Void
	{
		arr.push(x);
	}
	
	function addToArrTyped (x :Int, arr :Array<Int>) :Void
	{
		arr.push(x);
	}
	
	public function new() 
	{
		_someArr = [];
		trace('_someArr=' + _someArr);
		trace("adding 2 to untyped");
		addToArr(2, _someArr);
		trace('_someArr=' + _someArr);
		
		trace("adding 2 to typed");
		addToArrTyped(2, _someArr);
		trace('_someArr=' + _someArr);
	}
	
	public static function main() 
	{
		nme.Lib.create(function(){new Demo();},640,480,60,0xccccff,(1*nme.Lib.HARDWARE) | nme.Lib.RESIZABLE);
	}
}



What is the expected output? What do you see instead?
Expected:
Demo.hx:34: _someArr=[]
Demo.hx:35: adding 2 to untyped
Demo.hx:37: _someArr=[2]
Demo.hx:39: adding 2 to typed
Demo.hx:41: _someArr=[2 2]

Actual:
Demo.hx:34: _someArr=[]
Demo.hx:35: adding 2 to untyped
Demo.hx:37: _someArr=[]
Demo.hx:39: adding 2 to typed
Demo.hx:41: _someArr=[2]

What version of the product are you using? On what operating system?
All latest versions as of today:
hxcpp r321.
haxe binary and std r3821
mac Darwin Kernel Version 10.7.0

Please provide any additional information below.


Aug 10, 2011
Project Member #1 gameh...@gmail.com
Hi,
The generalization of "Array<X>" in hxcpp is not "Array<Dynamic>" but in fact "Dynamic".
I will see what I can do about getting an error message for this.

Aug 15, 2011
Project Member #2 gameh...@gmail.com
I now automatically map to Dynamic on haxe svn.  See if this works for you.
Status: Fixed

Powered by Google Project Hosting