Skip to content

Commit 33184ba

Browse files
committed
Add tests for #57334, #57470
1 parent e364e20 commit 33184ba

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

test/syntax.jl

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4102,3 +4102,29 @@ module Ambig57404
41024102
using .B
41034103
end
41044104
@test Ambig57404.S == 1
4105+
4106+
# #57334
4107+
let
4108+
x57334 = Ref(1)
4109+
@test_throws "syntax: `const` left hand side \"x57334[]\" contains non-variables" Core.eval(@__MODULE__, :(const x57334[] = 1))
4110+
end
4111+
4112+
# #57470
4113+
module M57470
4114+
using ..Test
4115+
@test_throws(
4116+
"syntax: `global const` declaration not allowed inside function",
4117+
Core.eval(@__MODULE__, :(function f57470()
4118+
const global x57470 = 1
4119+
end)))
4120+
@test_throws(
4121+
"unsupported `const` declaration on local variable",
4122+
Core.eval(@__MODULE__, :(let
4123+
const y57470 = 1
4124+
end))
4125+
)
4126+
let
4127+
global const z57470 = 1
4128+
const global w57470 = 1
4129+
end
4130+
end

0 commit comments

Comments
 (0)