This repository was archived by the owner on Apr 20, 2026. It is now read-only.
File tree Expand file tree Collapse file tree
crates/compilers/src/compilers/solc Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -158,7 +158,12 @@ impl CompilerInput for SolcVersionedInput {
158158 }
159159
160160 fn compiler_name ( & self ) -> Cow < ' static , str > {
161- "Solc" . into ( )
161+ // Detect Solar from version build metadata (e.g., "0.8.28+commit.xxx.solar.0.1.8")
162+ if self . version . build . as_str ( ) . contains ( "solar" ) {
163+ "Solar" . into ( )
164+ } else {
165+ "Solc" . into ( )
166+ }
162167 }
163168
164169 fn strip_prefix ( & mut self , base : & Path ) {
@@ -585,4 +590,29 @@ mod tests {
585590 aggregated. extend ( v, build_info, "default" , out_converted) ;
586591 assert ! ( !aggregated. is_unchanged( ) ) ;
587592 }
593+
594+ #[ test]
595+ fn test_compiler_name_detection ( ) {
596+ use std:: str:: FromStr ;
597+
598+ // Regular solc version
599+ let solc_version = Version :: from_str ( "0.8.28+commit.2d360a2" ) . unwrap ( ) ;
600+ let input = SolcVersionedInput :: build (
601+ Default :: default ( ) ,
602+ Default :: default ( ) ,
603+ SolcLanguage :: Solidity ,
604+ solc_version,
605+ ) ;
606+ assert_eq ! ( input. compiler_name( ) . as_ref( ) , "Solc" ) ;
607+
608+ // Solar version (contains "solar" in build metadata)
609+ let solar_version = Version :: from_str ( "0.8.28+commit.2d360a2.solar.0.1.8" ) . unwrap ( ) ;
610+ let input = SolcVersionedInput :: build (
611+ Default :: default ( ) ,
612+ Default :: default ( ) ,
613+ SolcLanguage :: Solidity ,
614+ solar_version,
615+ ) ;
616+ assert_eq ! ( input. compiler_name( ) . as_ref( ) , "Solar" ) ;
617+ }
588618}
You can’t perform that action at this time.
0 commit comments