Skip to content

Commit 0d43ed0

Browse files
authored
Merge pull request #392 from N5N3/master
public is allowed as function name in toplevel
2 parents 4d68f48 + 12c69cb commit 0d43ed0

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/components/keywords.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ function parse_kw(ps::ParseState; is_toplevel = false)
7373
elseif k === Tokens.PRIMITIVE
7474
return @default ps parse_primitive(ps)
7575
elseif k === Tokens.PUBLIC
76-
if is_toplevel && VERSION > v"1.11-"
76+
if is_toplevel && !isemptyws(ps.ws) && VERSION > v"1.11-"
7777
return @default ps parse_public(ps)
7878
else
7979
return EXPR(:IDENTIFIER, ps)

test/parser/test_keyword_blocks.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -202,6 +202,8 @@ if VERSION > v"1.11-"
202202
bar
203203
""" |> test_expr
204204
@test "f() = public" |> test_expr
205+
@test "public(x) = 1" |> test_expr
206+
@test "public(x)" |> test_expr
205207
@test """
206208
let
207209
public

0 commit comments

Comments
 (0)