Skip to content

Commit 9ed21d6

Browse files
authored
Merge pull request #328 from N5N3/1.8patch
Type declarations on global variables are supported on 1.8
2 parents 55e60f7 + 4aedff1 commit 9ed21d6

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/linting/checks.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -876,7 +876,7 @@ end
876876

877877
function check_const(x::EXPR)
878878
if headof(x) === :const
879-
if CSTParser.isassignment(x.args[1]) && CSTParser.isdeclaration(x.args[1].args[1])
879+
if VERSION < v"1.8.0-DEV.1500" && CSTParser.isassignment(x.args[1]) && CSTParser.isdeclaration(x.args[1].args[1])
880880
seterror!(x, TypeDeclOnGlobalVariable)
881881
elseif headof(x.args[1]) === :local
882882
seterror!(x, UnsupportedConstLocalVariable)

test/runtests.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1324,7 +1324,7 @@ f(arg) = arg
13241324
let
13251325
cst = parse_and_pass("""const x::T = x
13261326
local const x = 1""")
1327-
@test errorof(cst.args[1]) === StaticLint.TypeDeclOnGlobalVariable
1327+
@test errorof(cst.args[1]) === (VERSION < v"1.8.0-DEV.1500" ? StaticLint.TypeDeclOnGlobalVariable : nothing)
13281328
@test errorof(cst.args[2]) === StaticLint.UnsupportedConstLocalVariable
13291329
end
13301330
end

0 commit comments

Comments
 (0)