/***************************************************
 ** @author   STF 487
 ** @version  0.0.1
 ** @purpose  1:5.4.1, verify that error is generated if actual inout parameter doesn't adhere to strong typing rules
 ** @verdict  pass reject
 ***************************************************/

// The following requirement is tested:
// When parameters are passed by reference, strong typing is required. Both the actual and formal
// parameter shall be of the same type.

module NegSem_050401_top_level_003 {

	type component GeneralComp {
	}

    type record R1 {
        integer field1,
        integer field2
    }

    type record R2 {
        integer option1,
        integer option2
    }

	function f(inout R2 p_rec) {
        if (match(p_rec, {1, 2})) { setverdict(pass); }
        else { setverdict(fail, "p_rec value not matching ", p_rec, {1, 2}); }
	}

	testcase TC_NegSem_050401_top_level_003() runs on GeneralComp {
        var R1 v_rec := { field1 := 1, field2 := 2 };
		f(v_rec); // R1 and R2 are compatible types, but not the same. Strong typing requires exactly the same types.
	}

	control{
		execute(TC_NegSem_050401_top_level_003());
	}
}
