You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Implement Eq for Object such that ReturnValue(ReturnValue(Int(10)) would be equal to Int(10) etc. For e.g. that approach taken here.
Add a smart constructor specifically for ReturnValue, say makeReturnValue v, such that if v is already a ReturnValue we simply return v otherwise we return ReturnValue v.
Collapse the ReturnValue when the final output from the evaluator is a ReturnValue.
Note: If these examples are tried in the online interpreter they will display the correct result because of how Display is implemented for Object. Hence, it hides the issue.
The text was updated successfully, but these errors were encountered:
Add the following test cases
to the
test_return_stmt
function insrc/evaluator/mod.rs
to see what I mean.For e.g. the tests fail as follows:
Three possible solutions:
Eq
forObject
such thatReturnValue(ReturnValue(Int(10))
would be equal toInt(10)
etc. For e.g. that approach taken here.ReturnValue
, saymakeReturnValue v
, such that ifv
is already aReturnValue
we simply returnv
otherwise we returnReturnValue v
.ReturnValue
when the final output from the evaluator is aReturnValue
.Note: If these examples are tried in the online interpreter they will display the correct result because of how
Display
is implemented forObject
. Hence, it hides the issue.The text was updated successfully, but these errors were encountered: