Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Test assertion string bugfix #926

Merged
merged 1 commit into from
Sep 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion crates/codegen/src/yul/isel/test.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ pub fn lower_test(db: &dyn CodegenDb, test: FunctionId) -> yul::Object {
let test = db.mir_lowered_func_signature(test);
context.function_dependency.insert(test);

let dep_constants = context.resolve_constant_dependency(db);
let dep_functions: Vec<_> = context
.resolve_function_dependency(db)
.into_iter()
.map(yul::Statement::FunctionDefinition)
.collect();
let dep_constants = context.resolve_constant_dependency(db);
let dep_contracts = context.resolve_contract_dependency(db);
let runtime_funcs: Vec<_> = context
.runtime
Expand Down
4 changes: 4 additions & 0 deletions crates/tests/fixtures/files/assert_with_string.fe
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#test
fn foo() {
assert true, "oops"
}
12 changes: 12 additions & 0 deletions newsfragments/926.bugfix.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
Yul codegen was failing to include string literals used in test assertions. This resulted in a compiler error.

Example:

```
#test
fn foo() {
assert false, "oops"
}
```

The example code above was failing to compile, but now it compiles and executes as expected.