You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Solidity has two methods to define super constructor calls: the first one is embedding the arguments in super contract definition and the second is by declaring a new constructor and adding the name and arguments for the super contract. If both methods are used concurrently, the constructor definition is used. However, the compiler does not warn the user that the first set of arguments has been overridden by the second.
The following example shows the problem. The parent constract is constructed with the
argument 40, not 20.
Furthermore, if parentheses are given, the number of arguments has to match the number of parameters (currently, empty parentheses is the same as no parentheses).
Description
Solidity has two methods to define super constructor calls: the first one is embedding the arguments in super contract definition and the second is by declaring a new constructor and adding the name and arguments for the super contract. If both methods are used concurrently, the constructor definition is used. However, the compiler does not warn the user that the first set of arguments has been overridden by the second.
The following example shows the problem. The parent constract is constructed with the
argument 40, not 20.
Recommendations
Either prevent the user from defining two super-constructors or warn if one super-constructor overrides the other.
The text was updated successfully, but these errors were encountered: