Skip to content

Commit 975cd1d

Browse files
authored
Fix spurious warning for import A.: (#267)
1 parent e16c739 commit 975cd1d

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

src/parser.jl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2364,7 +2364,7 @@ function parse_atsym(ps::ParseState, allow_quotes=true)
23642364
# export outer ==> (export outer)
23652365
# export ($f) ==> (export ($ f))
23662366
mark = position(ps)
2367-
if allow_quotes && peek(ps) == K":"
2367+
if allow_quotes && peek(ps) == K":" && !is_closing_token(ps, peek(ps,2))
23682368
# import A.:+ ==> (import (importpath A (quote-: +)))
23692369
emit_diagnostic(ps, warning="quoting with `:` is not required here")
23702370
end

test/diagnostics.jl

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,8 @@ end
4040
Diagnostic(9, 9, :warning, "space between dots in import path")
4141
@test diagnostic("import A.:+") ==
4242
Diagnostic(10, 10, :warning, "quoting with `:` is not required here")
43+
# No warning for import `:` symbol
44+
@test diagnostic("import A.:, :", allow_multiple=true) == []
4345
@test diagnostic("import A.(:+)") ==
4446
Diagnostic(10, 13, :warning, "parentheses are not required here")
4547
@test diagnostic("export (x)") ==

0 commit comments

Comments
 (0)