Skip to content

Invalid error for keyword arguments #290

@pvogt09

Description

@pvogt09

MISS_HIT Component affected
Please choose one from:

  • Style checker

Your MATLAB/Octave environment

  • MATLAB
  • R2023B

Your operating system and Python version

  • Linux
  • python 3.8.10

Describe the bug
The file

 function [] = test()
    a = 0;
    arguments = struct(...
        'test', 1.0...
    );
end

gives the error

In arguments.m, line 3
|     arguments = struct(...
|     ^^^^^^^^^ error: expected valid statement, found keyword 'arguments' instead
MISS_HIT Style Summary: 1 file(s) analysed, 1 error(s)

which should not be the case because it is allowed to have variables called arguments as long as the keyword does not appear as the first expression in the function body (a = 0; makes the difference here between invalid Matlab syntax and correct code).

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions