Opened 19 months ago

#5599 new defect

Wrong lookup from redeclared class

Reported by: Jesper Mattsson Owned by: Jesper Mattsson
Priority: major Milestone:
Component: Modelica/FrontEnd Version: trunk
Keywords: Cc:

Description

When looking up a class access from a redeclared class (but not a component instance of such a class), the lookup goes up from the replaceable class, and can thus find the wrong target, if it is present there as well.

Example, where the version of D with "x + 1" is used instead of the one with "x + 2".

model Test
    package A
        package F
            replaceable function B
                input Real x;
                output Real y;
            end B;
        end F;
        
        function D
            input Real x;
            output Real y;
        algorithm
            y := x + 1;
        end D;
    end A;
    
    package C
        function D
            input Real x;
            output Real y;
        algorithm
            y := x + 2;
        end D;
        
        package E
            extends A.F;
            redeclare function B
                extends D;
            end B;
        end E;
    end C;

    Real x = C.E.B(time);
end Test;

Change History (0)

Note: See TracTickets for help on using tickets.