Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Warn for Inheritance same signature functions and variables #2116
executing a() yields z=3;
But this is too confusing and helps to introduce bugs. Better warn if same signatures are detected
To be more precise: I assume this issue is about a warning in situations where functions are overwritten through multiple inheritance where there is no common base contract that also has the function.
I think this is a good idea for an external static analyzer, but it should not be part of the compiler. The reason is that if you want to use two base contracts that lie outside of your own project, you cannot modify their function names and name clashes might be unavoidable. Note that you can still access specific "instances" of
referenced this issue
Sep 18, 2017
I've uploaded my thoughts on this issue as a blog post. Specifically, I definitely support either the addition of warnings for multiple overrides at the same level of the developer specified inheritance graph. Requiring unambiguous references to each potentially ambiguous method/field is also not a bad step, but it should be paired with explicit access to any superclass functions when, because of linearization, those functions will not be the ones in a class's explicitly stated superclass (in my blog post this is the case with the WhitelistedCrowdsale call; this class directly extends Crowdsale but its super reference will be to CappedCrowdsale because of linearization. this should be required to be made explicit).