From ce3bed4c959a70d2ff5a9531b90d5187f25f2b49 Mon Sep 17 00:00:00 2001 From: Aron <arostr-5@student.ltu.se> Date: Wed, 13 Nov 2019 11:11:41 +0100 Subject: [PATCH] had bug with typechecker, now resolved, updated code example, had typ check error, hehe... --- HOME_EXAM.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/HOME_EXAM.md b/HOME_EXAM.md index abd3afc..78a8f24 100644 --- a/HOME_EXAM.md +++ b/HOME_EXAM.md @@ -473,7 +473,7 @@ As previously mentioned, let assignment are unique declerations. Thus, the same ``` ```rust -x = 1; +x = (1 + 1) * 3; ``` ### Assignment bool ```math @@ -481,7 +481,7 @@ x = 1; ``` ```rust -x = true; +x = true != false; ``` For any assigment, the variable typed stored with the rhs evaluated type is checked. @@ -495,6 +495,7 @@ For any assigment, the variable typed stored with the rhs evaluated type is chec ```rust fn main() -> i32 { return 1 + 1; + return true; // Error } ``` The function is declared to return a type i32. @@ -508,6 +509,7 @@ The function is declared to return a type i32. ```rust fn main() -> bool { return true && true; + return 3; // Error } ``` The function is declared to return a type boolean. @@ -609,8 +611,7 @@ if: ; preds = %entry cont: ; preds = %cont3, %entry %iftmp = phi i32 - %b6 = load i32, i32* %b - ret i32 %b6 + ret i1 true while: ; preds = %while, %if %a4 = load i32, i32* %a @@ -620,8 +621,7 @@ while: ; preds = %while, %if cont3: ; preds = %while, %if %whiletmp = phi i32 - %a5 = load i32, i32* %a - ret i32 %a5 + ret i1 true br label %cont } -- GitLab