Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 363990 - JS: AS operator not casting from index of any[] into record during assignment
Summary: JS: AS operator not casting from index of any[] into record during assignment
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 critical (vote)
Target Milestone: ---   Edit
Assignee: Huang Ji Yong CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-16 20:45 EST by Will Smythe CLA
Modified: 2017-02-23 14:18 EST (History)
3 users (show)

See Also:


Attachments
RUI handler demonstrating the problem (2.33 KB, application/octet-stream)
2011-11-16 20:45 EST, Will Smythe CLA
no flags Details
fix (2.38 KB, patch)
2011-11-17 01:37 EST, Huang Ji Yong CLA
lasher: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Will Smythe CLA 2011-11-16 20:45:06 EST
Created attachment 207120 [details]
RUI handler demonstrating the problem

I thought this defect was already known, but can't find it. 

The issue can be seen in the attached handler code. I am doing a fairly simple cast from the selected row in a grid (grid.getSelection(), which returns an any[]) into a concrete record type (Customer). Although debug shows the array returned by getSelection() is correct, I cannot assign this any into a Customer.

Here is an example of the problem:
	sels any[] = grid.getSelection(); // in debug, sels[] correct contains the selected Customer record
    	c1 Customer = sels[1] as Customer; // c1 is an empty record (PROBLEM) - fields never getting assigned any values
Comment 1 Huang Ji Yong CLA 2011-11-17 01:37:22 EST
Created attachment 207126 [details]
fix
Comment 2 Huang Ji Yong CLA 2011-11-17 01:38:40 EST
Change ArrayTypeTemplate to fix array to any type array conversion
Comment 3 Will Smythe CLA 2011-11-17 21:06:55 EST
Looks good.