`@kwdef` with `const` in mutable struct triggering "Missing Reference"

Why does

@kwdef mutable struct MyStruct
    const x::Float64 = 1.0
end

trigger a Missing reference: x?
(using the standard VSCode extension)

That’s a bug in the linter.

Honestly, i just disable the linter in the vs-code settings. For me, the autocompletion is more important than knowing if a variable is missing or a method is being called with wrong arguments.

I know nothing about how linters work, but it should be hard to build a good linter for a language, and especially hard for a language as dynamic as julia.

Fixed by

1 Like