File tree Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Expand file tree Collapse file tree 2 files changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -102,7 +102,10 @@ function mark_bindings!(x::EXPR, state)
102102 if CSTParser. defines_struct (x) # mark field block
103103 for arg in x. args[3 ]. args
104104 CSTParser. defines_function (arg) && continue
105- if kwdef && CSTParser. isassignment (arg) || arg. head === :const
105+ if arg. head === :const
106+ arg = arg. args[1 ]
107+ end
108+ if kwdef && CSTParser. isassignment (arg)
106109 arg = arg. args[1 ]
107110 end
108111 mark_binding! (arg)
Original file line number Diff line number Diff line change @@ -606,6 +606,24 @@ f(arg) = arg
606606 """ )
607607 @test StaticLint. errorof (cst[2 ]) === nothing
608608 end
609+ if VERSION >= v " 1.10"
610+ let cst = parse_and_pass ("""
611+ @kwdef mutable struct A
612+ const x::Float64
613+ end
614+ A(x = 5.0)
615+ """ )
616+ @test StaticLint. errorof (cst[2 ]) === nothing
617+ end
618+ let cst = parse_and_pass ("""
619+ @kwdef mutable struct A
620+ const x::Float64 = 1.0
621+ end
622+ A(x = 5.0)
623+ """ )
624+ @test StaticLint. errorof (cst[2 ]) === nothing
625+ end
626+ end
609627 let cst = parse_and_pass ("""
610628 import Base: sin
611629 \"\"\"
You can’t perform that action at this time.
0 commit comments