Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 353676

Summary: Implement conversions between strings and numeric types
Product: z_Archived Reporter: Matt Heitz <mheitz>
Component: EDTAssignee: Project Inbox <edt.mofmodel-inbox>
Status: CLOSED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: jeffdouglas
Version: unspecified   
Target Milestone: ---   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Matt Heitz CLA 2011-08-02 16:44:57 EDT
Implement conversions from string to numeric types
Comment 1 Matt Heitz CLA 2011-08-02 16:48:09 EDT
Implement conversions between strings and numeric types
Comment 2 Jeff Douglas CLA 2011-08-15 10:54:05 EDT
done
Comment 3 Jeff Douglas CLA 2011-08-15 11:05:18 EDT
There is a problem with this type of statement:

asmallint = astring + asmallint;


this java code gets generated:

asmallint = ESmallint.asSmallint(((astring) + ESmallint.ezeBox(asmallint)));


the ezeBox is returning a ESmallint object and when this gets concatenated to the string variable, the name of the class is the data part.

either the boxing should not occur, or an unbox needs to be done after the boxing.

i believe this might be a definition problem in the narrowing/expanding options in the egl setup tables for the types.
Comment 4 Jeff Douglas CLA 2011-08-15 11:55:46 EDT
Paul. Matt and I discussed this at length and the problem in the in getOperation method of makeCompatible for Binary expressions.

When the lhs type is string and the rhs is a numeric type, this logic is causing the rhs to be converted to eglany, when it should be converted to a string instead

	public static void makeCompatible(BinaryExpression expr, Type type1, Type type2) {
		Operation op = expr.getOperation();
		Expression asExpr;
		Type parmType1 = op.getParameters().get(0).getType();
		Type parmType2 = op.getParameters().get(1).getType();
Comment 5 Jeff Douglas CLA 2011-08-15 13:12:39 EDT
Ignore the last comment Paul.

By coding the toString classes in the runtime, this seems to work.
Comment 6 Matt Heitz CLA 2011-09-08 13:56:45 EDT
Closing.