Commit Graph

42 Commits

Author SHA1 Message Date
Geoffrey White
1d815b16d6 Rust: Update test expectations. 2025-08-27 10:42:45 +01:00
Geoffrey White
152ae1d29b Rust: Codegen. 2025-08-27 10:42:42 +01:00
Paolo Tranquilli
de72e68d2c Merge branch 'main' into redsun82/codegen-new-parent-child 2025-06-26 12:14:53 +02:00
Paolo Tranquilli
fa006e3ea5 Rust: fix test 2025-06-25 14:17:14 +02:00
Paolo Tranquilli
355fd85c23 Codegen: remove unneeded has|getNumberOf in instance tests 2025-06-25 12:02:13 +02:00
Paolo Tranquilli
6bbf1e3bc1 Codegen: use one generated test file per directory
This collapses all generated test QL sources into a single one per
directory, using query predicates to run the different tests.

This should improve the time required to run generated tests.
2025-06-25 11:44:54 +02:00
Paolo Tranquilli
1dcd60527c Codegen: improve implementation of generated parent/child relationship
This improves the implementation of the generated parent/child
relationship by adding a new `all_children` field to `ql.Class` which
lists all children (both direct and inherited) of a class, carefully
avoiding duplicating children in case of diamond inheritance. This:
* simplifies the generated code,
* avoid children ambiguities in case of diamond inheritance.

This only comes with some changes in the order of children in the
generated tests (we were previously sorting bases alphabetically there).
For the rest this should be a non-functional change.
2025-06-24 17:26:24 +02:00
Paolo Tranquilli
ad7fb9c061 Merge branch 'main' into redsun82/rust-has-implementation 2025-06-12 15:25:59 +02:00
Paolo Tranquilli
a405a12e93 Rust: add Callable::getParam and CallExprBase::getArg shortcuts 2025-06-10 09:51:26 +02:00
Paolo Tranquilli
04c9feed36 Rust: accept test changes 2025-06-03 10:41:31 +02:00
Paolo Tranquilli
667eed9b9b Rust: store in the DB if a library function or const had a body
When skipping bodies in library code, we lose the information whether a
body was originally present. This can be important, for example when
determining whether a trait method has a default implementation.

With this change that information can be recovered via the
`hasImplementation` predicate.
2025-06-03 10:41:31 +02:00
Paolo Tranquilli
a7a887c828 Rust: separate attribute macro and macro call expansions 2025-04-29 16:18:40 +02:00
Paolo Tranquilli
2d32c366d8 Rust: add missing expected files 2025-04-28 10:46:36 +02:00
Paolo Tranquilli
adeaceb7af Rust: accept test changes 2025-04-25 17:41:13 +02:00
Paolo Tranquilli
49cf1739a4 Rust: expand attribute macros 2025-04-25 16:16:49 +02:00
Paolo Tranquilli
e89cf303e7 Rust: rename TypeRef -> TypeRepr 2024-12-02 17:58:40 +01:00
Paolo Tranquilli
2a7ce9a0ab Rust: accept all test changes 2024-12-02 12:06:51 +01:00
Paolo Tranquilli
fce13aeb35 Rust: accept test changes 2024-11-19 17:50:14 +01:00
Paolo Tranquilli
e5a199b821 Rust: accept test changes due to toString implementations 2024-10-31 16:02:56 +01:00
Paolo Tranquilli
9c95a17882 Rust: add block ids to canonical paths, making them "extended" 2024-10-28 12:41:05 +01:00
Paolo Tranquilli
34b1055c13 Rust: accept test changes 2024-10-25 16:58:04 +02:00
Paolo Tranquilli
194e0daa8c Rust: add canonical_path and crate_origin to Item 2024-10-25 16:58:04 +02:00
Tom Hvitved
0ec40afa4c Rust: Update expected test output 2024-10-11 12:44:35 +02:00
Tom Hvitved
8cc349e85f Rust: Run codegen 2024-10-11 12:01:16 +02:00
Arthur Baars
32e9881cfb Rust: update expected output 2024-10-10 14:25:07 +02:00
Arthur Baars
30034b4254 Rust: run 'bazel //rust/codegen' 2024-10-10 14:25:06 +02:00
Arthur Baars
e6e0e6eb66 Rust: accept expected output 2024-09-20 15:51:01 +02:00
Arthur Baars
a9423f4bdb Rust: codegen 2024-09-20 15:50:59 +02:00
Arthur Baars
80d32a2333 Rust: re-generate code 2024-09-19 13:00:46 +02:00
Tom Hvitved
4dd3059f16 Rust: Run code generator 2024-09-16 13:39:55 +02:00
Arthur Baars
8e378d86df Update test data 2024-09-12 22:18:00 +02:00
Arthur Baars
7572546efa Improve handling of unimplemented nodes 2024-09-12 22:17:39 +02:00
Paolo Tranquilli
4f90f5fb4c Rust: accept test changes 2024-09-10 17:36:18 +02:00
Paolo Tranquilli
ef06b555c1 Rust: accept test changes 2024-09-10 11:29:54 +02:00
Paolo Tranquilli
10a23c0843 Merge branch 'rust-experiment' into redsun82/rust-doctest-gen 2024-09-09 12:20:55 +02:00
Paolo Tranquilli
ac9e977baa Rust: remove accidental test source file 2024-09-06 14:29:10 +02:00
Paolo Tranquilli
18c423eb55 Rust: fix formatting of code snippet in docstring 2024-09-06 14:27:57 +02:00
Paolo Tranquilli
6111a7497d Rust: remove accidental schema annotation 2024-09-06 14:26:36 +02:00
Paolo Tranquilli
8c5cc2efdc Rust: generate test code from schema docstrings
This generates test source files from code blocks in class docstrings.

By default the test code is generated as is, but it can optionally:
* be wrapped in a function providing an adequate context using
  `@rust.doc_test_function(name, *, lifetimes=(), return_type="()", **kwargs)`,
  with `kwargs` providing both generic and normal params depending on
  capitalization
* be skipped altogether using `@rust.skip_doc_test`

So for example an annotation like
```python
@rust.doc_test_function("foo",
                        lifetimes=("a",),
                        T="Eq",
                        x="&'a T",
                        y="&'a T",
                        return_type="&'a T")
```
will result in the following wrapper:
```rust
fn foo<'a, T: Eq>(x: &'a T, y: &'a T) -> &'a T {
    // example code here
}
```
2024-09-06 14:24:42 +02:00
Arthur Baars
46d6bbb458 Rust: update generated code 2024-09-05 16:59:29 +02:00
Paolo Tranquilli
885e89a927 Rust: first running tests 2024-08-30 17:45:51 +02:00
Paolo Tranquilli
590a146b49 Rust: some basic extraction of function names (with locations!) 2024-08-29 17:58:50 +02:00