Rust: fix QL compilation errors

This commit is contained in:
Paolo Tranquilli
2024-11-29 15:55:51 +01:00
parent 9cf2420c3b
commit c46f44da5f
45 changed files with 855 additions and 843 deletions

View File

@@ -114,13 +114,13 @@ class _:
"""
class PathExprBase(Expr, Resolvable):
class PathExprBase(Expr):
"""
A path expression or a variable access in a formatting template. See `PathExpr` and `FormatTemplateVariableAccess` for further details.
"""
@annotate(PathExpr, replace_bases={Expr: PathExprBase}, cfg = True)
@annotate(PathExpr, replace_bases={Expr: PathExprBase}, add_bases=(PathAstNode,), cfg = True)
@qltest.test_with(Path)
class _:
"""
@@ -132,6 +132,7 @@ class _:
let z = <TypeRef as Trait>::foo;
```
"""
path: drop
@annotate(IfExpr, cfg = True)
@@ -412,7 +413,7 @@ class _:
"""
@annotate(RecordExpr, add_bases=(Resolvable,), cfg = True)
@annotate(RecordExpr, add_bases=(PathAstNode,), cfg = True)
class _:
"""
A record expression. For example:
@@ -423,6 +424,7 @@ class _:
Foo { .. } = second;
```
"""
path: drop
@annotate(FieldExpr, cfg = True)
@@ -682,7 +684,7 @@ class _:
"""
@annotate(RecordPat, add_bases=(Resolvable,), cfg = True)
@annotate(RecordPat, add_bases=(PathAstNode,), cfg = True)
class _:
"""
A record pattern. For example:
@@ -693,6 +695,7 @@ class _:
}
```
"""
path: drop
@annotate(RangePat, cfg = True)
@@ -723,7 +726,7 @@ class _:
"""
@annotate(PathPat, add_bases=(Resolvable,), cfg = True)
@annotate(PathPat, add_bases=(PathAstNode,), cfg = True)
@qltest.test_with(Path)
class _:
"""
@@ -735,6 +738,7 @@ class _:
}
```
"""
path: drop
@annotate(LiteralPat, cfg = True)
@@ -769,7 +773,7 @@ class _:
"""
@annotate(TupleStructPat, add_bases=(Resolvable,), cfg = True)
@annotate(TupleStructPat, add_bases=(PathAstNode,), cfg = True)
class _:
"""
A tuple struct pattern. For example:
@@ -781,6 +785,7 @@ class _:
};
```
"""
path: drop
@annotate(RefPat, cfg = True)

View File

@@ -89,7 +89,14 @@ class Addressable(AstNode):
class Resolvable(AstNode):
"""
Either a `PathExpr`, a `PathPat`, or a `MethodCallExpr`.
One of `PathExpr`, `RecordExpr`, `PathPat`, `RecordPat`, `TupleStructPat` or `MethodCallExpr`.
"""
resolved_path: optional[string] | rust.detach | ql.internal
resolved_crate_origin: optional[string] | rust.detach | ql.internal
class PathAstNode(Resolvable):
"""
An AST element wrapping a path (`PathExpr`, `RecordExpr`, `PathPat`, `RecordPat`, `TupleStructPat`).
"""
path: optional["Path"] | child