Ignore:
Timestamp:
Oct 31, 2019 2:22:32 PM (5 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/test/modelica/NameTests.mo

    r13456 r13922  
    30163016  parameter Real x = 1 if 1;
    30173017
    3018     annotation(__JModelica(UnitTesting(tests={
    3019         ErrorTestCase(
    3020             name="ConditionalComponentTest1_Err",
    3021             description="Test of type checking of conditional components.",
    3022             errorMessage="
    3023 1 errors found:
    3024 
    3025 Error at line 2, column 3, in file 'Compiler/ModelicaFrontEnd/test/modelica/NameTests.mo', NON_BOOLEAN_CONDITIONAL_GUARD:
    3026   The guard expression of a conditional component should be a boolean expression
     3018annotation(__JModelica(UnitTesting(tests={
     3019    ErrorTestCase(
     3020        name="ConditionalComponentTest1_Err",
     3021        description="Test of type checking of conditional components.",
     3022        errorMessage="
     3023
     3024
     3025Error at line 2, column 3, in file '...', NON_BOOLEAN_CONDITIONAL_GUARD:
     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;
     
    30483048  parameter Real x = 1 if b;
    30493049
    3050     annotation(__JModelica(UnitTesting(tests={
    3051         ErrorTestCase(
    3052             name="ConditionalComponentTest3_Err",
    3053             description="Test of type checking of conditional components.",
    3054             errorMessage="
    3055 2 errors found:
    3056 
    3057 Error at line 3, column 3, in file 'Compiler/ModelicaFrontEnd/test/modelica/NameTests.mo', 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 'Compiler/ModelicaFrontEnd/test/modelica/NameTests.mo', NON_SCALAR_CONDITIONAL_GUARD:
    3061   The guard expression of a conditional component should be a scalar expression
     3050annotation(__JModelica(UnitTesting(tests={
     3051    ErrorTestCase(
     3052        name="ConditionalComponentTest3_Err",
     3053        description="Test of type checking of conditional components.",
     3054        errorMessage="
     3055
     3056
     3057Error at line 3, column 3, in file '...', NON_BOOLEAN_CONDITIONAL_GUARD:
     3058  The guard expression of a conditional component should be a scalar Boolean expression
    30623059")})));
    30633060end ConditionalComponentTest3_Err;
     
    31473144            flatModel="
    31483145fclass NameTests.ConditionalComponentTest8
    3149  parameter Boolean b = false /* false */;
     3146 structural parameter Boolean b = false /* false */;
    31503147
    31513148end NameTests.ConditionalComponentTest8;
     
    31783175            flatModel="
    31793176fclass NameTests.ConditionalComponentTest9
    3180  parameter Boolean b = false /* false */;
     3177 structural parameter Boolean b = false /* false */;
    31813178
    31823179end NameTests.ConditionalComponentTest9;
     
    33803377")})));
    33813378end ConditionalComponentTest14;
     3379
     3380
     3381model ConditionalComponentTest15_Err
     3382    connector C
     3383        Real x;
     3384    end C;
     3385   
     3386    parameter Integer b[2] = {1,1};
     3387    C c if b;
     3388annotation(__JModelica(UnitTesting(tests={
     3389    ErrorTestCase(
     3390        name="ConditionalComponentTest15_Err",
     3391        description="Test of type checking of conditional composite component.",
     3392        errorMessage="
     3393
     3394
     3395Error at line 7, column 5, in file '...', NON_BOOLEAN_CONDITIONAL_GUARD:
     3396  The guard expression of a conditional component should be a scalar Boolean expression
     3397")})));
     3398end ConditionalComponentTest15_Err;
     3399
     3400
     3401model ConditionalComponentTest16
     3402    connector C
     3403        Real x;
     3404    end C;
     3405   
     3406    parameter Boolean b = false;
     3407    C c if b;
     3408annotation(__JModelica(UnitTesting(tests={
     3409    FlatteningTestCase(
     3410        description="Flattening conditional composite component",
     3411        flatModel="
     3412fclass NameTests.ConditionalComponentTest16
     3413 structural parameter Boolean b = false /* false */;
     3414end NameTests.ConditionalComponentTest16;
     3415")})));
     3416end ConditionalComponentTest16;
     3417
     3418
     3419model ConditionalComponentTest17
     3420    connector C
     3421        Real x;
     3422    end C;
     3423   
     3424    parameter Boolean b = true;
     3425    C c if b;
     3426annotation(__JModelica(UnitTesting(tests={
     3427    FlatteningTestCase(
     3428        description="Flattening conditional composite component",
     3429        flatModel="
     3430fclass NameTests.ConditionalComponentTest17
     3431 structural parameter Boolean b = true /* true */;
     3432 potential Real c.x;
     3433end NameTests.ConditionalComponentTest17;
     3434")})));
     3435end ConditionalComponentTest17;
     3436
     3437
    33823438
    33833439model AttributeDot1
Note: See TracChangeset for help on using the changeset viewer.