diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-10-29 17:54:59 +0000 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-10-29 17:54:59 +0000 |
| commit | d19e7debea80e9216923935ef03c8607d7c1d9ec (patch) | |
| tree | 011bf34c8a13992d30d3206ec080e0f8dc8fa1a1 /src/test/java/org/shedlang/compiler/ast | |
| parent | bd698f42bcb58939931f000bde2ec7ead4c9aa52 (diff) | |
Throw error if function reaches end with inferred non-unit type
Diffstat (limited to 'src/test/java/org/shedlang/compiler/ast')
| -rw-r--r-- | src/test/java/org/shedlang/compiler/ast/typed/TypedFunctionBodyNodeMatcher.java | 6 |
1 files changed, 6 insertions, 0 deletions
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))); + } } |
