-
-
Notifications
You must be signed in to change notification settings - Fork 104
Automated Resyntax fixes #1395
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Automated Resyntax fixes #1395
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -182,32 +182,26 @@ | |
|
|
||
|
|
||
| (define (add-constraint cr max) | ||
| (match cr | ||
| [(contract-restrict v rec constraints) | ||
| (define con (constraint v max)) | ||
| (if (trivial-constraint? con) | ||
| cr | ||
| (contract-restrict v rec (set-add constraints con)))])) | ||
| (match-define (contract-restrict v rec constraints) cr) | ||
| (define con (constraint v max)) | ||
| (if (trivial-constraint? con) cr (contract-restrict v rec (set-add constraints con)))) | ||
|
|
||
| (define (add-recursive-values cr dict) | ||
| (match cr | ||
| [(contract-restrict v rec constraints) | ||
| (contract-restrict v (free-id-table-union (list rec dict)) constraints)])) | ||
| (define (add-recursive-values cr dict) | ||
| (match-define (contract-restrict v rec constraints) cr) | ||
| (contract-restrict v (free-id-table-union (list rec dict)) constraints)) | ||
|
|
||
| (define (merge-restricts* min crs) | ||
| (apply merge-restricts min crs)) | ||
|
|
||
| (define (merge-restricts min . crs) | ||
| (match crs | ||
| [(list (contract-restrict vs rec constraints) ...) | ||
| (contract-restrict (merge-kind-maxes min vs) | ||
| (free-id-table-union rec) | ||
| (apply set-union (set) constraints))])) | ||
| (match-define (list (contract-restrict vs rec constraints) ...) crs) | ||
| (contract-restrict (merge-kind-maxes min vs) | ||
| (free-id-table-union rec) | ||
| (apply set-union (set) constraints))) | ||
|
|
||
| (define (merge-kind-maxes min-kind vs) | ||
| (match vs | ||
| [(list (kind-max variables maxes) ...) | ||
| (kind-max (free-id-set-union variables) (apply combine-kinds min-kind maxes))])) | ||
| (match-define (list (kind-max variables maxes) ...) vs) | ||
| (kind-max (free-id-set-union variables) (apply combine-kinds min-kind maxes))) | ||
|
|
||
| (define (close-loop names crs body) | ||
| (define eqs (make-equation-set)) | ||
|
|
@@ -225,35 +219,33 @@ | |
| (match km | ||
| [(kind-max ids actual) | ||
| (define-values (bvals unbound-ids) | ||
| (for/fold ([bvals '()] [ubids (make-immutable-free-id-table)]) | ||
| (for/fold ([bvals '()] | ||
| [ubids (make-immutable-free-id-table)]) | ||
|
Comment on lines
-228
to
+223
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This shouldn't have been reformatted, see jackfirth/resyntax#333. |
||
| ([(id _) (in-free-id-table ids)]) | ||
| (if (member id names) | ||
| (values (cons (contract-restrict-value (lookup-id id)) bvals) ubids) | ||
| (values bvals (free-id-table-set ubids id #t))))) | ||
| (merge-kind-maxes 'flat (cons (kind-max unbound-ids actual) bvals))])) | ||
|
|
||
| (define (instantiate-constraint con) | ||
| (match con | ||
| [(constraint km bound) | ||
| (constraint (instantiate-kind-max km) bound)])) | ||
|
|
||
| (match cr | ||
| [(contract-restrict (kind-max ids max) rec constraints) | ||
| (define-values (bound-vals unbound-ids) | ||
| (for/fold ([bvs '()] [ubids (make-immutable-free-id-table)]) | ||
| ([(id _) (in-free-id-table ids)]) | ||
| (if (member id names) | ||
| (values (cons (lookup-id id) bvs) ubids) | ||
| (values bvs (free-id-table-set ubids id #t))))) | ||
| (merge-restricts* 'flat (cons | ||
| (contract-restrict | ||
| (kind-max unbound-ids max) | ||
| rec | ||
| (for*/set ([c (in-immutable-set constraints)] | ||
| [ic (in-value (instantiate-constraint c))] | ||
| #:when (not (trivial-constraint? ic))) | ||
| ic)) | ||
| bound-vals))])) | ||
| (match-define (constraint km bound) con) | ||
| (constraint (instantiate-kind-max km) bound)) | ||
| (match-define (contract-restrict (kind-max ids max) rec constraints) cr) | ||
| (define-values (bound-vals unbound-ids) | ||
| (for/fold ([bvs '()] | ||
| [ubids (make-immutable-free-id-table)]) | ||
| ([(id _) (in-free-id-table ids)]) | ||
| (if (member id names) | ||
| (values (cons (lookup-id id) bvs) ubids) | ||
| (values bvs (free-id-table-set ubids id #t))))) | ||
| (merge-restricts* 'flat | ||
| (cons (contract-restrict (kind-max unbound-ids max) | ||
| rec | ||
| (for*/set ([c (in-immutable-set constraints)] | ||
| [ic (in-value (instantiate-constraint c))] | ||
| #:when (not (trivial-constraint? ic))) | ||
| ic)) | ||
| bound-vals))) | ||
|
|
||
| (for ([name (in-list names)] | ||
| [cr (in-list crs)]) | ||
|
|
||
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
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
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Another instance of sorawee/fmt#75.