Add tests for undefined types

This commit is contained in:
Pranav Gaddamadugu 2022-08-11 00:36:22 -07:00
parent a26c452de2
commit a69954b64a
6 changed files with 54 additions and 0 deletions

View File

@ -0,0 +1,14 @@
/*
namespace: Compile
expectation: Fail
*/
circuit Foo {
a: u8,
bar: Bar,
}
@program
function main(a: u8) -> u8 {
return a + 1u8;
}

View File

@ -0,0 +1,14 @@
/*
namespace: Compile
expectation: Fail
*/
@program
function main(a: u8, foo: Foo) -> u8 {
return a;
}
@program
function returns_foo(a: u8) -> Foo {
return a;
}

View File

@ -0,0 +1,11 @@
/*
namespace: Compile
expectation: Fail
input_file: inputs/dummy.in
*/
@program
function main(k: bool) -> bool {
let b: Foo = 1u8;
return k == true;
}

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [ETYC0372017]: The type `Bar` is not found in the current scope.\n --> compiler-test:3:1\n |\n 3 | circuit Foo {\n 4 | a: u8,\n 5 | bar: Bar,\n 6 | }\n | ^\n"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:4:22\n |\n 4 | function main(a: u8, foo: Foo) -> u8 {\n | ^^^\nError [ETYC0372003]: Expected type `circuit Foo` but type `u8` was found\n --> compiler-test:9:22\n |\n 9 | function returns_foo(a: u8) -> Foo {\n | ^\nError [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:9:1\n |\n 9 | function returns_foo(a: u8) -> Foo {\n 10 | return a;\n 11 | }\n | ^\n"

View File

@ -0,0 +1,5 @@
---
namespace: Compile
expectation: Fail
outputs:
- "Error [ETYC0372017]: The type `Foo` is not found in the current scope.\n --> compiler-test:5:2\n |\n 5 | \tlet b: Foo = 1u8;\n | ^^^^^^^^^^^^^^^^\nError [ETYC0372003]: Expected type `circuit Foo` but type `u8` was found\n --> compiler-test:5:15\n |\n 5 | \tlet b: Foo = 1u8;\n | ^^^\n"