juanfranblanco / vscode-solidity

Visual Studio Code language support extension for Solidity smart contracts in Ethereum https://marketplace.visualstudio.com/items?itemName=JuanBlanco.solidity
MIT License
904 stars 194 forks source link

address payable syntax error #117

Closed pizzarob closed 5 years ago

pizzarob commented 5 years ago

I believe as of solidity 0.5.0 address types need to be marked payable in order to have a transfer method. The code compiles fine, but I am getting a syntax error.

image

vibern0 commented 5 years ago

Hi, which linter are you using? Does it support solidity 0.5.0? Are you using the right version at pragma? Like pragma solidity ^0.5.0;

pizzarob commented 5 years ago

Hey I'm using default linter for this plugin and the pragma is correct

pizzarob commented 5 years ago

Anything on this? The false syntax error breaks the rest of the linting. If time is an issue point me in the direction of the file to edit to fix this.

rocky commented 5 years ago

The default linter seems to be solium

https://www.npmjs.com/package/solium-plugin-security#list-of-rules describes how to turn on and off individual rules in a soliumrc.json.

I assume this should be enough to figure out a workaround. The steps I'd try is to see if this is a bug in solium which, by the way, is now called ethlint. Perhaps upgrading will fix that. If it is a bug in ethlint, then I'd look at that project to see if this has been reported and what the fix is.

Finally, I'd say that if I were wanted to delve into addressing this, I'd want the to have the full text to shortest contract that shows the problem so I could easily see the problem. This hasn't been given yet.

pizzarob commented 5 years ago

Thinking about it, I don't think it's the linter since it's a syntax error - I would think it has to do with the language parser wherever that is. @rocky :

pragma solidity >=0.4.0 <0.6.0;

contract Test {
  function transfer(address payable to) public payable {

  }
}

With this you will get Expected ',' but got 'payable'

pizzarob commented 5 years ago

Hey FYI I fixed this by using solhint as the linter 👍

juanfranblanco commented 5 years ago

Apologies @pizza-r0b I have not had time to look at this, but I will check with the now Ethlint about this.