-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
test: add tests for basic hir compiler errors
- Loading branch information
Showing
13 changed files
with
85 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
[alias] | ||
xtask = "run --package eight-xtask --" | ||
regtest = "run --package eight-regtest -- verify" | ||
regtest = "run --package eight-regtest -- verify tests" | ||
|
||
[env] | ||
CARGO_WORKSPACE_DIR = { value = "", relative = true } |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// RUN: not %eightc %s 2>&1 | %regtest test %s | ||
|
||
fn main() -> i32 { | ||
break; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Error: sema::break_outside_loop | ||
|
||
× break statement outside of loop | ||
╭─[break-outside-loop.eight:4:3] | ||
3 │ fn main() -> i32 { | ||
4 │ break; | ||
· ───┬── | ||
· ╰── there is no enclosing loop | ||
5 │ } | ||
╰──── | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// RUN: not %eightc %s 2>&1 | %regtest test %s | ||
|
||
fn test() -> bool { | ||
continue; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Error: sema::continue_outside_loop | ||
|
||
× continue statement outside of loop | ||
╭─[continue-outside-loop.eight:4:3] | ||
3 │ fn test() -> bool { | ||
4 │ continue; | ||
· ────┬──── | ||
· ╰── there is no enclosing loop | ||
5 │ } | ||
╰──── | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// RUN: not %eightc %s 2>&1 | %regtest test %s | ||
|
||
fn main() -> i32 { | ||
return somebody_help_i_got_a_bad_reference; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Error: sema::invalid_reference | ||
|
||
× invalid reference to somebody_help_i_got_a_bad_reference | ||
╭─[invalid-reference.eight:4:10] | ||
3 │ fn main() -> i32 { | ||
4 │ return somebody_help_i_got_a_bad_reference; | ||
· ─────────────────┬───────────────── | ||
· ╰── no value in scope named somebody_help_i_got_a_bad_reference | ||
5 │ } | ||
╰──── | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
// RUN: not %eightc %s 2>&1 | %regtest test %s | ||
|
||
struct Foo { | ||
bar: Foo, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Error: sema::infinitely_recursive_type | ||
|
||
× type is recursive | ||
╭─[type-field-infinite-recursion.eight:4:3] | ||
3 │ struct Foo { | ||
4 │ bar: Foo, | ||
· ────┬──── | ||
· ╰── type Foo has an infinite recursion in field bar | ||
5 │ } | ||
╰──── | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
// RUN: not %eightc %s 2>&1 | %regtest test %s | ||
|
||
intrinsic_fn get_id<T>() -> T; | ||
|
||
fn main() { | ||
let bananas: Banana = get_id(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
Error: sema::unknown_type | ||
|
||
× Banana does not name a known type | ||
╭─[unknown-type.eight:6:16] | ||
5 │ fn main() { | ||
6 │ let bananas: Banana = get_id(); | ||
· ───┬── | ||
· ╰── could not find type Banana | ||
7 │ } | ||
╰──── | ||
|
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters