From 3e9a68f0235158f5ee2c70cb6b319b26e42fd810 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Tue, 14 Jul 2026 21:15:55 +0100 Subject: Combine Rust notions of paths --- .../compiler/output/lang/rust/RustWriterTests.java | 91 +++++++++------------- .../lang/rust/ast/RustImplTraitTypeMatcher.java | 2 +- .../lang/rust/ast/RustOuterAttributeMatcher.java | 2 +- .../lang/rust/ast/RustPathExprSegmentMatcher.java | 45 ----------- .../lang/rust/ast/RustPathInExpressionMatcher.java | 39 ---------- .../output/lang/rust/ast/RustPathMatcher.java | 39 ++++++++++ .../lang/rust/ast/RustPathSegmentMatcher.java | 45 +++++++++++ .../lang/rust/ast/RustStructExpressionMatcher.java | 2 +- .../output/lang/rust/ast/RustTraitImplMatcher.java | 2 +- .../output/lang/rust/ast/RustTypePathMatcher.java | 39 ---------- .../lang/rust/ast/RustTypePathSegmentMatcher.java | 45 ----------- 11 files changed, 124 insertions(+), 227 deletions(-) delete mode 100644 src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathExprSegmentMatcher.java delete mode 100644 src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathInExpressionMatcher.java create mode 100644 src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathMatcher.java create mode 100644 src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathSegmentMatcher.java delete mode 100644 src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTypePathMatcher.java delete mode 100644 src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTypePathSegmentMatcher.java (limited to 'src/test/java') diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/RustWriterTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/RustWriterTests.java index 67d0a42..358d99d 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/RustWriterTests.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/RustWriterTests.java @@ -56,8 +56,8 @@ public class RustWriterTests { public void functionWithParams() throws IOException { var rust = RustFunction.arbitrary() .withName(new RustIdentifier("area")) - .addParam(new RustFunctionParam(new RustIdentifier("width"), RustTypePath.of("i32"))) - .addParam(new RustFunctionParam(new RustIdentifier("height"), RustTypePath.of("u64"))) + .addParam(new RustFunctionParam(new RustIdentifier("width"), RustPath.of("i32"))) + .addParam(new RustFunctionParam(new RustIdentifier("height"), RustPath.of("u64"))) .build(); var string = write(writer -> writer.writeAssociatedItem(rust)); @@ -70,7 +70,7 @@ public class RustWriterTests { public void functionWithReturnType() throws IOException { var rust = RustFunction.arbitrary() .withName(new RustIdentifier("area")) - .withReturnType(Optional.of(RustTypePath.of("i32"))) + .withReturnType(Optional.of(RustPath.of("i32"))) .build(); var string = write(writer -> writer.writeAssociatedItem(rust)); @@ -114,8 +114,8 @@ public class RustWriterTests { var rust = RustStructStruct.arbitrary() .withName(new RustIdentifier("Rectangle")) .withAttributes(List.of( - new RustOuterAttribute(RustTypePath.of("a", "b", "C"), Optional.empty()), - new RustOuterAttribute(RustTypePath.of("derive"), Optional.of("(Debug)")) + new RustOuterAttribute(RustPath.of("a", "b", "C"), Optional.empty()), + new RustOuterAttribute(RustPath.of("derive"), Optional.of("(Debug)")) )) .build(); @@ -133,8 +133,8 @@ public class RustWriterTests { var rust = RustStructStruct.arbitrary() .withName(new RustIdentifier("Rectangle")) .withFields(List.of( - new RustStructField(new RustIdentifier("width"), RustTypePath.of("i32")), - new RustStructField(new RustIdentifier("height"), RustTypePath.of("i32")) + new RustStructField(new RustIdentifier("width"), RustPath.of("i32")), + new RustStructField(new RustIdentifier("height"), RustPath.of("i32")) )) .build(); @@ -180,8 +180,8 @@ public class RustWriterTests { var rust = RustEnum.arbitrary() .withName(new RustIdentifier("Shape")) .withAttributes(List.of( - new RustOuterAttribute(RustTypePath.of("a", "b", "C"), Optional.empty()), - new RustOuterAttribute(RustTypePath.of("derive"), Optional.of("(Debug)")) + new RustOuterAttribute(RustPath.of("a", "b", "C"), Optional.empty()), + new RustOuterAttribute(RustPath.of("derive"), Optional.of("(Debug)")) )) .build(); @@ -229,8 +229,8 @@ public class RustWriterTests { .withFields( RustEnumVariantTuple.arbitrary() .withFields(List.of( - RustTupleField.arbitrary().withType(RustTypePath.of("i32")).build(), - RustTupleField.arbitrary().withType(RustTypePath.of("i32")).build() + RustTupleField.arbitrary().withType(RustPath.of("i32")).build(), + RustTupleField.arbitrary().withType(RustPath.of("i32")).build() )) .build() ) @@ -240,7 +240,7 @@ public class RustWriterTests { .withFields( RustEnumVariantTuple.arbitrary() .withFields(List.of( - RustTupleField.arbitrary().withType(RustTypePath.of("u64")).build() + RustTupleField.arbitrary().withType(RustPath.of("u64")).build() )) .build() ) @@ -276,7 +276,7 @@ public class RustWriterTests { @Test public void emptyInherentImpl() throws IOException { - var rust = RustInherentImpl.arbitrary().withType(RustTypePath.of("Square")).build(); + var rust = RustInherentImpl.arbitrary().withType(RustPath.of("Square")).build(); var string = write(writer -> writer.writeItem(rust)); @@ -288,7 +288,7 @@ public class RustWriterTests { @Test public void inherentImplWithAssociatedItems() throws IOException { var rust = RustInherentImpl.arbitrary() - .withType(RustTypePath.of("Square")) + .withType(RustPath.of("Square")) .addItem(RustFunction.arbitrary().withName(new RustIdentifier("width"))) .addItem(RustFunction.arbitrary().withName(new RustIdentifier("height"))) .build(); @@ -306,8 +306,8 @@ public class RustWriterTests { @Test public void emptyTraitImpl() throws IOException { var rust = RustTraitImpl.arbitrary() - .withImplementedTrait(RustTypePath.of("Shape")) - .withType(RustTypePath.of("Square")) + .withImplementedTrait(RustPath.of("Shape")) + .withType(RustPath.of("Square")) .build(); var string = write(writer -> writer.writeItem(rust)); @@ -320,8 +320,8 @@ public class RustWriterTests { @Test public void traitImplWithAssociatedItems() throws IOException { var rust = RustTraitImpl.arbitrary() - .withImplementedTrait(RustTypePath.of("Shape")) - .withType(RustTypePath.of("Square")) + .withImplementedTrait(RustPath.of("Shape")) + .withType(RustPath.of("Square")) .addItem(RustFunction.arbitrary().withName(new RustIdentifier("width"))) .addItem(RustFunction.arbitrary().withName(new RustIdentifier("height"))) .build(); @@ -445,7 +445,7 @@ public class RustWriterTests { @Test public void callExpressionWithNoArgs() throws IOException { var rust = RustCallExpression.arbitrary() - .withFunction(RustPathInExpression.of("f")) + .withFunction(RustPath.of("f")) .build(); var string = write(writer -> writer.writeExpression(rust)); @@ -456,9 +456,9 @@ public class RustWriterTests { @Test public void callExpressionWithArgs() throws IOException { var rust = RustCallExpression.arbitrary() - .withFunction(RustPathInExpression.of("f")) - .addArg(RustPathInExpression.of("x")) - .addArg(RustPathInExpression.of("y")) + .withFunction(RustPath.of("f")) + .addArg(RustPath.of("x")) + .addArg(RustPath.of("y")) .build(); var string = write(writer -> writer.writeExpression(rust)); @@ -471,7 +471,7 @@ public class RustWriterTests { @Test public void fieldExpression() throws IOException { var rust = RustFieldExpression.arbitrary() - .withContainerOperand(RustPathInExpression.of("x")) + .withContainerOperand(RustPath.of("x")) .withFieldName(RustIdentifier.of("y")) .build(); @@ -485,7 +485,7 @@ public class RustWriterTests { @Test public void structExpressionWithNoFields() throws IOException { var rust = RustStructExpression.arbitrary() - .withStructPath(RustPathInExpression.of("A")) + .withStructPath(RustPath.of("A")) .build(); var string = write(writer -> writer.writeExpression(rust)); @@ -496,16 +496,16 @@ public class RustWriterTests { @Test public void structExpressionWithFields() throws IOException { var rust = RustStructExpression.arbitrary() - .withStructPath(RustPathInExpression.of("X")) + .withStructPath(RustPath.of("X")) .addFieldValue( RustStructExprField.arbitrary() .withName(RustIdentifier.of("a")) - .withValue(RustPathInExpression.of("b")) + .withValue(RustPath.of("b")) ) .addFieldValue( RustStructExprField.arbitrary() .withName(RustIdentifier.of("c")) - .withValue(RustPathInExpression.of("d")) + .withValue(RustPath.of("d")) ) .build(); @@ -519,7 +519,7 @@ public class RustWriterTests { @Test public void implTraitType() throws IOException { var rust = RustImplTraitType.arbitrary() - .withTrait(RustTypePath.of("std", "io", "Read")) + .withTrait(RustPath.of("std", "io", "Read")) .build(); var string = write(writer -> writer.writeType(rust)); @@ -530,8 +530,8 @@ public class RustWriterTests { // == Paths == @Test - public void pathExprSegmentsAreSeparatedByDoubleColons() throws IOException { - var rust = RustPathInExpression.of("std", "string", "String"); + public void pathSegmentsAreSeparatedByDoubleColons() throws IOException { + var rust = RustPath.of("std", "string", "String"); var string = write(writer -> writer.writeExpression(rust)); @@ -539,37 +539,18 @@ public class RustWriterTests { } @Test - public void pathExprSegmentGenericArgsAreWritten() throws IOException { - var rust = RustPathInExpression.of("std", "collections", "HashMap") - .withArgs(List.of(RustTypePath.of("i32"), RustTypePath.of("f64"))); + public void pathSegmentGenericArgsAreWritten() throws IOException { + var rust = RustPath.of("std", "collections", "HashMap") + .withArgs(List.of(RustPath.of("i32"), RustPath.of("f64"))); var string = write(writer -> writer.writeExpression(rust)); assertThat(string, equalTo("std::collections::HashMap::")); } - @Test - public void typePathSegmentsAreSeparatedByDoubleColons() throws IOException { - var rust = RustTypePath.of("std", "string", "String"); - - var string = write(writer -> writer.writeType(rust)); - - assertThat(string, equalTo("std::string::String")); - } - - @Test - public void typePathSegmentGenericArgsAreWritten() throws IOException { - var rust = RustTypePath.of("std", "collections", "HashMap") - .withArgs(List.of(RustTypePath.of("i32"), RustTypePath.of("f64"))); - - var string = write(writer -> writer.writeType(rust)); - - assertThat(string, equalTo("std::collections::HashMap")); - } - @Test public void crateSegmentIsWritten() throws IOException { - var rust = RustTypePath.crate("a", "b"); + var rust = RustPath.crate("a", "b"); var string = write(writer -> writer.writeType(rust)); @@ -578,7 +559,7 @@ public class RustWriterTests { @Test public void globalSegmentIsWritten() throws IOException { - var rust = RustTypePath.global("a", "b"); + var rust = RustPath.global("a", "b"); var string = write(writer -> writer.writeType(rust)); @@ -587,7 +568,7 @@ public class RustWriterTests { @Test public void selfTypeSegmentIsWritten() throws IOException { - var rust = RustTypePath.selfType(); + var rust = RustPath.selfType(); var string = write(writer -> writer.writeType(rust)); diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustImplTraitTypeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustImplTraitTypeMatcher.java index 02afb08..0ad0925 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustImplTraitTypeMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustImplTraitTypeMatcher.java @@ -28,7 +28,7 @@ public class RustImplTraitTypeMatcher implements org.zwobble.precisely.Matcher trait) { + public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustImplTraitTypeMatcher withTrait(org.zwobble.precisely.Matcher trait) { var submatchers = new java.util.ArrayList>(this.submatchers); submatchers.add(org.zwobble.precisely.Matchers.has("trait", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustImplTraitType::trait, trait)); return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustImplTraitTypeMatcher(submatchers); diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustOuterAttributeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustOuterAttributeMatcher.java index 7aceb9e..03707bc 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustOuterAttributeMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustOuterAttributeMatcher.java @@ -28,7 +28,7 @@ public class RustOuterAttributeMatcher implements org.zwobble.precisely.Matcher< return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttribute.class, this.submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttributeMatcher withPath(org.zwobble.precisely.Matcher path) { + public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttributeMatcher withPath(org.zwobble.precisely.Matcher path) { var submatchers = new java.util.ArrayList>(this.submatchers); submatchers.add(org.zwobble.precisely.Matchers.has("path", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttribute::path, path)); return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustOuterAttributeMatcher(submatchers); diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathExprSegmentMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathExprSegmentMatcher.java deleted file mode 100644 index 04fbe5b..0000000 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathExprSegmentMatcher.java +++ /dev/null @@ -1,45 +0,0 @@ -// Generated by hobgoblin. - -package org.zwobble.hobgoblin.compiler.output.lang.rust.ast; - -// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher imports -// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher imports - -public class RustPathExprSegmentMatcher implements org.zwobble.precisely.Matcher { - public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher isRustPathExprSegment() { - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher(java.util.List.of()); - } - - private final java.util.List> submatchers; - - private RustPathExprSegmentMatcher(java.util.List> submatchers) { - this.submatchers = submatchers; - } - - public org.zwobble.precisely.MatchResult match(java.lang.Object actual) { - return this.toMatcher().match(actual); - } - - public org.zwobble.precisely.TextTree describe() { - return this.toMatcher().describe(); - } - - private org.zwobble.precisely.Matcher toMatcher() { - return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegment.class, this.submatchers); - } - - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher withPathIdentSegment(org.zwobble.precisely.Matcher pathIdentSegment) { - var submatchers = new java.util.ArrayList>(this.submatchers); - submatchers.add(org.zwobble.precisely.Matchers.has("pathIdentSegment", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegment::pathIdentSegment, pathIdentSegment)); - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher(submatchers); - } - - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher withArgs(org.zwobble.precisely.Matcher>> args) { - var submatchers = new java.util.ArrayList>(this.submatchers); - submatchers.add(org.zwobble.precisely.Matchers.has("args", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegment::args, args)); - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher(submatchers); - } - - // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher body - // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathExprSegmentMatcher body -} diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathInExpressionMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathInExpressionMatcher.java deleted file mode 100644 index 4fad401..0000000 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathInExpressionMatcher.java +++ /dev/null @@ -1,39 +0,0 @@ -// Generated by hobgoblin. - -package org.zwobble.hobgoblin.compiler.output.lang.rust.ast; - -// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher imports -// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher imports - -public class RustPathInExpressionMatcher implements org.zwobble.precisely.Matcher { - public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher isRustPathInExpression() { - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher(java.util.List.of()); - } - - private final java.util.List> submatchers; - - private RustPathInExpressionMatcher(java.util.List> submatchers) { - this.submatchers = submatchers; - } - - public org.zwobble.precisely.MatchResult match(java.lang.Object actual) { - return this.toMatcher().match(actual); - } - - public org.zwobble.precisely.TextTree describe() { - return this.toMatcher().describe(); - } - - private org.zwobble.precisely.Matcher toMatcher() { - return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpression.class, this.submatchers); - } - - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher withSegments(org.zwobble.precisely.Matcher> segments) { - var submatchers = new java.util.ArrayList>(this.submatchers); - submatchers.add(org.zwobble.precisely.Matchers.has("segments", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpression::segments, segments)); - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher(submatchers); - } - - // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher body - // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathInExpressionMatcher body -} diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathMatcher.java new file mode 100644 index 0000000..eb382d0 --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathMatcher.java @@ -0,0 +1,39 @@ +// Generated by hobgoblin. + +package org.zwobble.hobgoblin.compiler.output.lang.rust.ast; + +// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher imports +// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher imports + +public class RustPathMatcher implements org.zwobble.precisely.Matcher { + public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher isRustPath() { + return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher(java.util.List.of()); + } + + private final java.util.List> submatchers; + + private RustPathMatcher(java.util.List> submatchers) { + this.submatchers = submatchers; + } + + public org.zwobble.precisely.MatchResult match(java.lang.Object actual) { + return this.toMatcher().match(actual); + } + + public org.zwobble.precisely.TextTree describe() { + return this.toMatcher().describe(); + } + + private org.zwobble.precisely.Matcher toMatcher() { + return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPath.class, this.submatchers); + } + + public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher withSegments(org.zwobble.precisely.Matcher> segments) { + var submatchers = new java.util.ArrayList>(this.submatchers); + submatchers.add(org.zwobble.precisely.Matchers.has("segments", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPath::segments, segments)); + return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher(submatchers); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathMatcher body +} diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathSegmentMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathSegmentMatcher.java new file mode 100644 index 0000000..7db3593 --- /dev/null +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustPathSegmentMatcher.java @@ -0,0 +1,45 @@ +// Generated by hobgoblin. + +package org.zwobble.hobgoblin.compiler.output.lang.rust.ast; + +// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher imports +// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher imports + +public class RustPathSegmentMatcher implements org.zwobble.precisely.Matcher { + public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher isRustPathSegment() { + return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher(java.util.List.of()); + } + + private final java.util.List> submatchers; + + private RustPathSegmentMatcher(java.util.List> submatchers) { + this.submatchers = submatchers; + } + + public org.zwobble.precisely.MatchResult match(java.lang.Object actual) { + return this.toMatcher().match(actual); + } + + public org.zwobble.precisely.TextTree describe() { + return this.toMatcher().describe(); + } + + private org.zwobble.precisely.Matcher toMatcher() { + return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegment.class, this.submatchers); + } + + public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher withPathIdentSegment(org.zwobble.precisely.Matcher pathIdentSegment) { + var submatchers = new java.util.ArrayList>(this.submatchers); + submatchers.add(org.zwobble.precisely.Matchers.has("pathIdentSegment", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegment::pathIdentSegment, pathIdentSegment)); + return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher(submatchers); + } + + public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher withArgs(org.zwobble.precisely.Matcher>> args) { + var submatchers = new java.util.ArrayList>(this.submatchers); + submatchers.add(org.zwobble.precisely.Matchers.has("args", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegment::args, args)); + return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher(submatchers); + } + + // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher body + // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustPathSegmentMatcher body +} diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustStructExpressionMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustStructExpressionMatcher.java index 5597d00..20f8ec7 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustStructExpressionMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustStructExpressionMatcher.java @@ -28,7 +28,7 @@ public class RustStructExpressionMatcher implements org.zwobble.precisely.Matche return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustStructExpression.class, this.submatchers); } - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustStructExpressionMatcher withStructPath(org.zwobble.precisely.Matcher structPath) { + public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustStructExpressionMatcher withStructPath(org.zwobble.precisely.Matcher structPath) { var submatchers = new java.util.ArrayList>(this.submatchers); submatchers.add(org.zwobble.precisely.Matchers.has("structPath", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustStructExpression::structPath, structPath)); return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustStructExpressionMatcher(submatchers); diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTraitImplMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTraitImplMatcher.java index a31ac13..9d31b3f 100644 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTraitImplMatcher.java +++ b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTraitImplMatcher.java @@ -28,7 +28,7 @@ public class RustTraitImplMatcher implements org.zwobble.precisely.Matcher implementedTrait) { + public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTraitImplMatcher withImplementedTrait(org.zwobble.precisely.Matcher implementedTrait) { var submatchers = new java.util.ArrayList>(this.submatchers); submatchers.add(org.zwobble.precisely.Matchers.has("implementedTrait", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTraitImpl::implementedTrait, implementedTrait)); return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTraitImplMatcher(submatchers); diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTypePathMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTypePathMatcher.java deleted file mode 100644 index 4a12993..0000000 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTypePathMatcher.java +++ /dev/null @@ -1,39 +0,0 @@ -// Generated by hobgoblin. - -package org.zwobble.hobgoblin.compiler.output.lang.rust.ast; - -// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher imports -// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher imports - -public class RustTypePathMatcher implements org.zwobble.precisely.Matcher { - public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher isRustTypePath() { - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher(java.util.List.of()); - } - - private final java.util.List> submatchers; - - private RustTypePathMatcher(java.util.List> submatchers) { - this.submatchers = submatchers; - } - - public org.zwobble.precisely.MatchResult match(java.lang.Object actual) { - return this.toMatcher().match(actual); - } - - public org.zwobble.precisely.TextTree describe() { - return this.toMatcher().describe(); - } - - private org.zwobble.precisely.Matcher toMatcher() { - return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePath.class, this.submatchers); - } - - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher withSegments(org.zwobble.precisely.Matcher> segments) { - var submatchers = new java.util.ArrayList>(this.submatchers); - submatchers.add(org.zwobble.precisely.Matchers.has("segments", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePath::segments, segments)); - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher(submatchers); - } - - // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher body - // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathMatcher body -} diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTypePathSegmentMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTypePathSegmentMatcher.java deleted file mode 100644 index d3ccd10..0000000 --- a/src/test/java/org/zwobble/hobgoblin/compiler/output/lang/rust/ast/RustTypePathSegmentMatcher.java +++ /dev/null @@ -1,45 +0,0 @@ -// Generated by hobgoblin. - -package org.zwobble.hobgoblin.compiler.output.lang.rust.ast; - -// Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher imports -// Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher imports - -public class RustTypePathSegmentMatcher implements org.zwobble.precisely.Matcher { - public static org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher isRustTypePathSegment() { - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher(java.util.List.of()); - } - - private final java.util.List> submatchers; - - private RustTypePathSegmentMatcher(java.util.List> submatchers) { - this.submatchers = submatchers; - } - - public org.zwobble.precisely.MatchResult match(java.lang.Object actual) { - return this.toMatcher().match(actual); - } - - public org.zwobble.precisely.TextTree describe() { - return this.toMatcher().describe(); - } - - private org.zwobble.precisely.Matcher toMatcher() { - return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegment.class, this.submatchers); - } - - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher withPathIdentSegment(org.zwobble.precisely.Matcher pathIdentSegment) { - var submatchers = new java.util.ArrayList>(this.submatchers); - submatchers.add(org.zwobble.precisely.Matchers.has("pathIdentSegment", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegment::pathIdentSegment, pathIdentSegment)); - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher(submatchers); - } - - public org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher withArgs(org.zwobble.precisely.Matcher>> args) { - var submatchers = new java.util.ArrayList>(this.submatchers); - submatchers.add(org.zwobble.precisely.Matchers.has("args", org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegment::args, args)); - return new org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher(submatchers); - } - - // Custom area start: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher body - // Custom area end: org.zwobble.hobgoblin.compiler.output.lang.rust.ast.RustTypePathSegmentMatcher body -} -- cgit v1.2.3