Skip to content

Syntax change in macro call produces erroneous code. #669

@baggepinnen

Description

@baggepinnen

JuliaFormatter does not understand the @variables macro from ModelingToolkit, when formatting, it tries to change the syntax appearing here

sts = @variables x(t)=x_start [description = "State of SecondOrder filter $name"] xd(t)=xd_start [
        description = "Derivative state of SecondOrder filter $name",
    ]

from short to long function definition:

function xd(t)
        xd_start
    end [
        description = "Derivative state of SecondOrder filter $name",
    ]

This produces incorrect code. Perhaps JuliaFormatter should be more careful with reformatting macro calls since they may expect a certain syntax, and the alternative syntax after formatting may be invalid.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions