Skip to content
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

Binding rules to support contract inheritance #1075

Merged
merged 40 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
658979c
Implement simple contract inheritance rules
ggiraldez Aug 2, 2024
965f5dc
Inherited members should be accessible to subclassing contracts
ggiraldez Aug 2, 2024
5077953
Add preliminary support for `super` resolution
ggiraldez Aug 9, 2024
3b141fd
Add bindings API function to retrieve *all* definitions from a reference
ggiraldez Aug 12, 2024
77f0047
Set edge precedences to resolve to nearest method implementations
ggiraldez Aug 23, 2024
ce26cbf
Add one more test case for virtual methods with single inheritance
ggiraldez Aug 26, 2024
178c77b
Always prioritize members defined in the same contract to any in the …
ggiraldez Aug 28, 2024
b8eadaa
FAILING diamond inheritance example
ggiraldez Aug 28, 2024
c925748
Disable precedence attributes used to control virtual method lookups
ggiraldez Sep 3, 2024
6165e2e
Add selector attribute and disambiguate definitions on deconstruction…
ggiraldez Sep 4, 2024
b8a3924
Extend tests to check for virtual methods from sub-contracts
ggiraldez Sep 5, 2024
6f72dda
Selector attributes are more explicit; refactor definition selection …
ggiraldez Sep 5, 2024
214de5e
Add code to detect `super` method invocations
ggiraldez Sep 5, 2024
01612ea
Refactor: extract binding resolution code into a separate module
ggiraldez Sep 5, 2024
0ba480d
Refactor: implement scoring system to disambiguate definitions
ggiraldez Sep 6, 2024
e49d5b7
Refactor: parents attribute allows defining topology
ggiraldez Sep 6, 2024
fe5157f
Add parent information to references in expressions
ggiraldez Sep 6, 2024
de2aa17
Refactor: remove Definition::is_alias() and implement Hash and Debug …
ggiraldez Sep 6, 2024
cee7e66
Implement C3 linearisation and use it to rank multiple possible defin…
ggiraldez Sep 6, 2024
6bb2277
Avoid exposing Builder and Resolver modules to the public API
ggiraldez Sep 6, 2024
c7324ef
Cleanup rules file removing obsolete comments
ggiraldez Sep 6, 2024
46f95db
Refactor: extract C3 linearisation algorithm into its own module
ggiraldez Sep 9, 2024
772b690
Detect cycles when computing linearisation
ggiraldez Sep 9, 2024
be962d2
Handle cycles in definition hierarchy when printing references and de…
ggiraldez Sep 9, 2024
58904d4
Add test case for import aliases when the imports cannot be resolved
ggiraldez Sep 9, 2024
694648d
Fix documentation and remove obsolete TODO
ggiraldez Sep 9, 2024
8fea53b
Generate .dot files locally as well as Mermaid files
ggiraldez Sep 10, 2024
26a32dc
Add sample to inspect graph output and figure out injecting virtual m…
ggiraldez Sep 10, 2024
f679d8f
Refactor bindings extra attributes and add import/export nodes
ggiraldez Sep 11, 2024
29821c9
Fix linter warning and make new structs crate private
ggiraldez Sep 11, 2024
37c0b60
Link function definitions in contracts to the export node `virtual_me…
ggiraldez Sep 11, 2024
196ccb9
Add support for setting a binding context to testing harness
ggiraldez Sep 11, 2024
5376224
Add virtual lookup with context test cases
ggiraldez Sep 11, 2024
a409df5
Implement Bindings context setting, which alters C3 linearisation
ggiraldez Sep 11, 2024
a8a847c
When ranking with linearisation, handle `super` calls and cull the ca…
ggiraldez Sep 11, 2024
b4520d7
Return a `Result<Definition, _>` from `Reference::jump_to_definition()`
ggiraldez Sep 12, 2024
49d2c65
Refactor: rename `Selector` (and related identifiers) to `Tag`
ggiraldez Sep 13, 2024
4718031
Refactor: change `get_tag` for `has_tag` for readability
ggiraldez Sep 13, 2024
4531b54
Refactor: prefer `match` instead of `if let ... else` for readability
ggiraldez Sep 13, 2024
caf4bc0
Allow tagging references and add "super" for `super` call references
ggiraldez Sep 13, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions crates/infra/utils/src/codegen/formatting.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ fn generate_header(file_path: &Path) -> String {
"ebnf" => format!("(* {warning_line} *)"),
"json" => String::new(),
"html" | "md" => format!("<!-- {warning_line} -->"),
"js" | "rs" | "ts" | "wit" => format!("// {warning_line}"),
"dot" | "js" | "rs" | "ts" | "wit" => format!("// {warning_line}"),
"yml" | "txt" => format!("# {warning_line}"),
"mmd" => format!("%% {warning_line}"),
ext => panic!("Unsupported extension to generate a header for: {ext}"),
Expand All @@ -53,7 +53,7 @@ fn run_formatter(file_path: &Path, contents: &str) -> Result<String> {
// We already generate formatted content for these, so no need to run expensive formatting.
Ok(contents.to_owned())
}
"ebnf" | "mmd" | "txt" | "wit" => {
"dot" | "ebnf" | "mmd" | "txt" | "wit" => {
// No formatters available for these (yet).
Ok(contents.to_owned())
}
Expand Down
170 changes: 78 additions & 92 deletions crates/metaslang/bindings/generated/public_api.txt

Large diffs are not rendered by default.

Loading
Loading