aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-10-29 16:50:41 +0000
committerMichael Williamson <mike@zwobble.org>2023-10-29 16:50:41 +0000
commitf58e79e8e1883b2246da7c36b0871c1e31728f86 (patch)
treeeaab84b08a910099905aa54557f60ebaa63e6e18 /src/test/java
parentd8f4fea9c5f303551d17d3644356fcf0e30804b1 (diff)
Make return type optional in typed function signature node
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionDefinitionNodeMatcher.java5
-rw-r--r--src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionExpressionNodeMatcher.java5
-rw-r--r--src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionSignatureNodeMatcher.java3
3 files changed, 6 insertions, 7 deletions
diff --git a/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionDefinitionNodeMatcher.java b/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionDefinitionNodeMatcher.java
index e12a187d..58527e4f 100644
--- a/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionDefinitionNodeMatcher.java
+++ b/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionDefinitionNodeMatcher.java
@@ -8,8 +8,7 @@ import org.zwobble.precisely.Matcher;
import java.util.Optional;
-import static org.zwobble.precisely.Matchers.equalTo;
-import static org.zwobble.precisely.Matchers.has;
+import static org.zwobble.precisely.Matchers.*;
public class TypedFunctionDefinitionNodeMatcher extends MatcherBuilder<TypedNamespaceStatementNode, TypedFunctionDefinitionNode, TypedFunctionDefinitionNodeMatcher> {
public static TypedFunctionDefinitionNodeMatcher empty() {
@@ -51,7 +50,7 @@ public class TypedFunctionDefinitionNodeMatcher extends MatcherBuilder<TypedName
}
public TypedFunctionDefinitionNodeMatcher withReturnType(Matcher<TypedTypeLevelExpressionNode<?>> returnType) {
- return with(has("returnType", x -> x.signature().returnType(), returnType));
+ return with(has("returnType", x -> x.signature().returnType(), isOptionalOf(returnType)));
}
public TypedFunctionDefinitionNodeMatcher withType(FunctionType type) {
diff --git a/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionExpressionNodeMatcher.java b/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionExpressionNodeMatcher.java
index b47fb39c..50319754 100644
--- a/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionExpressionNodeMatcher.java
+++ b/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionExpressionNodeMatcher.java
@@ -8,8 +8,7 @@ import org.zwobble.precisely.Matcher;
import java.util.Optional;
-import static org.zwobble.precisely.Matchers.equalTo;
-import static org.zwobble.precisely.Matchers.has;
+import static org.zwobble.precisely.Matchers.*;
public class TypedFunctionExpressionNodeMatcher extends MatcherBuilder<
TypedExpressionNode,
@@ -55,7 +54,7 @@ public class TypedFunctionExpressionNodeMatcher extends MatcherBuilder<
}
public TypedFunctionExpressionNodeMatcher withReturnType(Matcher<TypedTypeLevelExpressionNode<?>> returnType) {
- return with(has("returnType", x -> x.signature().returnType(), returnType));
+ return with(has("returnType", x -> x.signature().returnType(), isOptionalOf(returnType)));
}
public TypedFunctionExpressionNodeMatcher withType(FunctionType type) {
diff --git a/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionSignatureNodeMatcher.java b/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionSignatureNodeMatcher.java
index 2661d4fb..ca2e64ae 100644
--- a/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionSignatureNodeMatcher.java
+++ b/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionSignatureNodeMatcher.java
@@ -8,6 +8,7 @@ import org.zwobble.precisely.Matcher;
import java.util.Optional;
import static org.zwobble.precisely.Matchers.has;
+import static org.zwobble.precisely.Matchers.isOptionalOf;
public class TypedFunctionSignatureNodeMatcher extends MatcherBuilder<
TypedFunctionSignatureNode,
@@ -45,6 +46,6 @@ public class TypedFunctionSignatureNodeMatcher extends MatcherBuilder<
}
public TypedFunctionSignatureNodeMatcher withReturnType(Matcher<TypedTypeLevelExpressionNode<?>> returnType) {
- return with(has("returnType", x -> x.returnType(), returnType));
+ return with(has("returnType", x -> x.returnType(), isOptionalOf(returnType)));
}
}