Refactored Type Checking and Analysis Annotations #13365
Labels
epic effort
Multi-stage task that may require coordination between team members across multiple PRs.
high impact
Changes are very prominent and affect users or the project in a major way.
needs design
The proposal is too vague to be implemented right away
refactor
selected for development
It's on our short-term development
What
Make type checking robust against several invocations (creation mode; runtime mode), as well as out-of-order execution, even in the presence of cycles.
Why
To enable compile-time constant expression evaluation and the code data location, as well as making support of generics easier in the future.
What
Currently, the Solidity AST is
const
after parsing and thenannotation()
-annotated by the analysis steps inCompilerStack::analyze
.However, some AST nodes and some Types have interfaces that implicitly depend on annotations. (e.g. for types:
ContractType::stateVariables
,StructType::nativeMembers
; e.g. for AST nodes:StructDefinition::type
,VariableDeclaration::hasReferenceOrMappingType
, etc.).In the past we regularly had ICEs due to such implicit dependencies. That has gotten better recently, but it's still an easy source of error.
This issue is going to get worse, once we want to move to compile-time constant expression evaluation since this will probably entail switching multiple analysis steps to simultaneous cycle-resistant lazy-evaluation.
Furthermore we need to evaluate additional requirements looking ahead to type checking in the presence of future generics.
So we need to come up with a nicer way to:
DeclarationTypeChecker
andTypeChecker
, with implicit interactions withContractLevelChecker
.Notes
The text was updated successfully, but these errors were encountered: