mirror of
https://github.com/carbon-language/carbon-lang.git
synced 2026-10-04 16:01:05 +01:00
Fix match bug when no case matches (#677)
This commit is contained in:
@@ -854,7 +854,7 @@ void StepStmt() {
|
||||
clause_num = (act->pos - 1) / 2;
|
||||
if (clause_num ==
|
||||
static_cast<int>(stmt->GetMatch().clauses->size())) {
|
||||
frame->todo.Pop(2);
|
||||
frame->todo.Pop(1);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,6 +59,7 @@ TEST_LIST = [
|
||||
"match_placeholder",
|
||||
"match_type",
|
||||
"next",
|
||||
"no_match",
|
||||
"pattern_init",
|
||||
"pattern_variable_fail",
|
||||
"placeholder_variable",
|
||||
|
||||
+12
@@ -0,0 +1,12 @@
|
||||
// Part of the Carbon Language project, under the Apache License v2.0 with LLVM
|
||||
// Exceptions. See /LICENSE for license information.
|
||||
// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
|
||||
|
||||
fn main() -> Int {
|
||||
var x: Int = 0;
|
||||
match (x) {
|
||||
case 1 =>
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
result: 0
|
||||
Reference in New Issue
Block a user