Opened 3 years ago

Last modified 3 years ago

#5348 assigned defect

Circularity check for non-primitives

Reported by: Jonathan Kämpe Owned by: Jonathan Kämpe
Priority: major Milestone:
Component: Modelica/FrontEnd Version: trunk
Keywords: Cc:

Description (last modified by Jonathan Kämpe)

The circularity check for components is only implemented for primitives. Here are some models that should give error messages but give exceptions instead:

model Test2
    model M
        parameter Integer n;
    end M;
    
    M[m[1].n] m(each n = 3);

end Test2;

model Test3
    record M
        parameter Integer n;
    end M;
    
    M[m[1].n] m(each n = 3);

end Test3;

model Test4
    // Works, improve error message
    record M
        constant Integer n1;
        constant Integer n2;
    end M;
    
    M m = M(m.n2, m.n1);
end Test4;

model Test5
    record M
        constant Integer n1;
        constant Integer n2;
    end M;
    
    function f
        input M m;
        output Integer y = m.n1;
    algorithm
    end f;
    
    M m1 = M(m1.n2, f(m2));
    M m2 = m1;
end Test5;

Here's a model that gives exception when processed as a unit test, but not as a regular compilation:

    type A = enumeration(a1, a2);
    
    record B
        A a;
    end B;
    
    model C
        constant B b = B(A.a1);
    end C;
    
    model D
        extends C (b = b);
    end D;
    
    D d;

Change History (1)

comment:1 Changed 3 years ago by Jonathan Kämpe

Description: modified (diff)
Note: See TracTickets for help on using tickets.