Statically forbid promotion nodes in the untyped AST#1545
Merged
Conversation
We were consistently ignoring these extra type parameters in maps and folds
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1545 +/- ##
==========================================
+ Coverage 90.01% 90.07% +0.06%
==========================================
Files 63 63
Lines 9842 9836 -6
==========================================
+ Hits 8859 8860 +1
+ Misses 983 976 -7
🚀 New features to boost your workflow:
|
nhuurre
reviewed
Sep 9, 2025
Comment on lines
-70
to
+33
| ICE.with_exn_message (fun () -> Typechecker.check_program ast) | ||
| ICE.with_exn_message (fun () -> | ||
| Middle.( | ||
| Expr.Helpers.infer_type_of_indexed UnsizedType.UReal | ||
| [Index.Single Expr.Helpers.loop_bottom])) |
Collaborator
There was a problem hiding this comment.
So this test is just looking for some random ICE?
Member
Author
There was a problem hiding this comment.
Yes. It's not the most valuable test ever, but it prevents the ICE code from being marked as 0% test coverage
nhuurre
approved these changes
Sep 9, 2025
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.
This adds another type parameter to the ast which can be made empty for the untyped ast, allowing us to replace a couple ICEs in the happy path with refutation cases (
.) that the compiler proves unreachable.This has bugged me since adding the Promotion node a while back.
The main annoyance with doing this is that it would add another (broadly useless) argument to
@@derivingfunctions likemap_expression(andfold_...). I get around this by re-defining those helper functions towards the bottom of the file without the arguments we don't use, and cleaning up the usage sites.Submission Checklist
Release notes
Copyright and Licensing
By submitting this pull request, the copyright holder is agreeing to
license the submitted work under the BSD 3-clause license (https://opensource.org/licenses/BSD-3-Clause)