Module-level assertions #8
No reviewers
Labels
No labels
Compat
Breaking
Kind/Bug
Kind/Documentation
Kind/Enhancement
Kind/Feature
Kind/Security
Kind/Testing
Priority
Critical
Priority
High
Priority
Low
Priority
Medium
Reviewed
Confirmed
Reviewed
Duplicate
Reviewed
Invalid
Reviewed
Won't Fix
Status
Abandoned
Status
Blocked
Status
Need More Info
No milestone
No project
No assignees
3 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: auxolotl/lib#8
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "austreelis/feat/modules-assertions"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
I had a usecase for assertions in the module system for my trivial builders PR in tidepool, so I added a pretty basic way of defining them.
It's somewhat quick and dirty I feel like, and given lib has hit 1.0 I precautiously added a warning "module assertions are experimental" if a module defines them, which is traced just before checking them. Assertions are not checked if
__module__.check = false.I also took the liberty to fixup little things in tests and the module lib (the 3 commits with
fix:).Each commit is rather tiny, but I split them up for review. re-formatting is in the last one.
module.checkistruee3af6289ddbuiltins.trace55df6212e0@ -706,2 +745,4 @@elsebuiltins.throw messageelse if config.__module__.check && merged.assertions != [ ] thenbuiltins.trace "[ WARN]: module assertions are experimental" builtins.foldl' (Seems like there is an extra space after the
[.I think this makes a good amount of sense to support as a part of the module system since they are so useful. The code here looks good, just have a few conflicts after the recent PR merges.
I'll rebase and fix the space tomorrow :3
adef04e281to6cc1802d06Painfully but successfully rebased :) Should be good to merge
I am strongly in favor of making
assertionsbe a top-level thingy in modules, as this PR does. I recently had to deal with assertion in nixpkgs and was really annoyed that they live inconfigover there.I would like to merge this now so we can start relying on it, including in foundation#11, and then I would like to see a followup PR which documents it :)
also I can confirm that
test.shpasses on my endExcellent, awesome work @austreelis!