Changeset 13503


Ignore:
Timestamp:
Sep 16, 2019 5:06:39 PM (3 months ago)
Author:
mjohnsson
Message:

#5835 Improving the error check and error messages slightly.

Location:
branches/dev-mj-5835/Compiler/ModelicaFlatTree
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-mj-5835/Compiler/ModelicaFlatTree/src/jastadd/ConstantEvaluation/ConstantEvaluation.jrag

    r13502 r13503  
    28062806            formatChar == 'x' || formatChar == 'X' || formatChar == 'u' || formatChar == 'c';
    28072807        if (mustBeInteger && isReal) {
    2808             throw new ConstantEvaluationException(cval, "format the resulting value. The format '"+ format + "' requires value of Integer type but Real is provided ");
     2808            throw new ConstantEvaluationException(cval, "format the resulting value. The format '"+ format + "' requires value of Integer type but Real value is provided. ");
    28092809        }
    28102810
     
    28292829        try {
    28302830            return new CValueString(String.format((Locale) null, format, value));
    2831         } catch (UnknownFormatConversionException e) {
     2831        } catch (java.util.IllegalFormatException e) {
    28322832            throw new ConstantEvaluationException(cval,
    28332833                    "format the resulting value. " + format + " is not a supported valid format string");
    28342834        }
     2835    }
    28352836    }
    28362837    eq FGetInstanceName.cevalCalc(VariableEvaluator evaluator) = new CValueString(calcInstanceName());
  • branches/dev-mj-5835/Compiler/ModelicaFlatTree/test/modelica/EvaluationTests.mo

    r13502 r13503  
    48934893Error at line 3, column 25, in file '...':
    48944894  Could not evaluate binding expression for constant 's': 'String(x, \"3d\")'
    4895     Cannot format the resulting value. The format '%3d' requires value of Integer type but Real is provided CValueReal (1.23456789)
     4895    Cannot format the resulting value. The format '%3d' requires value of Integer type but Real value is provided. CValueReal (1.23456789)
    48964896")})));
    48974897end StringRealformatSpecifier_d;
     
    49244924Error at line 3, column 25, in file '...':
    49254925  Could not evaluate binding expression for constant 's': 'String(x, \"3i\")'
    4926     Cannot format the resulting value. The format '%3i' requires value of Integer type but Real is provided CValueReal (1.23456789)
     4926    Cannot format the resulting value. The format '%3i' requires value of Integer type but Real value is provided. CValueReal (1.23456789)
    49274927")})));
    49284928end StringRealformatSpecifier_i;
     
    49554955Error at line 3, column 25, in file '...':
    49564956  Could not evaluate binding expression for constant 's': 'String(x, \"3o\")'
    4957     Cannot format the resulting value. The format '%3o' requires value of Integer type but Real is provided CValueReal (1.23456789)
     4957    Cannot format the resulting value. The format '%3o' requires value of Integer type but Real value is provided. CValueReal (1.23456789)
    49584958")})));
    49594959end StringRealformatSpecifier_o;
     
    49864986Error at line 3, column 25, in file '...':
    49874987  Could not evaluate binding expression for constant 's': 'String(x, \"3x\")'
    4988     Cannot format the resulting value. The format '%3x' requires value of Integer type but Real is provided CValueReal (1.23456789)
     4988    Cannot format the resulting value. The format '%3x' requires value of Integer type but Real value is provided. CValueReal (1.23456789)
    49894989")})));
    49904990end StringRealformatSpecifier_x;
     
    50175017Error at line 3, column 25, in file '...':
    50185018  Could not evaluate binding expression for constant 's': 'String(x, \"3X\")'
    5019     Cannot format the resulting value. The format '%3X' requires value of Integer type but Real is provided CValueReal (1.23456789)
     5019    Cannot format the resulting value. The format '%3X' requires value of Integer type but Real value is provided. CValueReal (1.23456789)
    50205020")})));
    50215021end StringRealformatSpecifier_X;
     
    50485048Error at line 3, column 25, in file '...':
    50495049  Could not evaluate binding expression for constant 's': 'String(x, \"3u\")'
    5050     Cannot format the resulting value. The format '%3u' requires value of Integer type but Real is provided CValueReal (1.23456789)
     5050    Cannot format the resulting value. The format '%3u' requires value of Integer type but Real value is provided. CValueReal (1.23456789)
    50515051")})));
    50525052end StringRealformatSpecifier_u;
     
    50795079Error at line 3, column 25, in file '...':
    50805080  Could not evaluate binding expression for constant 's': 'String(x, \"3c\")'
    5081     Cannot format the resulting value. The format '%3c' requires value of Integer type but Real is provided CValueReal (1.23456789)
     5081    Cannot format the resulting value. The format '%3c' requires value of Integer type but Real value is provided. CValueReal (1.23456789)
    50825082")})));
    50835083
Note: See TracChangeset for help on using the changeset viewer.