Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 363013 - Int can be a bool expression?
Summary: Int can be a bool expression?
Status: CLOSED FIXED
Alias: None
Product: z_Archived
Classification: Eclipse Foundation
Component: EDT (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-11-07 01:22 EST by fahua jin CLA
Modified: 2017-02-23 14:19 EST (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description fahua jin CLA 2011-11-07 01:22:33 EST
Build Identifier: 0.7.0.v201111060901

I have following statements in the EGL program, the returned type of function daysDifferent is int. But our EGL compiler does not prompt any error information. If generate the code to Java, then the Java program has error compilation message; If generate the code to JavaScript, then it prints true.

        amon date = "01/01/2011";
        curDate date;
        if(amon.daysDifferent(curDate))
            syslib.writeStdout("true");
        else
            syslib.writeStdout("false");
        end

Reproducible: Always
Comment 1 fahua jin CLA 2011-11-07 01:23:24 EST
The error message for the generated Java program.

Description	Resource	Path	Location	Type
Cannot cast from int to boolean	Test2.java	/org.eclipse.edt.egl.mvc.test/generatedJava/server	line 39	Java Problem
Comment 2 Paul Harmon CLA 2011-11-07 08:54:42 EST
I have updated the following validators to prevent this:

CaseStatementValidator
IfStatementValidator
WhileStatementValidator
Comment 3 Brian Svihovec CLA 2011-11-07 08:57:07 EST
Paul,

Is there a .egl file in our system types that would indicate the lack of support for this conversion?
Comment 4 Paul Harmon CLA 2011-11-07 09:06:18 EST
You can look at EBoolean.egl (which does not contain any conversion operations), and EInt.egl, which does not contain any conversion operation that takes an EBoolean.
Comment 5 fahua jin CLA 2011-11-07 21:15:11 EST
Verified in 0.7.0.v201111060901.
Comment 6 fahua jin CLA 2011-11-07 21:16:15 EST
(In reply to comment #5)
> Verified in 0.7.0.v201111060901.

Wrong version submit, it should be 0.7.0.v201111071403