-
Notifications
You must be signed in to change notification settings - Fork 658
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Error on futures in arrays, structs, or mappings.
This already wouldn't work, but would either give misleading error messages or would compile to invalid bytecode.
- Loading branch information
1 parent
d9fe41a
commit fec941a
Showing
5 changed files
with
72 additions
and
2 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
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
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
24 changes: 24 additions & 0 deletions
24
tests/expectations/compiler/futures/future_in_composite_fail.out
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,24 @@ | ||
namespace = "Compile" | ||
expectation = "Fail" | ||
outputs = [""" | ||
Error [ETYC0372114]: A struct cannot contain a future. | ||
--> compiler-test:7:9 | ||
| | ||
7 | member: Future, | ||
| ^^^^^^ | ||
Error [ETYC0372031]: A mapping's key cannot be a future | ||
--> compiler-test:4:5 | ||
| | ||
4 | mapping x: Future => Future; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error [ETYC0372031]: A mapping's value cannot be a future | ||
--> compiler-test:4:5 | ||
| | ||
4 | mapping x: Future => Future; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
Error [ETYC0372115]: An array cannot have a future as an element type. | ||
--> compiler-test:12:9 | ||
| | ||
12 | let an_array: [Future; 1] = [future]; | ||
| ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ | ||
"""] |
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,22 @@ | ||
/* | ||
namespace = "Compile" | ||
expectation = "Fail" | ||
*/ | ||
|
||
program test.aleo { | ||
mapping x: Future => Future; | ||
|
||
struct S { | ||
member: Future, | ||
} | ||
|
||
async transition main() -> Future { | ||
let future: Future = finish(); | ||
let an_array: [Future; 1] = [future]; | ||
return an_array[0u32]; | ||
} | ||
|
||
async function finish() { | ||
assert_eq(1u8, 1u8); | ||
} | ||
} |