Changeset 13913


Ignore:
Timestamp:
Oct 30, 2019 4:02:16 PM (2 weeks ago)
Author:
molsson
Message:

#5843 Merged non-scalar and non-boolean conditional guard error messages.

Location:
branches/dev-mo-2617/Compiler/ModelicaFrontEnd
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-mo-2617/Compiler/ModelicaFrontEnd/src/jastadd/errorcheck/ErrorCheck.jrag

    r13911 r13913  
    856856                    cond.collectErrors(checkType);
    857857                    if (!cond.type().isUnknown()) {
    858                         if (!cond.type().isScalar()) {
    859                             NON_SCALAR_CONDITIONAL_GUARD.invoke(this);
    860                         }
    861                         if (!cond.type().isBoolean()) {
     858                        if (!cond.type().isScalar() || !cond.type().isBoolean()) {
    862859                            NON_BOOLEAN_CONDITIONAL_GUARD.invoke(this);
    863860                        }
  • branches/dev-mo-2617/Compiler/ModelicaFrontEnd/src/jastadd/errorcheck/TypeCheck.jrag

    r13912 r13913  
    190190            new ErrorProducerUnlessDisabled("ARRAY_SIZE_MISMATCH_IN_MODIFICATION_DUE_TO_EACH", ProblemKind.SEMANTIC,
    191191                    "Array size mismatch in modification of %s, expected size is (due to 'each') %s and size of binding expression is %s");
    192     public static final SimpleProblemProducer ASTNode.NON_SCALAR_CONDITIONAL_GUARD =
    193             new SimpleErrorProducer("NON_SCALAR_CONDITIONAL_GUARD", ProblemKind.SEMANTIC,
    194                     "The guard expression of a conditional component should be a scalar expression");
    195192    public static final SimpleProblemProducer ASTNode.NON_BOOLEAN_CONDITIONAL_GUARD =
    196193            new SimpleErrorProducer("NON_BOOLEAN_CONDITIONAL_GUARD", ProblemKind.SEMANTIC,
    197                     "The guard expression of a conditional component should be a Boolean expression");
     194                    "The guard expression of a conditional component should be a scalar Boolean expression");
    198195    public static final SimpleProblemProducer ASTNode.NON_FIXED_CONDITIONAL_GUARD =
    199196            new SimpleErrorProducer("NON_FIXED_CONDITIONAL_GUARD", ProblemKind.SEMANTIC,
  • branches/dev-mo-2617/Compiler/ModelicaFrontEnd/test/modelica/NameTests.mo

    r13912 r13913  
    30243024
    30253025Error at line 2, column 3, in file '...', NON_BOOLEAN_CONDITIONAL_GUARD:
    3026   The guard expression of a conditional component should be a Boolean expression
     3026  The guard expression of a conditional component should be a scalar Boolean expression
    30273027")})));
    30283028end ConditionalComponentTest1_Err;
     
    30323032  parameter Real x = 1 if b;
    30333033
    3034     annotation(__JModelica(UnitTesting(tests={
    3035         ErrorTestCase(
    3036             name="ConditionalComponentTest2_Err",
    3037             description="Test of type checking of conditional components.",
    3038             errorMessage="
    3039 1 errors found:
    3040 
    3041 Error at line 3, column 3, in file 'Compiler/ModelicaFrontEnd/test/modelica/NameTests.mo', NON_SCALAR_CONDITIONAL_GUARD:
    3042   The guard expression of a conditional component should be a scalar expression
     3034annotation(__JModelica(UnitTesting(tests={
     3035    ErrorTestCase(
     3036        name="ConditionalComponentTest2_Err",
     3037        description="Test of type checking of conditional components.",
     3038        errorMessage="
     3039
     3040
     3041Error at line 3, column 3, in file '...', NON_BOOLEAN_CONDITIONAL_GUARD:
     3042  The guard expression of a conditional component should be a scalar Boolean expression
    30433043")})));
    30443044end ConditionalComponentTest2_Err;
     
    30563056
    30573057Error at line 3, column 3, in file '...', NON_BOOLEAN_CONDITIONAL_GUARD:
    3058   The guard expression of a conditional component should be a Boolean expression
    3059 
    3060 Error at line 3, column 3, in file '...', NON_SCALAR_CONDITIONAL_GUARD:
    3061   The guard expression of a conditional component should be a scalar expression
     3058  The guard expression of a conditional component should be a scalar Boolean expression
    30623059")})));
    30633060end ConditionalComponentTest3_Err;
     
    33973394
    33983395Error at line 7, column 5, in file '...', NON_BOOLEAN_CONDITIONAL_GUARD:
    3399   The guard expression of a conditional component should be a Boolean expression
    3400 
    3401 Error at line 7, column 5, in file '...', NON_SCALAR_CONDITIONAL_GUARD:
    3402   The guard expression of a conditional component should be a scalar expression
     3396  The guard expression of a conditional component should be a scalar Boolean expression
    34033397")})));
    34043398end ConditionalComponentTest15_Err;
Note: See TracChangeset for help on using the changeset viewer.