I am referencing this similar issue but please note, I believe it's due to a different cause than the one hypothesized in the issue linked to below, which indicates that it was due to a "stale" copy of _solc_ existing on the user's station. I executed the same steps suggested to the user and it did _not_ solve my problem. I believe that my issue (assumption, not confirmed) has to due with my use of the new "compiler" section available with Truffle 5.0 beta to use an older compiler. I believe that Truffle _is_ using the older compile because since I added the "compiler" section with version "0.4.21" it no longer throws errors for addresses not marked as _payable_, a 5.0 specific error, even though it prints out a message indicating the 5.0 compiler is in use:
https://github.com/trufflesuite/truffle/issues/906
Here is the error I am getting since I upgraded to Truffle 5.0:
Error parsing /home/robert/Documents/GitHub/ME/ether-band-battles-work/solidity/contracts/Migrations.sol: ParsedContract.sol:7:14: ParserError: Expected identifier, got 'LParen'
constructor() public {
^
Compilation failed. See above.
Truffle v5.0.0-beta.2 (core: 5.0.0-beta.2)
Solidity v0.5.0 (solc-js)
Node v8.11.1
How can I fix this? Here is the relevant section of my Truffle js file:
compilers: {
solc: {
version: "0.4.21"
}
},
/** Added solidity optimize in attempt to combat out of gas errors during migrates to Ganache. **/
solc: {
optimizer: {
enabled: true,
runs: 200
}
}
Note, if I am correct in my analysis, this also indicates that Truffle should print out the version of _solc_ actually being used, as per the directive in Truffle.js, instead of simply printing out v0.5.0 as it appears to be doing now.
Hey @roschler, Is the code you are working with available anywhere?
Your truffle.js file has solc set to a version that didn't support constructor functions.
Try and bump it up to 0.4.22
This looks like not a bug, but it looks like something that could be handled much better. Leaving this open to track improving error handling in situations like this. Thanks!
Check if one of your vs Code plugin is "Solidity Extended" by beaugunderson and disable it.
Most helpful comment
Check if one of your vs Code plugin is "Solidity Extended" by beaugunderson and disable it.