SPDX-License-Identifier prevents solc pragma statement from matching
TimDaub opened this issue · 1 comments
TimDaub commented
// SPDX-License-Identifier: GPL-3.0-only
pragma solidity ^0.8.4;
contract Bla {
function submit() public {
}
}
If I try to compile this code with
const compiled = await solcli.compileFile("./src/contracts/bla.sol");
I get
Error {
message: 'no pragma solidity version set',
}
› getSolcVersion (node_modules/solidity-cli/src/read-code.ts:72:23)
› Object.<anonymous> (node_modules/solidity-cli/src/read-code.ts:86:22)
› step (node_modules/solidity-cli/dist/src/read-code.js:35:23)
› Object.next (node_modules/solidity-cli/dist/src/read-code.js:16:53)
› fulfilled (node_modules/solidity-cli/dist/src/read-code.js:7:58)
When I, however, remove the SPDX-License-Identifier comment, I don't get this error.
pubkey commented
Yes we read the solidity version from the first line.
You can make a PR to support this edge case if you want.