mirror of
https://github.com/pezkuwichain/revive-differential-tests.git
synced 2026-06-11 00:21:02 +00:00
constants.mod, and Display for CaseIdx to use it
This commit is contained in:
@@ -0,0 +1,4 @@
|
||||
use semver::Version;
|
||||
|
||||
/// This is the first version of solc that supports the `--via-ir` flag / "viaIR" input JSON.
|
||||
pub const VERSION_SUPPORTING_VIA_IR: Version = Version::new(0, 8, 13);
|
||||
@@ -3,6 +3,8 @@
|
||||
//! - Polkadot revive resolc compiler
|
||||
//! - Polkadot revive Wasm compiler
|
||||
|
||||
mod constants;
|
||||
|
||||
use std::{
|
||||
collections::HashMap,
|
||||
fs::read_to_string,
|
||||
|
||||
@@ -15,6 +15,7 @@ use revive_solc_json_interface::{
|
||||
};
|
||||
|
||||
use crate::{CompilerInput, CompilerOutput, ModeOptimizerSetting, ModePipeline, SolidityCompiler};
|
||||
use super::constants::VERSION_SUPPORTING_VIA_IR;
|
||||
|
||||
use alloy::json_abi::JsonAbi;
|
||||
use anyhow::Context;
|
||||
@@ -246,7 +247,7 @@ impl SolidityCompiler for Resolc {
|
||||
// We only support the Y (IE compile via Yul IR) mode here, which also means that we can
|
||||
// only use solc version 0.8.13 and above. We must always compile via Yul IR as resolc
|
||||
// needs this to translate to LLVM IR and then RISCV.
|
||||
pipeline == ModePipeline::Y && compiler_version >= &Version::new(0, 8, 13)
|
||||
pipeline == ModePipeline::Y && compiler_version >= &VERSION_SUPPORTING_VIA_IR
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -11,6 +11,7 @@ use revive_dt_config::Arguments;
|
||||
use revive_dt_solc_binaries::download_solc;
|
||||
|
||||
use crate::{CompilerInput, CompilerOutput, ModeOptimizerSetting, ModePipeline, SolidityCompiler};
|
||||
use super::constants::VERSION_SUPPORTING_VIA_IR;
|
||||
|
||||
use anyhow::Context;
|
||||
use foundry_compilers_artifacts::{
|
||||
@@ -23,9 +24,6 @@ use foundry_compilers_artifacts::{
|
||||
use semver::Version;
|
||||
use tokio::{io::AsyncWriteExt, process::Command as AsyncCommand};
|
||||
|
||||
/// This is the first version of solc that supports the `--via-ir` flag / "viaIR" input JSON.
|
||||
const VERSION_SUPPORTING_VIA_IR: Version = Version::new(0, 8, 13);
|
||||
|
||||
#[derive(Debug)]
|
||||
pub struct Solc {
|
||||
solc_path: PathBuf,
|
||||
|
||||
@@ -56,7 +56,7 @@ struct Test {
|
||||
metadata: Metadata,
|
||||
path: PathBuf,
|
||||
mode: Mode,
|
||||
case_idx: usize,
|
||||
case_idx: CaseIdx,
|
||||
case: Case,
|
||||
}
|
||||
|
||||
@@ -231,7 +231,7 @@ where
|
||||
metadata: metadata.clone(),
|
||||
path: metadata_file_path.to_path_buf(),
|
||||
mode: solc_mode,
|
||||
case_idx,
|
||||
case_idx: case_idx.into(),
|
||||
case: case.clone(),
|
||||
}
|
||||
})
|
||||
|
||||
@@ -67,3 +67,9 @@ define_wrapper_type!(
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, PartialOrd, Ord, Hash)]
|
||||
pub struct CaseIdx(usize);
|
||||
);
|
||||
|
||||
impl std::fmt::Display for CaseIdx {
|
||||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||||
write!(f, "{}", self.0)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user