-
Notifications
You must be signed in to change notification settings - Fork 2
std: sketch out contract desugaring #143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
found a fixed a couple of unrelated bugs. they're pushed here for now, but I'll pull them out into seperate prs against main to ease review. |
5e1f3c1
to
cf1317a
Compare
std/dispatch.sol contains a rough sketch of what the high level contract syntax would desugar into. still todo: - constructors - storage - conditional logic for lifting the non payable check to the top if all methods on the contract are not payable.
Fixes the dispatch code to operate almost entirely on runtime values instead of proxies (as previously used). This fixes the type checking errors but still produces errors during codegen.
the wrapped yul dialect available in solidity assembly blocks does not allow the usage of some important primitives that we need to implement contract desugaring (e.g. memoryguard) so we migrate our default compilation harness to use the pure yul pipeline and execute via hevm instead.
Classic Solidity will lift the callvalue check to the top level if all methods are non payable. We should match this behaviour at some point. This commit removes a non functional attempt at the above feature for the sake of progress. The previous version incorrectly assumed that the default instance would be selected if constraints on all other instances could not be entailed. The reality is that for now we only select the default if there are no available non default instances that unify with the type. In the future we will need to either make default instance selection more powerful or figure out how to match the classic solidity behaviour without it.
This is needed when importing a file that contains pragma definitions into another one. Pragmas are merged additively, with a catch all pragma defintion taking precendence and forcing the check to be disabled for all instances
The fv function was only including skolem vars in the free variable set (not regular type variables). This was causing the bound variable check to incorrectly accept instances that should have been rejected
return is used as both a surface level keyword and a yul level function. This modifies the surface level parser to correctly handle `return` in yul blocks.
bool matching seems to still need some work for emitting core
This is now finally working for method execution:
Still to do:
|
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
@clonker and I put together a rough sketch of what the high level contract syntax would desugar into.
still todo: