Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/julia-syntax.scm
Original file line number Diff line number Diff line change
Expand Up @@ -1645,9 +1645,9 @@
(expand-forms
;; TODO: This behaviour (`const _:T = ...` does not call convert,
;; but still evaluates RHS) should be documented.
`(const ,(car e) ,(if (underscore-symbol? (car e))
rhs
(convert-for-type-decl rhs T #t #f))))
`(const (= ,(car e) ,(if (underscore-symbol? (car e))
rhs
(convert-for-type-decl rhs T #t #f)))))
(expand-forms
`(block ,@(cdr e)
;; TODO: When x is a complex expression, this acts as a
Expand Down
18 changes: 18 additions & 0 deletions test/syntax.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4305,6 +4305,24 @@ end
@test letf_57470(3) == 5
@test letT_57470 === Int64

# Closure conversion should happen on const assignment rhs
module M59128
using Test
const x0::Int = (()->1)()
global x1::Int = (()->1)()
global const x2::Int = (()->1)()
const global x3::Int = (()->1)()
@test x0 === x1 === x2 === x3 === 1
let g = 1
global x4::Vector{T} where {T<:Number} = let; (()->[g])(); end
const global x5::Vector{T} where {T<:Number} = let; (()->[g])(); end
global const x6::Vector{T} where {T<:Number} = let; (()->[g])(); end
end
@test x4 == x5 == x6 == [1]
const letT_57470{T} = (()->Int64)()
@test letT_57470 == Int64
end

end # M57470_sub

# lowering globaldecl with complex type
Expand Down