-
Notifications
You must be signed in to change notification settings - Fork 57
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
Allow structural recursion in type aliases #1207
Merged
antoniosarosi
merged 26 commits into
antonio/type-aliases
from
antonio/type-aliases-with-cycles
Dec 18, 2024
Merged
Changes from 6 commits
Commits
Show all changes
26 commits
Select commit
Hold shift + click to select a range
e38e5e7
Allow structural recursion
antoniosarosi 794b3f4
Pass structural cycles to IR
antoniosarosi 9869707
Test structural recursion finder
antoniosarosi 81f776a
Merge branch 'antonio/type-aliases' into antonio/type-aliases-with-cy…
antoniosarosi 3582b18
Merge branch 'antonio/type-aliases' into antonio/type-aliases-with-cy…
antoniosarosi fab92f5
Merge `antonio/type-aliases`
antoniosarosi 5093eb9
Merge branch 'antonio/type-aliases' into antonio/type-aliases-with-cy…
antoniosarosi c09997a
Merge `antonio/type-aliases`
antoniosarosi cd5e1f8
Merge branch 'antonio/type-aliases' into antonio/type-aliases-with-cy…
antoniosarosi ba8177a
Merge branch 'antonio/type-aliases' into antonio/type-aliases-with-cy…
antoniosarosi 72ea8cb
Implement codegen for Python type aliases
antoniosarosi 140b3dd
Integ test works! Yeah
antoniosarosi 68b98b7
Fix structural cycles rendering
antoniosarosi d462e5c
Coerce is wonky
antoniosarosi e0ae448
Fix test `relevant_data_models`
antoniosarosi abb7430
`is_subtype_of` causing issues with aliases
antoniosarosi c4e8b85
Fixed `subtype`, `coerce` still doesn't work
antoniosarosi d6b1e9e
Add integ tests for TS
antoniosarosi c5267b5
Remove recursion debug limit
antoniosarosi cac1a16
Add more tests (doesn't work because of score function)
antoniosarosi 39141cb
Add codegen for TS
antoniosarosi 401a97d
Add docs for Ruby type alias
antoniosarosi fc25050
Fix OpenAPI map keys
antoniosarosi 342fb5e
Fix score of `JsonToString` flag
antoniosarosi 2e10579
Fix integ tests for json type cycle
antoniosarosi 8ff0397
Fix scoring ranking whaterver
antoniosarosi 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 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 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 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 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 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 |
---|---|---|
|
@@ -6,6 +6,7 @@ | |
use std::{ | ||
cmp, | ||
collections::{HashMap, HashSet}, | ||
fmt::Debug, | ||
hash::Hash, | ||
}; | ||
|
||
|
@@ -126,8 +127,14 @@ impl<'g, V: Eq + Ord + Hash + Copy> Tarjan<'g, V> { | |
self.index += 1; | ||
self.stack.push(node_id); | ||
|
||
// TODO: @antoniosarosi: HashSet is random, won't always iterate in the | ||
// same order. Fix this with IndexSet or something, we really don't want | ||
// to sort this every single time. | ||
let mut successors = Vec::from_iter(&self.graph[&node_id]); | ||
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. Consider using |
||
successors.sort(); | ||
|
||
// Visit neighbors to find strongly connected components. | ||
for successor_id in &self.graph[&node_id] { | ||
for successor_id in successors { | ||
// Grab owned state to circumvent borrow checker. | ||
let mut successor = self.state[successor_id]; | ||
if successor.index == Self::UNVISITED { | ||
|
This file contains 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 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 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
Oops, something went wrong.
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.
The comment here is misleading. It states that cycles left after validation are allowed, but the code actually rebuilds the cycles for rendering purposes. Consider updating the comment to reflect the actual behavior.