Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

check for simulink unsupported property initializations #225

Open
BrunoSalami opened this issue Aug 4, 2021 · 0 comments
Open

check for simulink unsupported property initializations #225

BrunoSalami opened this issue Aug 4, 2021 · 0 comments
Labels
requires: sem Change can only be implemented once semantic analysis works tool: mh_lint Affects the linter

Comments

@BrunoSalami
Copy link

BrunoSalami commented Aug 4, 2021

What kind of feature is this?

  • catch matlab constructs that will fail code generation early on
  • specifically, Code generation only supports initial values of class type for constant properties

Your MATLAB/Octave environment

  • MATLAB R2017b

MISS_HIT component affected
Choose one or more of the below:

  • mh_lint

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.

@florianschanda florianschanda added the tool: mh_lint Affects the linter label Aug 4, 2021
@florianschanda florianschanda changed the title Code generation only supports initial values of class type for constant properties check for simulink unsupported property initializations Aug 5, 2021
@florianschanda florianschanda added the requires: sem Change can only be implemented once semantic analysis works label Aug 5, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
requires: sem Change can only be implemented once semantic analysis works tool: mh_lint Affects the linter
Projects
None yet
Development

No branches or pull requests

2 participants