Closed Bug 472207 Opened 15 years ago Closed 15 years ago

Vector.splice does not work for non-string vectors.

Categories

(Tamarin Graveyard :: Virtual Machine, defect, P3)

x86
All
defect

Tracking

(Not tracked)

VERIFIED INVALID
flash10.1

People

(Reporter: cpeyer, Assigned: tierney)

References

Details

Attachments

(1 file)

Unexpected results when using vector.splice on int or a user defined class.

Run the attached bug file.

Actual:
HEllo,Bye,cya,Hi
1,0,3
TypeError: Error #1034: Type Coercion failed: cannot convert __AS3__.vec::Vector.<t.as$1::Rectangle>@102c821 to t.as$1.Rectangle.
	at Vector$object/_spliceHelper()
	at Vector$object/_splice()
	at <anonymous>()
	at t.as$1:tryRectangle()[t.as:54]
	at global$init()[t.as:61]

Expected:
HEllo,Bye,cya,Hi
1,5,6,3
[object Rectangle],[object Rectangle],[object Rectangle],[object Rectangle]
Flags: in-testsuite-
Flags: flashplayer-triage+
Flags: flashplayer-qrb?
Attached file Testcase for bug
Attachment #355469 - Attachment mime type: application/x-download → text/plain
Flags: in-testsuite- → in-testsuite?
Here's an excerpt of the int sample:

  var vs:Vector.<int> = new Vector.<int>;
  
  vs.push(1);
  vs.push(2);
  vs.push(3);
  
  var nvs:Vector.<int> = new Vector.<int>;
  
  nvs.push(5);
  nvs.push(6);
  vs.splice(1, 1, nvs);
  
  trace(vs);

actual: 1,0,3
expected 1,5,6,3
Component: Tracing Virtual Machine → Virtual Machine
OS: Mac OS X → All
QA Contact: tracing-vm → vm
Assignee: nobody → tierney
Status: NEW → ASSIGNED
Flags: flashplayer-qrb? → flashplayer-qrb+
Priority: -- → P3
Target Milestone: --- → flash10.x
This is working as expected.  Splice takes a rest argument that contains the items to insert into the Vector - it does not do any "expansion" or anything of those items.  The int case produces 0, becuase anything can be converted to a number (though the result is almost always NaN, or 0 for int since int doesn't have NaN).
Status: ASSIGNED → RESOLVED
Closed: 15 years ago
Resolution: --- → INVALID
According to the documentation for vector.splice:

	... items — An optional list of one or more comma-separated values, or a Vector, to insert into the Vector at the position specified in the startIndex parameter.

This seems to clearly indicate that a Vector is an acceptable parameter.
Status: RESOLVED → REOPENED
Resolution: INVALID → ---
Blocks: 481413
No longer blocks: 478870
The documentation is wrong - it was copied from Array.splice where this sort of works, but not in the way you expect.  I believe there is already a doc bug on this internally.
Status: REOPENED → RESOLVED
Closed: 15 years ago15 years ago
Resolution: --- → INVALID
Status: RESOLVED → VERIFIED
Test media not required as this is an invalid bug.  Also verified that documentation for Argo has been updated (Vector language has been removed):

http://river.corp.adobe.com:81/Flash_Argo/standalone/langref/Vector.html#splice%28%29
Flags: in-testsuite?
You need to log in before you can comment on or make changes to this bug.