Ignore:
Timestamp:
Oct 31, 2019 2:22:32 PM (6 weeks ago)
Author:
molsson
Message:

Merged revision(s) 13898-13913 from branches/dev-mo-2617:
#5843 Moved type checking of conditional attributes so that it is always done.
........
#5843 Conditional attribute requires variability fixed parameter or less.
........
#5843 Updated error message NON_BOOLEAN_CONDITIONAL_GUARD to say Boolean instead of boolean.
........
#5843 Merged non-scalar and non-boolean conditional guard error messages.
........

Location:
branches/dev-mo-2530
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/dev-mo-2530

  • branches/dev-mo-2530/Compiler/ModelicaFrontEnd/src/jastadd/errorcheck/TypeCheck.jrag

    r13396 r13922  
    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,
    200197                    "The guard expression of a conditional component should have parameter or constant variability");
    201198
     199    @Override
    202200    public void InstAssignable.typeCheck(ErrorCheckType checkType) {
    203201        FExp bexp = myBindingInstExp();
     
    262260                        typeCheckCell(expected, actual, bexp, unknownAllowed);
    263261                    }
    264                 }
    265             }
    266         }
    267        
    268         if (hasConditionalAttribute()) {
    269             FExp cond = getConditionalAttribute();
    270             if (!cond.type().isUnknown()) {
    271                 if (!cond.type().isScalar())
    272                     NON_SCALAR_CONDITIONAL_GUARD.invoke(this);
    273                 if (!cond.type().isBoolean())
    274                     NON_BOOLEAN_CONDITIONAL_GUARD.invoke(this);
    275                 if (!cond.variability().parameterOrLess()) {
    276                     NON_FIXED_CONDITIONAL_GUARD.invoke(this);
    277                 } else {
    278                     cond.markAsStructuralParameter(checkType);
    279262                }
    280263            }
Note: See TracChangeset for help on using the changeset viewer.