aboutsummaryrefslogtreecommitdiff
path: root/src/Sema.zig
diff options
context:
space:
mode:
authorAndrew Kelley <andrew@ziglang.org>2021-03-31 15:39:04 -0700
committerAndrew Kelley <andrew@ziglang.org>2021-03-31 15:39:04 -0700
commitabd06d8eab508319e5f7839c802f4a81d80a0025 (patch)
tree4c718b756e129b76477e1fa850343cfe8c9191cb /src/Sema.zig
parente272c29c163538159eb81f60cb5da3d7ebe099f9 (diff)
downloadzig-abd06d8eab508319e5f7839c802f4a81d80a0025.tar.gz
zig-abd06d8eab508319e5f7839c802f4a81d80a0025.zip
stage2: clean up RangeSet and fix swapped Sema switch logic for lhs/rhs
Diffstat (limited to 'src/Sema.zig')
-rw-r--r--src/Sema.zig4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/Sema.zig b/src/Sema.zig
index e702a058dd..6af8cd7b9a 100644
--- a/src/Sema.zig
+++ b/src/Sema.zig
@@ -2888,7 +2888,7 @@ fn validateSwitchRange(
// because we only have the switch AST node. Only if we know for sure we need to report
// a compile error do we resolve the full source locations.
const first_val = val: {
- if (last.value()) |val| {
+ if (first.value()) |val| {
if (val.isUndef()) {
const src = switch_prong_src.resolve(block.src_decl, src_node_offset, .first);
return sema.failWithUseOfUndef(block, src);
@@ -2899,7 +2899,7 @@ fn validateSwitchRange(
return sema.failWithNeededComptime(block, src);
};
const last_val = val: {
- if (first.value()) |val| {
+ if (last.value()) |val| {
if (val.isUndef()) {
const src = switch_prong_src.resolve(block.src_decl, src_node_offset, .last);
return sema.failWithUseOfUndef(block, src);