Skip to content

Commit f21530f

Browse files
authored
add a dummy case macro for auto-completion (#145)
1 parent 2b7f0a7 commit f21530f

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

src/MatchImpl.jl

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ if isdefined(Base, :Experimental) && isdefined(Base.Experimental, Symbol("@compi
55
end
66

77
export is_enum,
8-
pattern_uncall, pattern_unref, pattern_unmacrocall, @switch, @tryswitch, @match, @trymatch, Where, gen_match, gen_switch
8+
pattern_uncall, pattern_unref, pattern_unmacrocall, @switch, @case, @tryswitch, @match, @trymatch, Where, gen_match, gen_switch
99
export Q
1010
import MLStyle
1111
using MLStyle: mlstyle_report_deprecation_msg!
@@ -389,6 +389,11 @@ macro switch(val, ex)
389389
res = init_cfg(res)
390390
esc(res)
391391
end
392+
393+
macro case(pattern)
394+
throw(ArgumentError("@case can only be used inside @switch or @tryswitch"))
395+
end
396+
392397
"""
393398
@tryswitch <item> begin
394399
@case <pattern>

0 commit comments

Comments
 (0)