florianschanda / miss_hit

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

check for simulink unsupported property initializations #225

Open BrunoSalami opened 3 years ago

BrunoSalami commented 3 years ago

What kind of feature is this?

Your MATLAB/Octave environment

MISS_HIT component affected Choose one or more of the below:

Describe the solution you'd like in classes, properties may be initialized in the properties block itself, e.g.

properties
    cats = uint8(6)
end

However, code generation only supports this for assignments that use only build-ins. So custom class constructors / functions won't work, e.g.

properties
   cat = Cat() % Cat being a custom class
end

This is fine when you don't generate code from is but will cause an error during code generation "Code generation only supports initial values of class type for constant properties". It'd be nice if this was caught by miss_hit early on.