Skip to content

Commit

Permalink
sema: fix handling of comptime-matching, remove all cases if any case…
Browse files Browse the repository at this point in the history
… is not matched
  • Loading branch information
mertcandav committed Jul 25, 2024
1 parent ad084a3 commit 9fbcb0d
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions std/jule/sema/scope.jule
Original file line number Diff line number Diff line change
Expand Up @@ -1557,7 +1557,6 @@ impl scopeChecker {
if len(s.Stmts) != 1 {
ret
}

let stmt = s.Stmts[0]
match type stmt {
| &Data:
Expand All @@ -1582,7 +1581,7 @@ impl scopeChecker {
}
}

fn processConstMatch(mut &self, mut tm: &Match, mut &m: &MatchCase) {
fn processConstMatch(mut &self, mut &tm: &Match, mut &m: &MatchCase) {
for (i, mut c) in tm.Cases {
if c.Scope != nil {
let mut token: &Token = nil
Expand All @@ -1605,6 +1604,9 @@ impl scopeChecker {
}
self.checkComptimePanic(token, tm.Default.Scope)
}
} else {
// Remove all cases, no success matching.
tm.Cases = nil
}
}

Expand Down

0 comments on commit 9fbcb0d

Please sign in to comment.