Issue (also see the attached referenced issue below)
Warnings returned by ralphc have the following conditions:
Warnings can be returned within CompiledContract, CompiledScript or they can returned by genStatefulScripts().
When a Warning in a CompiledContract or CompiledScript has an empty SourceIndex or an empty SourceIndex.fileURI, it must be reported using the file information of the CompiledContract or CompiledScript containing the Warning.
A CompiledContract or CompiledScript can also contain Warnings for a file URI that is different from the CompiledContract's or CompiledScript's file information. In this case, the Warning must be reported using the file information set in the Warning itself, not the CompiledContract's or CompiledScript's file information.
Both Warning.SourceIndex and SourceIndex.fileURI are of type Option. If both are None and no file information is found for a Warning, those Warnings are logged for debugging purposes so they can be resolved in Node.
Solution
The above conditions are not as straightforward to manage. Therefore, this PR transforms the compiler output so that the above conditions are applied in the compiler-access module within RalphCompilerAccess.
Standardise
In presentation-compiler, there will only be one way to process Warnings, i.e., ALLWarnings must have their SourceIndex set and they should be returned as a single function output when contracts are compiled via compileContracts.
Issue (also see the attached referenced issue below)
Warning
s returned by ralphc have the following conditions:CompiledContract
,CompiledScript
or they can returned bygenStatefulScripts()
.Warning
in aCompiledContract
orCompiledScript
has an emptySourceIndex
or an emptySourceIndex.fileURI
, it must be reported using the file information of theCompiledContract
orCompiledScript
containing theWarning
.CompiledContract
orCompiledScript
can also containWarning
s for a file URI that is different from theCompiledContract
's orCompiledScript
's file information. In this case, theWarning
must be reported using the file information set in theWarning
itself, not theCompiledContract
's orCompiledScript
's file information.Warning.SourceIndex
andSourceIndex.fileURI
are of typeOption
. If both areNone
and no file information is found for aWarning
, thoseWarning
s are logged for debugging purposes so they can be resolved in Node.Solution
The above conditions are not as straightforward to manage. Therefore, this PR transforms the compiler output so that the above conditions are applied in the
compiler-access
module withinRalphCompilerAccess
.Standardise
In
presentation-compiler
, there will only be one way to processWarning
s, i.e., ALLWarning
s must have theirSourceIndex
set and they should be returned as a single function output when contracts are compiled viacompileContracts
.