Skip to content
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

Declaring a top-level payable constant results in CompileInferenceError #255

Closed
gas1cent opened this issue Feb 8, 2024 · 5 comments · Fixed by #256
Closed

Declaring a top-level payable constant results in CompileInferenceError #255

gas1cent opened this issue Feb 8, 2024 · 5 comments · Fixed by #256
Labels
bug Something isn't working

Comments

@gas1cent
Copy link

gas1cent commented Feb 8, 2024

Environment

Latest release, v18.1.1

Scenario

When a payable constant is defined outside of a contract, the compiler throws a CompileInferenceError. No error is thrown in the same scenario but without payable.

To test put the following in sample.sol:

pragma solidity 0.8.24;
address payable constant SWAPROUTER_ADDRESS = payable(0xE592427A0AEce92De3Edee1F18E0157C05861564);

Then try to compile:

import { compileSol } from 'solc-typed-ast';
const result = compileSol('./sample.sol', 'auto');

Expected behavior

Successful compilation.

Current behavior

CompileInferenceError: Failed parsing imports at ./sample.sol:65:1 - Expected " ", "/*", "//", "[", "\t", "\x0B", "\x0C", "constant", " ", "", [ , , , - , , , ], or [\n,\r,,] but "p" found.
    at findAllFiles (/node_modules/solc-typed-ast/src/compile/inference/imports.ts:171:23)
    at compileSol (/node_modules/solc-typed-ast/src/compile/utils.ts:317:27)
@gas1cent
Copy link
Author

Hey @blitz-1306, pinging you because you've helped us before. Any chance you could take a look at this issue? Huge thanks in advance 🙏🏻

@blitz-1306
Copy link
Contributor

@gas1cent Hello there and thanks for the input. I will look into it and provide feedback on this week. If there would be a fix, it would likely arrive on next week.

@blitz-1306 blitz-1306 added the bug Something isn't working label Feb 15, 2024
@blitz-1306
Copy link
Contributor

blitz-1306 commented Feb 15, 2024

Okay, this is clearly a bug related to a file-level definitons parser, that we use to preprocess imports. I will look into a possible solution. Stay tuned.

@blitz-1306
Copy link
Contributor

See #256 with the bugfix. I believe we should be able to deliver it soon enough.

@blitz-1306
Copy link
Contributor

@gas1cent Release v18.1.2 is out. Feel free to test. Thank you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants