Skip to content

Commit 8b65f03

Browse files
committed
Remove matchtag use from SwitchStmt.
1 parent e08fd9e commit 8b65f03

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

compiler/semantics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2762,7 +2762,7 @@ bool Semantics::CheckSwitchStmt(SwitchStmt* stmt) {
27622762
}
27632763
if (tag_ok) {
27642764
AutoErrorPos aep(expr->pos());
2765-
matchtag(v.type(), type, MATCHTAG_COERCE);
2765+
TypeChecker::DoCoerce(expr->pos(), v.type(), type);
27662766
}
27672767

27682768
if (!case_values.count(value))
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
tests/compile-only/fail-switch-tag-mismatch.sp(21) : error 450: no viable conversion from "Bar" to "Foo"
2+
tests/compile-only/fail-switch-tag-mismatch.sp(22) : warning 253: implicit conversion from "int" to "Foo" is undefined
3+
tests/compile-only/fail-switch-tag-mismatch.sp(23) : error 450: no viable conversion from "float" to "Foo"

tests/compile-only/warn-switch-tag-mismatch.txt

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)