Closed m-spitfire closed 1 year ago
I think this is a mistake in the specification document, as there's a test case as follows:
assert_equal (type_check (Or (Int 1, ToBool (Int 2)))) TyError );
Any expression that is not covered by the type rules will have its type derived to TyError
. It doesn't mean that an Or
expression can not have arguments that are of the type TyInt
.
But the given example contradicts the test case. The example says Or (Int, Bool)
should have Bool
result, however the test case says it should have Error
result:
I just have this issue still open so that the given example in the document be updated in the future.
Ah, I see now. The document seems to be wrong in this case. Good find.
Hi Murad. You are right. This is a typo in the document. Let me fix it. Thanks.
Name: Murad Bashirov
Hello. In the given examples of problem 5 there's this case:
But given specification of
Or
says: $$\frac{e_1\colon \texttt{TyBool} \quad e_2\colon \texttt{TyBool}}{\texttt{Or} \hspace{.2777em} e_1 e_2 \colon \texttt{TyBool}}$$ which I interpret as, "the arguments ofOr
can only be boolean", but the example contradicts to this and one argument of it isint
. Is there a mistake in specification or am I understanding it incorrectly?Thanks