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)
102
102
if CSTParser. defines_struct (x) # mark field block
103
103
for arg in x. args[3 ]. args
104
104
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)
106
109
arg = arg. args[1 ]
107
110
end
108
111
mark_binding! (arg)
Original file line number Diff line number Diff line change @@ -606,6 +606,24 @@ f(arg) = arg
606
606
""" )
607
607
@test StaticLint. errorof (cst[2 ]) === nothing
608
608
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
609
627
let cst = parse_and_pass ("""
610
628
import Base: sin
611
629
\"\"\"
You can’t perform that action at this time.
0 commit comments