florianschanda / miss_hit

MATLAB Independent, Small & Safe, High Integrity Tools - code formatter and more
GNU General Public License v3.0
158 stars 21 forks source link

Having 2 functions with the same name should throw an error. #235

Open Remi-Gau opened 2 years ago

Remi-Gau commented 2 years ago

What kind of feature is this?

New feature in MISS_HIT

Your MATLAB/Octave environment

MATLAB

Octave is not affected by this

MISS_HIT component affected

I think this falls under the linter.

Describe the solution you'd like

Matlab will not use a file where 2 functions have the same name. I suspect that ms lint should flag this, no?

Example:

function temp()
end

function foo()
end

function foo()
end
florianschanda commented 2 years ago

Yes, it definitely should; but right now there is zero semantic analysis going on.

There is a sanity check that a function name doesn't clash with some important built-ins (like true, and yes this happened for real once, just remember all safety rules are written in blood) but other than that there is nothing going on: no symbol table no name resolution, nothing.

I have a very big project ahead of me to do this, as it would enable a large number of useful checks (e.g. look at issues requiring sem that are open right now).

I plan to do this; but don't expect anything this year...

florianschanda commented 2 years ago

In fact I've re-opened #236 and put the same labels on it to make sure I capture this

Remi-Gau commented 2 years ago

I plan to do this; but don't expect anything this year...

No rush at all.

miss_hit as it is has already brought much joy and removed a lot of my pain from my every day life. So anything beyond that is just icing on the cake. :+1:

florianschanda commented 2 years ago

That is some really nice feedback, it makes me very happy to hear that. Thanks! :)