Opened 10 years ago

Closed 9 years ago

Last modified 9 years ago

#2974 closed defect (fixed)

Insufficient type checking for polymorphic tuples

Reported by: Per Östlund Owned by: Martin Sjölund
Priority: normal Milestone: 1.9.4
Component: MetaModelica Version: trunk
Keywords: Cc:

Description

The following program segfaults when test is called:

package P
  replaceable type T1 subtypeof Any;
  replaceable type T2 subtypeof Any;
  type Tup = tuple<T1, T2>;

  function f
    input Tup inTup;
  protected
    T1 t1;
    T2 t2;
  algorithm
    (t1, t2) := inTup;
    print("t1 = " + anyString(t1) + "\n");
    print("t2 = " + anyString(t2) + "\n");
  end f;

  function f2
    input Tup inTup;
  protected
    T1 t1;
  algorithm
    (t1, _) := inTup;
    f(t1);  // *** Calling f with wrong type ***
  end f2;
end P;

function test
protected
  tuple<Integer, String> tup = (3, "test");
algorithm
  P.f2(tup);
end test;

Change History (3)

comment:1 by Martin Sjölund, 9 years ago

Milestone: Future1.9.4
Resolution: fixed
Status: newclosed

Fixed in 01fdb3e

comment:2 by Martin Sjölund, 9 years ago

Milestone: 1.9.41.9.4-1.9.x

Milestone renamed

comment:3 by Martin Sjölund, 9 years ago

Milestone: 1.9.4-1.9.x1.9.4

Milestone renamed

Note: See TracTickets for help on using tickets.