This APS code:
function hf(x : Integer; y : Integer) : Boolean begin
q : Integer := x / y;
result := q * y == x;
end;
Gets dumped as:
val v_hf = f_hf _;
def f_hf(v_x : T_Integer, v_y : T_Integer):T_Boolean = {
var v_q : T_Integer = new M__basic_4[ T_Integer](t_Integer).v__op_w(v_x,v_y);
return new M__basic_8[ T_Integer](t_Integer).v__op_00(new M__basic_4[ T_Integer](t_Integer).v__op_r(v_q,v_y),v_x);
throw Evaluation.UndefinedAttributeException("local hf");
}
But getting these type errors because of ==
type mismatch;
found : M_INTEGER
required: C_PHYLUM[basic_implicit.T_Integer]
(which expands to) C_PHYLUM[Int]
return new M__basic_8[ T_Integer](t_Integer).v__op_00(new M__basic_4[ T_Integer](t_Integer).v__op_r(v_q,v_y),v_x);
Because t_Integer is actually val t_Integer = new M_INTEGER("Integer"); and M_INTEGER is not a C_PHYLUM[*]
The work arround is to replace == with <= and >=
function hf(x : Integer; y : Integer) : Boolean begin
q : Integer := x / y;
result := q * y <= x and q * y >= x;
end;
Which gets generated as:
val v_hf = f_hf _;
def f_hf(v_x : T_Integer, v_y : T_Integer):T_Boolean = {
var v_q : T_Integer = new M__basic_4[ T_Integer](t_Integer).v__op_w(v_x,v_y);
return v_and(new M__basic_3[ T_Integer](t_Integer).v__op_z0(new M__basic_4[ T_Integer](t_Integer).v__op_r(v_q,v_y),v_x),new M__basic_3[ T_Integer](t_Integer).v__op_10(new M__basic_4[ T_Integer](t_Integer).v__op_r(v_q,v_y),v_x));
throw Evaluation.UndefinedAttributeException("local hf");
}
And compiles successfully
This APS code:
Gets dumped as:
But getting these type errors because of
==Because
t_Integeris actuallyval t_Integer = new M_INTEGER("Integer");andM_INTEGERis not aC_PHYLUM[*]The work arround is to replace
==with<= and >=Which gets generated as:
And compiles successfully