summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2026-10-31 00:42:37 +0000
committerMichael Williamson <mike@zwobble.org>2026-10-31 00:43:33 +0000
commit6efdb8a8aaa87d5497de989b4f8e4ee26d2bdd54 (patch)
treed485f10eac4a524ca151d1bdea381eaa8bdf426b
parent91bc5df9cc0a6f7ef4fb63c301a0a8ad1f571a31 (diff)
Add stubbed TypedQueryDefinitionNode
-rw-r--r--hobgoblin/src/ast/typed.hob7
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedNamespaceStatementNode.java2
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNode.java44
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java3
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javatransient0/JavaTransient0Generator.java4
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javatypes/JavaTypesGenerator.java4
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttransient0/RustTransient0Generator.java4
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttypes/RustTypesGenerator.java4
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/output/generators/typescripttypes/TypescriptTypesGenerator.java4
-rw-r--r--src/main/java/org/zwobble/hobgoblin/compiler/typechecker/TypeChecker.java17
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNodeMatcher.java53
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java53
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/util/SequencedMaps.java23
13 files changed, 217 insertions, 5 deletions
diff --git a/hobgoblin/src/ast/typed.hob b/hobgoblin/src/ast/typed.hob
index a734d7c..b03dffe 100644
--- a/hobgoblin/src/ast/typed.hob
+++ b/hobgoblin/src/ast/typed.hob
@@ -26,6 +26,7 @@ sum TypedNamespaceStatementNode {
variant TypedDatabaseSchemaDefinitionNode;
variant TypedEnumDefinitionNode;
variant TypedNativeTypeDefinitionNode;
+ variant TypedQueryDefinitionNode;
variant TypedStructDefinitionNode;
variant TypedSumDefinitionNode;
}
@@ -55,6 +56,12 @@ struct TypedNativeTypeDefinitionNode {
field source: Source;
}
+struct TypedQueryDefinitionNode {
+ field name: String;
+ field docComment: DocComment;
+ field source: Source;
+}
+
struct TypedStructDefinitionNode {
field typeOrConstructor: TypeOrConstructor[SimpleStructType];
field fields: Option[List[TypedStructFieldDefinitionNode]];
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedNamespaceStatementNode.java b/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedNamespaceStatementNode.java
index 8e8bd77..a20416e 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedNamespaceStatementNode.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedNamespaceStatementNode.java
@@ -5,7 +5,7 @@ package org.zwobble.hobgoblin.compiler.ast.typed;
// Custom area start: org.zwobble.hobgoblin.compiler.ast.typed.TypedNamespaceStatementNode imports
// Custom area end: org.zwobble.hobgoblin.compiler.ast.typed.TypedNamespaceStatementNode imports
-public sealed interface TypedNamespaceStatementNode permits org.zwobble.hobgoblin.compiler.ast.typed.TypedDatabaseSchemaDefinitionNode, org.zwobble.hobgoblin.compiler.ast.typed.TypedEnumDefinitionNode, org.zwobble.hobgoblin.compiler.ast.typed.TypedNativeTypeDefinitionNode, org.zwobble.hobgoblin.compiler.ast.typed.TypedStructDefinitionNode, org.zwobble.hobgoblin.compiler.ast.typed.TypedSumDefinitionNode {
+public sealed interface TypedNamespaceStatementNode permits org.zwobble.hobgoblin.compiler.ast.typed.TypedDatabaseSchemaDefinitionNode, org.zwobble.hobgoblin.compiler.ast.typed.TypedEnumDefinitionNode, org.zwobble.hobgoblin.compiler.ast.typed.TypedNativeTypeDefinitionNode, org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode, org.zwobble.hobgoblin.compiler.ast.typed.TypedStructDefinitionNode, org.zwobble.hobgoblin.compiler.ast.typed.TypedSumDefinitionNode {
public interface Builder {
public org.zwobble.hobgoblin.compiler.ast.typed.TypedNamespaceStatementNode build();
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNode.java b/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNode.java
new file mode 100644
index 0000000..abfe470
--- /dev/null
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNode.java
@@ -0,0 +1,44 @@
+// Generated by hobgoblin.
+
+package org.zwobble.hobgoblin.compiler.ast.typed;
+
+// Custom area start: org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode imports
+// Custom area end: org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode imports
+
+public record TypedQueryDefinitionNode(
+ String name,
+ org.zwobble.hobgoblin.compiler.ast.DocComment docComment,
+ org.zwobble.hobgoblin.compiler.sources.Source source
+) implements org.zwobble.hobgoblin.compiler.ast.typed.TypedNamespaceStatementNode {
+ public static org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder arbitrary() {
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder("", org.zwobble.hobgoblin.compiler.ast.HobgoblinNativeAst.arbitraryDocComment(), org.zwobble.hobgoblin.compiler.sources.HobgoblinNativeSources.arbitrarySource());
+ }
+
+ public record Builder(
+ String name,
+ org.zwobble.hobgoblin.compiler.ast.DocComment docComment,
+ org.zwobble.hobgoblin.compiler.sources.Source source
+ ) implements org.zwobble.hobgoblin.compiler.ast.typed.TypedNamespaceStatementNode.Builder {
+ public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode build() {
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode(name, docComment, source);
+ }
+
+ public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder withName(String name) {
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder(name, docComment, source);
+ }
+
+ public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder withDocComment(org.zwobble.hobgoblin.compiler.ast.DocComment docComment) {
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder(name, docComment, source);
+ }
+
+ public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder withSource(org.zwobble.hobgoblin.compiler.sources.Source source) {
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder(name, docComment, source);
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder body
+ // Custom area end: org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.Builder body
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode body
+ // Custom area end: org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode body
+}
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java
index c028a42..9b751d0 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javapreciselymatchers/JavaPreciselyMatchersGenerator.java
@@ -100,6 +100,9 @@ public class JavaPreciselyMatchersGenerator implements Generator {
case TypedNativeTypeDefinitionNode _ -> {
}
+ case TypedQueryDefinitionNode _ -> {
+ }
+
case TypedStructDefinitionNode structDefinition -> {
var javaCompilationUnit = new JavaCompilationUnit(
generateStructDefinition(structDefinition, context)
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javatransient0/JavaTransient0Generator.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javatransient0/JavaTransient0Generator.java
index d4bb4ba..0220ba9 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javatransient0/JavaTransient0Generator.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javatransient0/JavaTransient0Generator.java
@@ -668,6 +668,10 @@ public class JavaTransient0Generator implements Generator {
yield List.of();
}
+ case TypedQueryDefinitionNode _ -> {
+ yield List.of();
+ }
+
case TypedStructDefinitionNode structDefinition -> {
yield List.of(
generateEncodeStructMethod(structDefinition, context),
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javatypes/JavaTypesGenerator.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javatypes/JavaTypesGenerator.java
index 9c06fb1..17065e0 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javatypes/JavaTypesGenerator.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/javatypes/JavaTypesGenerator.java
@@ -11,7 +11,6 @@ import org.zwobble.hobgoblin.compiler.output.generators.Stripper;
import org.zwobble.hobgoblin.compiler.output.generators.java.JavaGenerator;
import org.zwobble.hobgoblin.compiler.output.generators.java.JavaGeneratorConfig;
import org.zwobble.hobgoblin.compiler.output.generators.java.JavaNativeTypeConfig;
-import org.zwobble.hobgoblin.compiler.output.lang.java.JavaWriter;
import org.zwobble.hobgoblin.compiler.output.lang.java.ast.*;
import org.zwobble.hobgoblin.compiler.typechecker.TypesInfo;
import org.zwobble.hobgoblin.compiler.types.*;
@@ -116,6 +115,9 @@ public class JavaTypesGenerator implements Generator {
case TypedNativeTypeDefinitionNode nativeTypeDefinition -> {
}
+ case TypedQueryDefinitionNode _ -> {
+ }
+
case TypedStructDefinitionNode structDefinition -> {
var javaCompilationUnit = new JavaCompilationUnit(
generateStructDefinition(structDefinition, context)
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttransient0/RustTransient0Generator.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttransient0/RustTransient0Generator.java
index 44d144c..8f2f4ad 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttransient0/RustTransient0Generator.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttransient0/RustTransient0Generator.java
@@ -423,6 +423,10 @@ public class RustTransient0Generator implements Generator {
yield Stream.of();
}
+ case TypedQueryDefinitionNode _ -> {
+ yield Stream.of();
+ }
+
case TypedStructDefinitionNode structDefinition -> {
yield Stream.of(
generateEncodeStructFunction(structDefinition),
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttypes/RustTypesGenerator.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttypes/RustTypesGenerator.java
index 658fa53..f57ec33 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttypes/RustTypesGenerator.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/rusttypes/RustTypesGenerator.java
@@ -109,6 +109,10 @@ public class RustTypesGenerator implements Generator {
yield List.of();
}
+ case TypedQueryDefinitionNode _ -> {
+ yield List.of();
+ }
+
case TypedStructDefinitionNode structDefinition -> {
yield generateStructDefinition(structDefinition);
}
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/typescripttypes/TypescriptTypesGenerator.java b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/typescripttypes/TypescriptTypesGenerator.java
index 3c1ddfe..cbdf016 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/typescripttypes/TypescriptTypesGenerator.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/output/generators/typescripttypes/TypescriptTypesGenerator.java
@@ -154,6 +154,10 @@ public class TypescriptTypesGenerator implements Generator {
return List.of();
}
+ case TypedQueryDefinitionNode _ -> {
+ return List.of();
+ }
+
case TypedStructDefinitionNode structDefinition -> {
return generateStructDefinition(structDefinition, context);
}
diff --git a/src/main/java/org/zwobble/hobgoblin/compiler/typechecker/TypeChecker.java b/src/main/java/org/zwobble/hobgoblin/compiler/typechecker/TypeChecker.java
index 311cf0e..10dfc20 100644
--- a/src/main/java/org/zwobble/hobgoblin/compiler/typechecker/TypeChecker.java
+++ b/src/main/java/org/zwobble/hobgoblin/compiler/typechecker/TypeChecker.java
@@ -108,7 +108,7 @@ public class TypeChecker {
Optional.of(declareNativeTypeDefinition(untypedNativeTypeDefinition, context));
case UntypedQueryDefinitionNode _ ->
- throw new UnsupportedOperationException("TODO");
+ Optional.empty();
case UntypedStructDefinitionNode untypedStructDefinition ->
Optional.of(declareStructDefinition(untypedStructDefinition, context));
@@ -132,8 +132,8 @@ public class TypeChecker {
case UntypedNativeTypeDefinitionNode untypedNativeTypeDefinition ->
defineNativeTypeDefinition(untypedNativeTypeDefinition, context);
- case UntypedQueryDefinitionNode _ ->
- throw new UnsupportedOperationException("TODO");
+ case UntypedQueryDefinitionNode untypedQueryDefinition ->
+ defineQueryDefinition(untypedQueryDefinition, context);
case UntypedStructDefinitionNode untypedStructDefinition ->
defineStructDefinition(untypedStructDefinition, context);
@@ -278,6 +278,17 @@ public class TypeChecker {
return metaType;
}
+ private static TypedQueryDefinitionNode defineQueryDefinition(
+ UntypedQueryDefinitionNode untyped,
+ TypeCheckerNamespaceContext context
+ ) {
+ return new TypedQueryDefinitionNode(
+ untyped.name(),
+ untyped.docComment(),
+ untyped.source()
+ );
+ }
+
private static TypedStructDefinitionNode defineStructDefinition(
UntypedStructDefinitionNode untyped,
TypeCheckerNamespaceContext context
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNodeMatcher.java b/src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNodeMatcher.java
new file mode 100644
index 0000000..bf3272d
--- /dev/null
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/ast/typed/TypedQueryDefinitionNodeMatcher.java
@@ -0,0 +1,53 @@
+// Generated by hobgoblin.
+
+package org.zwobble.hobgoblin.compiler.ast.typed;
+
+// Custom area start: org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher imports
+// Custom area end: org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher imports
+
+public final class TypedQueryDefinitionNodeMatcher implements org.zwobble.precisely.Matcher<java.lang.Object> {
+ public static org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher isTypedQueryDefinitionNode() {
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher(java.util.List.of());
+ }
+
+ private final java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode>> submatchers;
+
+ private TypedQueryDefinitionNodeMatcher(
+ java.util.List<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode>> 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<java.lang.Object> toMatcher() {
+ return org.zwobble.precisely.Matchers.instanceOf(org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode.class, this.submatchers);
+ }
+
+ public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher withName(org.zwobble.precisely.Matcher<? super String> name) {
+ var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode>>(this.submatchers);
+ submatchers.add(org.zwobble.precisely.Matchers.has("name", org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode::name, (org.zwobble.precisely.Matcher) name));
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher(submatchers);
+ }
+
+ public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher withDocComment(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.DocComment> docComment) {
+ var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode>>(this.submatchers);
+ submatchers.add(org.zwobble.precisely.Matchers.has("docComment", org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode::docComment, (org.zwobble.precisely.Matcher) docComment));
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher(submatchers);
+ }
+
+ public org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher withSource(org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.sources.Source> source) {
+ var submatchers = new java.util.ArrayList<org.zwobble.precisely.Matcher<? super org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode>>(this.submatchers);
+ submatchers.add(org.zwobble.precisely.Matchers.has("source", org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNode::source, (org.zwobble.precisely.Matcher) source));
+ return new org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher(submatchers);
+ }
+
+ // Custom area start: org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher body
+ // Custom area end: org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher body
+}
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java
new file mode 100644
index 0000000..84b3e25
--- /dev/null
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerQueryDefinitionTests.java
@@ -0,0 +1,53 @@
+package org.zwobble.hobgoblin.compiler.typechecker;
+
+import org.junit.jupiter.api.Test;
+import org.zwobble.hobgoblin.compiler.ast.untyped.*;
+import org.zwobble.hobgoblin.compiler.builtins.NativeTypes;
+import org.zwobble.hobgoblin.compiler.sources.NullSource;
+import org.zwobble.hobgoblin.compiler.types.*;
+import org.zwobble.hobgoblin.compiler.util.SequencedMaps;
+
+import java.util.List;
+import java.util.Map;
+import java.util.Optional;
+
+import static org.zwobble.hobgoblin.compiler.ast.typed.TypedQueryDefinitionNodeMatcher.isTypedQueryDefinitionNode;
+import static org.zwobble.hobgoblin.compiler.typechecker.TypeCheckerTesting.typeCheckNamespaceStatement;
+import static org.zwobble.precisely.AssertThat.assertThat;
+import static org.zwobble.precisely.Matchers.*;
+
+public class TypeCheckerQueryDefinitionTests {
+ @Test
+ public void queryForAllTableRows() {
+ var untyped = UntypedQueryDefinitionNode.arbitrary()
+ .withName("allAuthors")
+ .withDatabaseSchema(UntypedTypeLevelReferenceNode.arbitrary().withName("blogApp"))
+ .addStatement(UntypedReturnNode.arbitrary().withExpression(
+ UntypedMemberAccessNode.arbitrary()
+ .withReceiver(UntypedReferenceNode.arbitrary().withName("blogApp"))
+ .withFieldName("authors")
+ ))
+ .build();
+ var globalContext = TypeCheckerContextArb.globalContext();
+ var namespaceName = NamespaceName.of("App");
+ var namespaceContext = globalContext.enterNamespace(namespaceName);
+ var authorType = new SimpleStructType(namespaceName, "Author");
+ namespaceContext.declare("Author", Types.metaType(authorType), NullSource.INSTANCE);
+ var authorIdField = new Field("id", NativeTypes.INT_32, NullSource.INSTANCE);
+ namespaceContext.defineStructType(authorType, Optional.of(List.of(
+ authorIdField
+ )));
+ var databaseSchema = new DatabaseSchema(namespaceName, "blogApp");
+ namespaceContext.defineDatabaseSchema(databaseSchema, new DatabaseSchemaInfo(
+ SequencedMaps.ofEntries(
+ Map.entry("authors", new TableInfo(authorType, authorIdField))
+ )
+ ));
+
+ var typed = typeCheckNamespaceStatement(untyped, namespaceContext);
+
+ assertThat(typed, isTypedQueryDefinitionNode()
+ .withName(equalTo("allAuthors"))
+ );
+ }
+}
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/util/SequencedMaps.java b/src/test/java/org/zwobble/hobgoblin/compiler/util/SequencedMaps.java
new file mode 100644
index 0000000..b19d3d1
--- /dev/null
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/util/SequencedMaps.java
@@ -0,0 +1,23 @@
+package org.zwobble.hobgoblin.compiler.util;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+import java.util.SequencedMap;
+
+public class SequencedMaps {
+ private SequencedMaps() {
+ }
+
+ @SafeVarargs
+ public static <K, V> SequencedMap<K, V> ofEntries(
+ Map.Entry<K, V>... entries
+ ) {
+ var map = new LinkedHashMap<K, V>(entries.length);
+
+ for (var entry : entries) {
+ map.put(entry.getKey(), entry.getValue());
+ }
+
+ return map;
+ }
+}