File tree Expand file tree Collapse file tree 2 files changed +37
-0
lines changed
Expand file tree Collapse file tree 2 files changed +37
-0
lines changed Original file line number Diff line number Diff line change @@ -238,6 +238,11 @@ fn (mut c Checker) match_expr(mut node ast.MatchExpr) ast.Type {
238238 }
239239 }
240240
241+ for mut expr in branch.exprs {
242+ // (expr) => expr
243+ expr = expr.remove_par ()
244+ }
245+
241246 if ! c.pref.translated && ! c.file.is_translated {
242247 // check for always true/false match branch
243248 for mut expr in branch.exprs {
Original file line number Diff line number Diff line change 1+ module main
2+
3+ enum TokenType {
4+ null
5+ word
6+ get_word
7+ set_word
8+ lit_word
9+ int_value
10+ dec_value
11+ bin_value
12+ str_value
13+ block_start
14+ block_end
15+ expr_start
16+ expr_end
17+ comment
18+ }
19+
20+ fn test_match_branch_par_expr () {
21+ t := TokenType.word
22+ s := match t {
23+ (TokenType.null) { '' }
24+ (TokenType.word) { 'a' }
25+ (TokenType.get_word) { 'b' }
26+ (TokenType.set_word) { 'c' }
27+ (TokenType.lit_word) { 'd' }
28+ else { 'other' }
29+ }
30+
31+ assert s == 'a'
32+ }
You can’t perform that action at this time.
0 commit comments