Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 356528 - Need validation error on the array access of [2,1] as only [2][1] is valid
Summary: Need validation error on the array access of [2,1] as only [2][1] is valid
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P1 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 356530 357530 (view as bug list)
Depends on:
Blocks:
 
Reported: 2011-09-01 16:54 EDT by broy2 CLA
Modified: 2017-02-23 14:17 EST (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description broy2 CLA 2011-09-01 16:54:42 EDT
Build Identifier: 20110901

Generated Java has error: 
The method asAny(EglList<String>) is undefined for the type EglAny

program javaError type BasicProgram {}	
	my2Dimension  string[][] = [["State"],["Caroling","Duke"]];
	myString string;	
	function main()
		myString = my2Dimension[2,2];
		sysLib.writeStdout(myString);
	end	
end

Reproducible: Always
Comment 1 Matt Heitz CLA 2011-09-02 10:44:53 EDT
"Caroling"?  You can't stand to type "Carolina"?
Comment 2 broy2 CLA 2011-09-02 15:31:08 EDT
You got that right.  But I'm trying since our kid graduated from there.
Comment 3 Jeff Douglas CLA 2011-09-14 13:42:51 EDT
This error in in the IR generation instead. I am redirecting this to Paul.

For this EGL,

my2Dimension  string[][] = [["State"],["Caroling","Duke"]];
myString string;    
myString = my2Dimension[2,1];




This IR statement is generated. Notice that there is only 1 ArrayAccess expression with 1 integer variable. It is leaving out the 1st variable reference altogether.

			<statements ID="7" eClass="org.eclipse.edt.mof.egl.AssignmentStatement" >
				<annotations ID="8" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:29" off="i:163" line="i:8" />
				<container IDREF="4"/>
				<expr ID="9" eClass="org.eclipse.edt.mof.egl.Assignment" operator="=" >
					<annotations ID="10" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:28" off="i:163" line="i:8" />
					<LHS ID="11" eClass="org.eclipse.edt.mof.egl.MemberName" id="myString" >
						<annotations ID="12" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:8" off="i:163" line="i:8" />
						<member IDREF="13"/>
					</LHS>
					<RHS ID="14" eClass="org.eclipse.edt.mof.egl.ArrayAccess" >
						<annotations ID="15" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:17" off="i:174" line="i:8" />
						<array ID="16" eClass="org.eclipse.edt.mof.egl.MemberName" id="my2Dimension" >
							<annotations ID="17" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:12" off="i:174" line="i:8" />
							<member IDREF="18"/>
						</array>
						<index ID="19" eClass="org.eclipse.edt.mof.egl.AsExpression" eType="egl:eglx.lang.eint" >
							<annotations ID="20" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:1" off="i:189" line="i:8" />
							<objectExpr ID="21" eClass="org.eclipse.edt.mof.egl.IntegerLiteral" value="2" isNegated="false" >
								<annotations ID="20" eClass="dynMof:org.eclipse.edt.mof.egl.Annotation:EGL_Location" len="i:1" off="i:189" line="i:8" />
							</objectExpr>
						</index>
					</RHS>
				</expr>
			</statements>
Comment 4 Jeff Douglas CLA 2011-09-14 13:45:58 EDT
*** Bug 356530 has been marked as a duplicate of this bug. ***
Comment 5 Jeff Douglas CLA 2011-09-14 14:14:05 EDT
*** Bug 357530 has been marked as a duplicate of this bug. ***
Comment 6 Jeff Douglas CLA 2011-09-14 15:36:21 EDT
I talked with Tim on this and the syntax is invalid. Paul you need to validate out the array access of [2,1] as only [2][1] is valid.

As for the testcase, please change the access to use one set of [] for each array dimension.
Comment 7 Paul Harmon CLA 2011-10-26 16:28:41 EDT
I have added the validation
Comment 8 broy2 CLA 2011-11-01 13:26:02 EDT
Verified in 20111101 build.