aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-06-17 21:36:45 +0100
committerMichael Williamson <mike@zwobble.org>2023-06-17 21:36:45 +0100
commit74b9cec87c2d5958cf2076396fa0cbb5ae1e6e02 (patch)
tree7db476ab984191f7d94f815b60894eb171563625 /src/test/java
parent57d65edb3e00191ccc5fae96b347482461a48a6e (diff)
Create FreeVariable type with index and name
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionDefinitionNodeMatcher.java2
-rw-r--r--src/test/java/org/shedlang/compiler/stackir/StackCompilerFunctionDefinitionTests.java4
-rw-r--r--src/test/java/org/shedlang/compiler/typechecker/TypeCheckerFunctionDefinitionTests.java4
3 files changed, 7 insertions, 3 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 c1d047af..0d4f4cfa 100644
--- a/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionDefinitionNodeMatcher.java
+++ b/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionDefinitionNodeMatcher.java
@@ -38,7 +38,7 @@ public class TypedFunctionDefinitionNodeMatcher extends MatcherBuilder<TypedName
return with(has("effect", x -> x.effect(), effect));
}
- public TypedFunctionDefinitionNodeMatcher withFreeVariables(Matcher<Iterable<String>> freeVariables) {
+ public TypedFunctionDefinitionNodeMatcher withFreeVariables(Matcher<Iterable<FreeVariable>> freeVariables) {
return with(has("freeVariables", x -> x.freeVariables(), freeVariables));
}
diff --git a/src/test/java/org/shedlang/compiler/stackir/StackCompilerFunctionDefinitionTests.java b/src/test/java/org/shedlang/compiler/stackir/StackCompilerFunctionDefinitionTests.java
index 05063961..28974ea9 100644
--- a/src/test/java/org/shedlang/compiler/stackir/StackCompilerFunctionDefinitionTests.java
+++ b/src/test/java/org/shedlang/compiler/stackir/StackCompilerFunctionDefinitionTests.java
@@ -33,7 +33,9 @@ public class StackCompilerFunctionDefinitionTests {
has("namedParams", x -> x.namedParams(), isSequence(
isDefineFunctionInstructionParam("y")
)),
- has("freeVariables", x -> x.freeVariables(), containsExactly(equalTo("z"))),
+ has("freeVariables", x -> x.freeVariables(), containsExactly(
+ has("name", x -> x.name(), equalTo("z"))
+ )),
has("body", x -> x.body(), isSequence(
isPushStringInstruction("hello"),
isDiscardInstruction(),
diff --git a/src/test/java/org/shedlang/compiler/typechecker/TypeCheckerFunctionDefinitionTests.java b/src/test/java/org/shedlang/compiler/typechecker/TypeCheckerFunctionDefinitionTests.java
index f3cbf0fe..26ea2693 100644
--- a/src/test/java/org/shedlang/compiler/typechecker/TypeCheckerFunctionDefinitionTests.java
+++ b/src/test/java/org/shedlang/compiler/typechecker/TypeCheckerFunctionDefinitionTests.java
@@ -179,7 +179,9 @@ public class TypeCheckerFunctionDefinitionTests {
assertThat(
typed,
isTypedFunctionDefinitionNode()
- .withFreeVariables(containsExactly(equalTo("y")))
+ .withFreeVariables(containsExactly(
+ has("name", x -> x.name(), equalTo("y"))
+ ))
);
}