From d19e7debea80e9216923935ef03c8607d7c1d9ec Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Sun, 29 Oct 2023 17:54:59 +0000 Subject: Throw error if function reaches end with inferred non-unit type --- .../shedlang/compiler/ast/typed/TypedFunctionBodyNodeMatcher.java | 6 ++++++ 1 file changed, 6 insertions(+) (limited to 'src/test/java/org/shedlang/compiler/ast') diff --git a/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionBodyNodeMatcher.java b/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionBodyNodeMatcher.java index d392ec4d..f31f1e0b 100644 --- a/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionBodyNodeMatcher.java +++ b/src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionBodyNodeMatcher.java @@ -3,8 +3,10 @@ package org.shedlang.compiler.ast.typed; import org.pcollections.Empty; import org.pcollections.PVector; import org.shedlang.compiler.testing.MatcherBuilder; +import org.shedlang.compiler.types.Type; import org.zwobble.precisely.Matcher; +import static org.zwobble.precisely.Matchers.equalTo; import static org.zwobble.precisely.Matchers.has; public class TypedFunctionBodyNodeMatcher extends MatcherBuilder< @@ -43,4 +45,8 @@ public class TypedFunctionBodyNodeMatcher extends MatcherBuilder< ) { return with(has("freeVariables", x -> x.freeVariables(), freeVariables)); } + + public TypedFunctionBodyNodeMatcher withType(Type type) { + return with(has("type", x -> x.type(), equalTo(type))); + } } -- cgit v1.2.3