Fix Yul mode discarding solc validation errors (#478)

In `--yul` mode, resolc now properly exits when solc reports validation
errors (e.g., invalid hex literals, variable redeclarations), matching
`--standard-json behavior.`

`runs_without_input_file` was adapted because it was relying on it where
the new behavior correctly matches solc --strict-assembly.

Closes #477

Co-authored-by: minimax-m2.5 <neo@zion>

---------

Signed-off-by: xermicus <bigcyrill@hotmail.com>
This commit is contained in:
xermicusandminimax-m2.5 authored and GitHub committed 2026-02-16 11:03:24 +01:00
1 parent 0cd949aa66
commit d8d998c114
5 files changed
+40 -12

No files matched your search

+16 -11
View File
@@ -1,8 +1,8 @@
//! The tests for running resolc with yul option.
use crate::cli_utils::{
assert_command_success, assert_equal_exit_codes, execute_resolc, execute_solc, RESOLC_YUL_FLAG,
SOLC_YUL_FLAG, YUL_CONTRACT_PATH,
assert_command_failure, assert_command_success, assert_equal_exit_codes, execute_resolc,
execute_solc, RESOLC_YUL_FLAG, SOLC_YUL_FLAG, YUL_CONTRACT_PATH, YUL_INVALID_HEX_NIBBLES_PATH,
};
#[test]
@@ -18,15 +18,20 @@ fn runs_with_valid_input_file() {
assert_equal_exit_codes(&solc_result, &resolc_result);
}
/// While the `solc` Solidity mode requires output selection,
/// the strict-assembly mode does not.
///
/// `resolc` exhibits consistent behavior for both modes.
#[test]
fn runs_without_input_file() {
fn fails_without_input_file() {
let resolc_result = execute_resolc(&[RESOLC_YUL_FLAG]);
assert_command_success(&resolc_result, "Omitting an input file");
assert!(resolc_result
.stderr
.contains("Compiler run successful. No output requested"));
assert_command_failure(&resolc_result, "Omitting an input file");
let solc_result = execute_solc(&[SOLC_YUL_FLAG]);
assert_equal_exit_codes(&solc_result, &resolc_result);
}
#[test]
fn bails_with_invalid_input_file() {
let resolc_result = execute_resolc(&[YUL_INVALID_HEX_NIBBLES_PATH, RESOLC_YUL_FLAG]);
assert_command_failure(&resolc_result, "Providing an invalid input file");
let solc_result = execute_solc(&[YUL_INVALID_HEX_NIBBLES_PATH, SOLC_YUL_FLAG]);
assert_equal_exit_codes(&solc_result, &resolc_result);
}