Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from fitzgen/invalid-if-with-no-else
Add a test for an invalid, result-producing `if` with no `else`
- Loading branch information
Showing
2 changed files
with
20 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
(module | ||
(func (export "f") (param i32) (result i32) | ||
(local.get 0) | ||
(if (result i32) | ||
(then (i32.const 1)) | ||
;; Note: since the `if` block is supposed to produce a result, we need an | ||
;; `else` here to produce that result if the condition is false. | ||
;; | ||
;; (else (i32.const 2)) | ||
) | ||
) | ||
) |