fix(aiken-lang): handle fail/todo constant eval without panic#1371
Open
knoal wants to merge 1 commit into
Open
fix(aiken-lang): handle fail/todo constant eval without panic#1371knoal wants to merge 1 commit into
knoal wants to merge 1 commit into
Conversation
Replace the blanket .unwrap_or_else(|e| panic!(...)) with explicit match on the eval result: - Err(Error::EvaluationFailure) → fall back to the unevaluated term; this is correct because fail/todo terms are *supposed* to fail at runtime, not during constant folding in codegen. - Err(any other error) → propagate the panic; these indicate genuine problems we should not silently swallow. - Ok(term) → use the evaluated constant as before. This addresses KtorZ's review feedback on PR aiken-lang#1344: we no longer silently change compiler behaviour for non-EvaluationFailure errors. Fixes aiken-lang#1314.
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1314.
What was wrong (original PR #1344)
The original fix used a blanket fallback for ALL eval errors. KtorZ correctly pointed out that silently swallowing every error changes compiler behaviour — a real problem (e.g. a broken cost model or internal bug) would now compile silently instead of being surfaced.
The fix (v2)
Explicitly match on the variant instead:
Test
Added which:
All 180 gen_uplc tests pass.