Skip to content

Commit d3fb8f9

Browse files
Validation: Disallow select on reference types
1 parent eecaf99 commit d3fb8f9

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

Sources/WasmKit/Translator.swift

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1489,6 +1489,8 @@ struct InstructionTranslator<Context: TranslatorContext>: InstructionVisitor {
14891489
let (value1Type, value1) = try popAnyOperand()
14901490
let (value2Type, value2) = try popAnyOperand()
14911491
switch (value1Type, value2Type) {
1492+
case (.some(.ref(_)), _), (_, .some(.ref(_))):
1493+
throw TranslationError("Cannot `select` on reference types")
14921494
case let (.some(type1), .some(type2)):
14931495
guard type1 == type2 else {
14941496
throw TranslationError("Type mismatch on `select`. Expected \(value1Type) and \(value2Type) to be same")

Tests/WasmKitTests/SpectestTests.swift

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ final class SpectestTests: XCTestCase {
2222
path: Self.testPaths,
2323
include: [],
2424
exclude: [
25-
"select.wast",
2625
"start.wast",
2726
"table-sub.wast",
2827
"table.wast",

0 commit comments

Comments
 (0)