Skip to content
Snippets Groups Projects
Commit ce3bed4c authored by Aron Strandberg's avatar Aron Strandberg
Browse files

had bug with typechecker, now resolved, updated code example, had typ check error, hehe...

parent ebede4bb
No related branches found
No related tags found
No related merge requests found
...@@ -473,7 +473,7 @@ As previously mentioned, let assignment are unique declerations. Thus, the same ...@@ -473,7 +473,7 @@ As previously mentioned, let assignment are unique declerations. Thus, the same
``` ```
```rust ```rust
x = 1; x = (1 + 1) * 3;
``` ```
### Assignment bool ### Assignment bool
```math ```math
...@@ -481,7 +481,7 @@ x = 1; ...@@ -481,7 +481,7 @@ x = 1;
``` ```
```rust ```rust
x = true; x = true != false;
``` ```
For any assigment, the variable typed stored with the rhs evaluated type is checked. 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 ...@@ -495,6 +495,7 @@ For any assigment, the variable typed stored with the rhs evaluated type is chec
```rust ```rust
fn main() -> i32 { fn main() -> i32 {
return 1 + 1; return 1 + 1;
return true; // Error
} }
``` ```
The function is declared to return a type i32. The function is declared to return a type i32.
...@@ -508,6 +509,7 @@ The function is declared to return a type i32. ...@@ -508,6 +509,7 @@ The function is declared to return a type i32.
```rust ```rust
fn main() -> bool { fn main() -> bool {
return true && true; return true && true;
return 3; // Error
} }
``` ```
The function is declared to return a type boolean. The function is declared to return a type boolean.
...@@ -609,8 +611,7 @@ if: ; preds = %entry ...@@ -609,8 +611,7 @@ if: ; preds = %entry
cont: ; preds = %cont3, %entry cont: ; preds = %cont3, %entry
%iftmp = phi i32 %iftmp = phi i32
%b6 = load i32, i32* %b ret i1 true
ret i32 %b6
while: ; preds = %while, %if while: ; preds = %while, %if
%a4 = load i32, i32* %a %a4 = load i32, i32* %a
...@@ -620,8 +621,7 @@ while: ; preds = %while, %if ...@@ -620,8 +621,7 @@ while: ; preds = %while, %if
cont3: ; preds = %while, %if cont3: ; preds = %while, %if
%whiletmp = phi i32 %whiletmp = phi i32
%a5 = load i32, i32* %a ret i1 true
ret i32 %a5
br label %cont br label %cont
} }
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment