File tree Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Expand file tree Collapse file tree 2 files changed +21
-3
lines changed Original file line number Diff line number Diff line change 16451645 (expand-forms
16461646 ;; TODO: This behaviour (`const _:T = ...` does not call convert,
16471647 ;; but still evaluates RHS) should be documented.
1648- `(const ,(car e) ,(if (underscore-symbol? (car e))
1649- rhs
1650- (convert-for-type-decl rhs T #t #f))))
1648+ `(const (= ,(car e) ,(if (underscore-symbol? (car e))
1649+ rhs
1650+ (convert-for-type-decl rhs T #t #f) ))))
16511651 (expand-forms
16521652 `(block ,@(cdr e)
16531653 ;; TODO: When x is a complex expression, this acts as a
Original file line number Diff line number Diff line change @@ -4305,6 +4305,24 @@ end
43054305@test letf_57470 (3 ) == 5
43064306@test letT_57470 === Int64
43074307
4308+ # Closure conversion should happen on const assignment rhs
4309+ module M59128
4310+ using Test
4311+ const x0:: Int = (()-> 1 )()
4312+ global x1:: Int = (()-> 1 )()
4313+ global const x2:: Int = (()-> 1 )()
4314+ const global x3:: Int = (()-> 1 )()
4315+ @test x0 === x1 === x2 === x3 === 1
4316+ let g = 1
4317+ global x4:: Vector{T} where {T<: Number } = let ; (()-> [g])(); end
4318+ const global x5:: Vector{T} where {T<: Number } = let ; (()-> [g])(); end
4319+ global const x6:: Vector{T} where {T<: Number } = let ; (()-> [g])(); end
4320+ end
4321+ @test x4 == x5 == x6 == [1 ]
4322+ const letT_57470{T} = (()-> Int64)()
4323+ @test letT_57470 == Int64
4324+ end
4325+
43084326end # M57470_sub
43094327
43104328# lowering globaldecl with complex type
You can’t perform that action at this time.
0 commit comments