The default bug view has changed. See this FAQ.

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

VERIFIED INVALID

Status

Tamarin
Virtual Machine
P3
normal
VERIFIED INVALID
8 years ago
8 years ago

People

(Reporter: Chris Peyer, Assigned: Erik Tierney)

Tracking

(Blocks: 1 bug)

unspecified
flash10.1
x86
All
Dependency tree / graph
Bug Flags:
flashplayer-qrb +
flashplayer-triage +

Details

Attachments

(1 attachment)

(Reporter)

Description

8 years ago
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?
(Reporter)

Comment 1

8 years ago
Created attachment 355469 [details]
Testcase for bug
(Reporter)

Updated

8 years ago
Attachment #355469 - Attachment mime type: application/x-download → text/plain
(Reporter)

Updated

8 years ago
Flags: in-testsuite- → in-testsuite?
(Reporter)

Comment 2

8 years ago
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
(Reporter)

Updated

8 years ago
Component: Tracing Virtual Machine → Virtual Machine
OS: Mac OS X → All
QA Contact: tracing-vm → vm

Updated

8 years ago
Assignee: nobody → tierney
Status: NEW → ASSIGNED
Flags: flashplayer-qrb? → flashplayer-qrb+
Priority: -- → P3
Target Milestone: --- → flash10.x

Updated

8 years ago
Blocks: 479769, 478870
(Assignee)

Comment 3

8 years ago
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
Last Resolved: 8 years ago
Resolution: --- → INVALID
(Reporter)

Comment 4

8 years ago
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 → ---

Updated

8 years ago
Blocks: 481413

Updated

8 years ago
No longer blocks: 478870
(Assignee)

Comment 5

8 years ago
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
Last Resolved: 8 years ago8 years ago
Resolution: --- → INVALID
(Reporter)

Updated

8 years ago
Status: RESOLVED → VERIFIED
(Reporter)

Comment 6

8 years ago
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.