@@ -86,11 +86,19 @@ impl EtherscanFlattenedSource {
8686 SolcLanguage :: Solidity ,
8787 version. clone ( ) ,
8888 ) ;
89+ let compiler = SolcCompiler :: Specific ( solc) ;
8990
90- let out = SolcCompiler :: Specific ( solc) . compile ( & input) ?;
91+ let out = compiler. compile ( & input) ?;
92+ let compiler_version = compiler. compiler_version ( & input) ;
93+ let compund_version = compound_version ( compiler_version, & input. version ) ;
9194 if out. errors . iter ( ) . any ( |e| e. is_error ( ) ) {
9295 let mut o = AggregatedCompilerOutput :: < SolcCompiler > :: default ( ) ;
93- o. extend ( version, RawBuildInfo :: new ( & input, & out, false ) ?, "default" , out) ;
96+ o. extend (
97+ version,
98+ RawBuildInfo :: new ( & input, & out, & compund_version, false ) ?,
99+ "default" ,
100+ out,
101+ ) ;
94102 let diags = o. diagnostics ( & [ ] , & [ ] , Default :: default ( ) ) ;
95103
96104 eyre:: bail!(
@@ -119,3 +127,26 @@ fn strip_build_meta(version: Version) -> Version {
119127 version
120128 }
121129}
130+
131+ fn compound_version ( mut compiler_version : Version , input_version : & Version ) -> Version {
132+ if compiler_version != * input_version {
133+ let build = if compiler_version. build . is_empty ( ) {
134+ semver:: BuildMetadata :: new ( & format ! (
135+ "{}.{}.{}" ,
136+ input_version. major, input_version. minor, input_version. patch,
137+ ) )
138+ . expect ( "can't fail due to parsing" )
139+ } else {
140+ semver:: BuildMetadata :: new ( & format ! (
141+ "{}-{}.{}.{}" ,
142+ compiler_version. build. as_str( ) ,
143+ input_version. major,
144+ input_version. minor,
145+ input_version. patch,
146+ ) )
147+ . expect ( "can't fail due to parsing" )
148+ } ;
149+ compiler_version. build = build;
150+ } ;
151+ compiler_version
152+ }
0 commit comments