Skip to content

Commit feb7d2c

Browse files
mohsen1claude
andcommitted
Complete: SOLV-41 Fix error-case fallbacks in lower_literal_type
Hardened the lower_literal_type function to propagate errors instead of silently accepting invalid code with ANY type: - Changed operand retrieval failure from ANY to ERROR (line 1914) - Changed unknown operand kind fallback from ANY to ERROR (line 1957) - Changed missing unary expression data fallback from ANY to ERROR (line 1960) - Changed unknown literal kind fallback from ANY to ERROR (line 1963) - Changed missing literal node fallback from ANY to ERROR (line 1966) - Changed missing literal type data fallback from ANY to ERROR (line 1969) This continues the work from SOLV-40 to align with PROJECT_DIRECTION.md directive to propagate errors and reduce unsoundness. Co-Authored-By: Claude Opus 4.5 <[email protected]>
1 parent 068e307 commit feb7d2c

2 files changed

Lines changed: 14 additions & 6 deletions

File tree

WORKER_11_TASK_LIST.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,14 @@
77
(none yet)
88

99
## Completed
10+
- [x] **SOLV-41: Fix error-case fallbacks in lower.rs**
11+
- Changed operand retrieval failure from ANY to ERROR (lower.rs:1914)
12+
- Changed unknown operand kind fallback from ANY to ERROR (lower.rs:1957)
13+
- Changed missing unary expression data fallback from ANY to ERROR (lower.rs:1960)
14+
- Changed unknown literal kind fallback from ANY to ERROR (lower.rs:1963)
15+
- Changed missing literal node fallback from ANY to ERROR (lower.rs:1966)
16+
- Changed missing literal type data fallback from ANY to ERROR (lower.rs:1969)
17+
- Hardened lower_literal_type function to propagate errors instead of silently accepting
1018
- [x] **SOLV-40: Fix type lowering fallback and repair broken merges**
1119
- Changed catch-all `_ => TypeId::ANY` to `_ => TypeId::ERROR` in lower.rs:448
1220
- This aligns with PROJECT_DIRECTION.md directive to propagate errors

wasm/src/solver/lower.rs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1911,7 +1911,7 @@ impl<'a> TypeLowering<'a> {
19111911
if let Some(unary) = self.arena.get_unary_expr(literal_node) {
19121912
let op = unary.operator;
19131913
let Some(operand_node) = self.arena.get(unary.operand) else {
1914-
return TypeId::ANY;
1914+
return TypeId::ERROR; // Propagate error for missing operand
19151915
};
19161916
match operand_node.kind {
19171917
k if k == SyntaxKind::NumericLiteral as u16 => {
@@ -1954,19 +1954,19 @@ impl<'a> TypeLowering<'a> {
19541954
TypeId::BIGINT
19551955
}
19561956
}
1957-
_ => TypeId::ANY,
1957+
_ => TypeId::ERROR, // Propagate error for unknown operand kind
19581958
}
19591959
} else {
1960-
TypeId::ANY
1960+
TypeId::ERROR // Propagate error for missing unary expression data
19611961
}
19621962
}
1963-
_ => TypeId::ANY,
1963+
_ => TypeId::ERROR, // Propagate error for unknown literal kind
19641964
}
19651965
} else {
1966-
TypeId::ANY
1966+
TypeId::ERROR // Propagate error for missing literal node
19671967
}
19681968
} else {
1969-
TypeId::ANY
1969+
TypeId::ERROR // Propagate error for missing literal type data
19701970
}
19711971
}
19721972

0 commit comments

Comments
 (0)