Mist: Ethereum Wallet contract IDE verification always uses the newest compiler !

Created on 20 Jul 2018  路  6Comments  路  Source: ethereum/mist

  • [ ] I've asked for help in the Mist Gitter before filing this issue.
Version: `0.11.0`
OS & Version: osx
Number of blocks synchronized: 5998269

Ethereum Wallet contract IDE verification doesn't use the compiler which has been already defined in the solidity !

the "contract IDE verification" is the solidity code compiler verification.
For example,
I was using the contract name as the function name for the contract construct function at pragma solidity ^0.4.21; and the Ethereum Wallet's inner IDE tells that *Could not compile source code. *

error message:

Could not compile source code.

Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
function MYCONTRACTNAME() {
^ (Relevant source part starts here and spans across multiple lines).
,

but this feature is not a pragma solidity ^0.4.21; feature.
https://solidity.readthedocs.io/en/v0.4.21/contracts.html?highlight=construct

When a contract is created, its constructor (a function with the same name as the contract) is executed once. A constructor is optional. Only one constructor is allowed, and this means overloading is not supported.

however, this feature is showed in the newest version of solidity compiler pragma solidity ^0.4.24
https://solidity.readthedocs.io/en/v0.4.24/contracts.html?highlight=construct

When a contract is created, its constructor (a function declared with the constructor keyword) is executed once. A constructor is optional. Only one constructor is allowed, and this means overloading is not supported.

So after I change the code
function MYCONTRACTNAME()
to
constructor()
the error message disappeared.
BUT I still leave the code pragma solidity ^0.4.21; declared !

I think this is a BUG

Bug

All 6 comments

Gooood

Hello @toby1991, can you elaborate your claim? What exactly is the contract IDE verification?

Hi @evertonfraga ,the "contract IDE verification" is the solidity code compiler verification.
For example,
I was using the contract name as the function name for the contract construct function at pragma solidity ^0.4.21; and the Ethereum Wallet's inner IDE tells that *Could not compile source code. *

error message:

Could not compile source code.

Defining constructors as functions with the same name as the contract is deprecated. Use "constructor(...) { ... }" instead.
function MYCONTRACTNAME() {
^ (Relevant source part starts here and spans across multiple lines).
,

but this feature is not a pragma solidity ^0.4.21; feature.
https://solidity.readthedocs.io/en/v0.4.21/contracts.html?highlight=construct

When a contract is created, its constructor (a function with the same name as the contract) is executed once. A constructor is optional. Only one constructor is allowed, and this means overloading is not supported.

however, this feature is showed in the newest version of solidity compiler pragma solidity ^0.4.24
https://solidity.readthedocs.io/en/v0.4.24/contracts.html?highlight=construct

When a contract is created, its constructor (a function declared with the constructor keyword) is executed once. A constructor is optional. Only one constructor is allowed, and this means overloading is not supported.

So after I change the code
function MYCONTRACTNAME()
to
constructor()
the error message disappeared.
BUT I still leave the code pragma solidity ^0.4.21; declared !

I think this is a BUG

I ran into this issue myself while testing an old token contract. We'll see if we can get it addressed for 0.12.

Sent a pull request with a fix.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

brandoncurtis picture brandoncurtis  路  4Comments

chanukya246 picture chanukya246  路  5Comments

drandreaskrueger picture drandreaskrueger  路  7Comments

stephantual picture stephantual  路  7Comments

keznerve picture keznerve  路  5Comments