Skip to content

Conversation

@wtdcode
Copy link
Contributor

@wtdcode wtdcode commented May 23, 2025

Trivial patch.

Reproduce:

echo '{"language":"Solidity","sources":{"test.sol":{"content":"contract TT {\\n    function main() public {}\\n}"}},"settings":{"stopAfter":"parsing","optimizer":{"enabled":false,"runs":200},"outputSelection":{"*":{"":["ast"],"*":[]}},"viaIR":true,"libraries":{}}}' | solc --standard-json

Since there is no semantics analysis when stopping after parsing, scope along with a few other fields are not available and this PR marks all scope to be optional.

@wtdcode wtdcode changed the title scope is optional during "stopAfter":"parsing" Some fields are optional during "stopAfter":"parsing" May 23, 2025
Copy link
Member

@mattsse mattsse left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

makes sense,

do you need another patch for this right away?

@mattsse mattsse merged commit 2c90332 into foundry-rs:main May 23, 2025
15 checks passed
@wtdcode
Copy link
Contributor Author

wtdcode commented May 23, 2025

makes sense,

do you need another patch for this right away?

Thanks for the instant response. I'm looking into solidity code to check all fields not emitted in this case.

Will raise another PR when I find more fields.

@wtdcode
Copy link
Contributor Author

wtdcode commented May 23, 2025

Pretty hard to determine the exact full set of fields that need to be optional from the source code since they do not have schema like serde. Will get another PR when I finish parsing more solidity code =).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants