# Sema: fix comptime break semantics · gitcafe/zig

[View on GitCafe](https://git.cafe/gitcafe/zig/commit/f4e051e35d8019c9a8d99ccae8f2e9d8f032629a)

Repository: [gitcafe/zig](https://git.cafe/gitcafe/zig)

Visibility: public

Requested revision: f4e051e35d8019c9a8d99ccae8f2e9d8f032629a

Requested commit: f4e051e35d8019c9a8d99ccae8f2e9d8f032629a

Commit: f4e051e35d8019c9a8d99ccae8f2e9d8f032629a

Tree: cbeebf38b85f5aaaaff50ea7f9f875c02ac63667

Author: Andrew Kelley

Committer: Andrew Kelley

## Message

```
Sema: fix comptime break semantics

Previously, breaking from an outer block at comptime would result in
incorrect control flow. Now there is a mechanism, `error.ComptimeBreak`,
similar to `error.ComptimeReturn`, to send comptime control flow further
up the stack, to its matching block.

This commit also introduces a new log scope. To use it, pass
`--debug-log sema_zir` and you will see 1 line per ZIR instruction
semantically analyzed. This is useful when you want to understand what
comptime control flow is doing while debugging the compiler.

One more `switch` test case is passing.

```

## Parents

- [79628d48a4429818bddef2e86e2d7073d1955302](https://git.cafe/gitcafe/zig/commit/79628d48a4429818bddef2e86e2d7073d1955302?format=markdown)

[Source at this commit](https://git.cafe/gitcafe/zig/tree/f4e051e35d8019c9a8d99ccae8f2e9d8f032629a?format=markdown)
