Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 353676 - Implement conversions between strings and numeric types
Summary: Implement conversions between strings and numeric types
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-08-02 16:44 EDT by Matt Heitz CLA
Modified: 2017-02-23 14:16 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.