Commit ff6cf2b
committed
Reimplement
This commit is a complete reimplementation of `wac-parser`'s resolution to be
based on `wac-graph`.
It also contains an overhaul of the `wac-graph` API to facilitate its use from
`wac-parser`:
* Reimplements `CompositionGraph` on top of `petgraph::StableDiGraph`, which
eliminates needing to keep track of nodes internally to `CompositionGraph`.
* Packages now populate their type information into the graph's types
collection rather than having their own collections.
* Splits the `Error` enum into discrete error types for each graph operation;
this allows the AST resolver to properly attach span information to errors.
* Add type dependency edges for defined types, ensuring topological ordering.
* Fix encoding of defined type aliases so that each encoded alias refers to the
export index of the previously encoded type.
* Added a debug formatter for `CompositionGraph` that outputs a DOT
representation (used in resolution tests as well).
* Graph encoding now includes an optional producers custom section.
* Fixed toposort to be in ascending node index order for independent nodes.
The subtype checker implementation was reverted to the previous implementation,
where `invert` and `revert` are called at specific points to change the type of
check being performed; the newer implementation did not give the correct
"expected, found" error messages for AST resolution.
`wac resolve` now outputs a DOT representation of the resolved composition
graph instead of JSON.
Most of the deleted code comes from code that has already moved into
`wac-types` and `wac-graph`.
Closes #79.
Fixes #78.
Fixes #76.wac-parser on wac-graph.1 parent 1ad1447 commit ff6cf2b
89 files changed
Lines changed: 3678 additions & 9390 deletions
File tree
- crates
- wac-graph
- src
- tests
- graphs
- argument-already-satisfied
- argument-type-mismatch
- implicit-import-conflict
- import-already-exists
- invalid-import-name
- invalid-package-version
- merged-func-results
- not-an-instance
- not-instantiation
- package-missing-export
- simple
- type-aggregation-error
- unknown-package
- unqualified-package-path
- wac-parser
- src
- resolution
- tests
- encoding
- fail
- arg-merge-failure
- bar
- foo
- implicit-arg-conflict/foo
- import-conflict/foo
- unmergeable-args
- bar
- foo
- resolution
- fail
- wac-resolver
- src
- tests
- wac-types/src
- src
- commands
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| 22 | + | |
| 23 | + | |
22 | 24 | | |
23 | 25 | | |
24 | 26 | | |
| |||
30 | 32 | | |
31 | 33 | | |
32 | 34 | | |
33 | | - | |
34 | 35 | | |
35 | 36 | | |
36 | 37 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
21 | 21 | | |
22 | 22 | | |
23 | 23 | | |
| 24 | + | |
24 | 25 | | |
25 | 26 | | |
26 | 27 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | | - | |
| 1 | + | |
2 | 2 | | |
| 3 | + | |
3 | 4 | | |
4 | 5 | | |
5 | 6 | | |
| |||
116 | 117 | | |
117 | 118 | | |
118 | 119 | | |
119 | | - | |
| 120 | + | |
120 | 121 | | |
121 | 122 | | |
122 | 123 | | |
123 | | - | |
| 124 | + | |
124 | 125 | | |
125 | 126 | | |
126 | 127 | | |
| |||
0 commit comments