Potential problem with is<T> method: cannot read property 'resultType' of undefined
brakmic opened this issue · 1 comments
brakmic commented
Describe the bug
While trying to update the morphir-bosque
code I encountered a problem that we've talked about two times already.
It's the error Cannot read property 'resultType' of undefined
.
I have ported the original code into a simpler code file:
namespace NSMain;
typedef Price = Int;
entity OrderPrice {
}
entity Limit provides OrderPrice {
invariant $price >= 0;
field price: Price;
}
function lockinPrice(requestPrice: OrderPrice, marketPrice: Price): Price {
return requestPrice.is<Limit>() ? requestPrice.price : marketPrice;
}
entrypoint function main(): Bool {
let requestPrice = Limit@{price=200};
let marketPrice: Price = 10;
return lockinPrice(requestPrice, marketPrice) < ((marketPrice * 9) / 10);
}
The problem has something to do with the is<T>
method from the lockinPrice function, if I am not mistaken. And I have also tried various tricks you mentioned in the two other issues. However, the error still persists.
brakmic commented
My bad! It seems that my demo code is getting compiled. The error was that I used "entity" for OrderPrice instead of "concept".
However, the original code still doesn't compile.
So the error is somewhere else. Will close this issue then.