Opened 13 years ago
Closed 13 years ago
#1844 closed defect (fixed)
Incorrect Type Unboxing (?) when calling funargs in if expressions
| Reported by: | Owned by: | Martin Sjölund | |
|---|---|---|---|
| Priority: | high | Milestone: | 1.9.0 |
| Component: | Frontend | Version: | trunk |
| Keywords: | Cc: |
Description
The call to predicate in this code throws Error: Type error in conditional ( predicate(#(i))). Expected Boolean, got #Boolean (in component: <NO COMPONENT>).. Using anything other than an if expression seems to work properly (inside if statement, plain call), and calling constTrue directly in the if expression instead of the funarg also works.
package Test
function f
input Predicate predicate;
input Integer i;
output Integer r;
protected
partial function Predicate
input Integer value;
output Boolean result;
end Predicate;
algorithm
r := if predicate(i) then 1 else 2;
end f;
function constTrue
input Integer x;
output Boolean t;
algorithm
t := true;
end constTrue;
function test
algorithm
f(constTrue, 0);
end test;
end Test;
Change History (2)
comment:1 by , 13 years ago
| Owner: | changed from to |
|---|---|
| Status: | new → accepted |
comment:2 by , 13 years ago
| Component: | Backend → Frontend |
|---|---|
| Resolution: | → fixed |
| Status: | accepted → closed |
Note:
See TracTickets
for help on using tickets.

Fixed in r13076.