| 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 |
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
Aug 15, 2011
I now automatically map to Dynamic on haxe svn. See if this works for you.
Status:
Fixed
|