summaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerStructDefinitionTests.java10
-rw-r--r--src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerTypeLevelReferenceTests.java14
2 files changed, 12 insertions, 12 deletions
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerStructDefinitionTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerStructDefinitionTests.java
index aec039b..2409b65 100644
--- a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerStructDefinitionTests.java
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerStructDefinitionTests.java
@@ -11,7 +11,7 @@ import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructDefinitionNode;
import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedStructFieldDefinitionNode;
import org.zwobble.hobgoblin.compiler.sources.NullSource;
import org.zwobble.hobgoblin.compiler.types.NamespaceName;
-import org.zwobble.hobgoblin.compiler.types.ScalarType;
+import org.zwobble.hobgoblin.compiler.types.NativeType;
import org.zwobble.hobgoblin.compiler.types.StructType;
import org.zwobble.hobgoblin.compiler.types.TypeLevelValueType;
@@ -45,8 +45,8 @@ public class TypeCheckerStructDefinitionTests {
@Test
public void fieldsAreTypeChecked() {
- var int32Type = new ScalarType("Int32");
- var int64Type = new ScalarType("Int64");
+ var int32Type = new NativeType("Int32");
+ var int64Type = new NativeType("Int64");
var untyped = new UntypedStructDefinitionNode(
"X",
List.of(
@@ -92,7 +92,7 @@ public class TypeCheckerStructDefinitionTests {
@Test
public void structCanUseTypeDefinedLater() {
- var int32Type = new ScalarType("Int32");
+ var int32Type = new NativeType("Int32");
var namespaceName = NamespaceName.of("a", "b");
var untyped = new UntypedNamespaceNode(
namespaceName,
@@ -115,7 +115,7 @@ public class TypeCheckerStructDefinitionTests {
NullSource.INSTANCE
);
var context = TypeCheckerContextArb.globalContext();
- context.addBuiltinScalarType(int32Type);
+ context.addNativeType(int32Type);
var typed = TypeChecker.typeCheckNamespace(untyped, context);
diff --git a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerTypeLevelReferenceTests.java b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerTypeLevelReferenceTests.java
index 76572a4..b2dcc62 100644
--- a/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerTypeLevelReferenceTests.java
+++ b/src/test/java/org/zwobble/hobgoblin/compiler/typechecker/TypeCheckerTypeLevelReferenceTests.java
@@ -3,7 +3,7 @@ package org.zwobble.hobgoblin.compiler.typechecker;
import org.junit.jupiter.api.Test;
import org.zwobble.hobgoblin.compiler.ast.typed.TypedTypeLevelReferenceNode;
import org.zwobble.hobgoblin.compiler.ast.untyped.UntypedArb;
-import org.zwobble.hobgoblin.compiler.types.ScalarType;
+import org.zwobble.hobgoblin.compiler.types.NativeType;
import org.zwobble.hobgoblin.compiler.types.TypeLevelValueType;
import org.zwobble.hobgoblin.compiler.types.TypeSet;
@@ -44,8 +44,8 @@ public class TypeCheckerTypeLevelReferenceTests {
var untyped = UntypedArb.typeLevelReference("X");
var context = TypeCheckerContextArb.namespaceContext();
context.declare("X");
- var scalarType = new ScalarType("Int");
- context.define("X", scalarType);
+ var nativeType = new NativeType("Int");
+ context.define("X", nativeType);
var error = assertThrows(
UnexpectedTypeError.class,
@@ -53,7 +53,7 @@ public class TypeCheckerTypeLevelReferenceTests {
);
assertThat(error.expected(), equalTo(new TypeSet.MetaType()));
- assertThat(error.actual(), equalTo(scalarType));
+ assertThat(error.actual(), equalTo(nativeType));
}
@Test
@@ -61,15 +61,15 @@ public class TypeCheckerTypeLevelReferenceTests {
var untyped = UntypedArb.typeLevelReference("X");
var context = TypeCheckerContextArb.namespaceContext();
context.declare("X");
- var scalarType = new ScalarType("Int");
- context.define("X", new TypeLevelValueType(scalarType));
+ var nativeType = new NativeType("Int");
+ context.define("X", new TypeLevelValueType(nativeType));
var typed = TypeChecker.typeCheckTypeLevelExpression(untyped, context);
assertThat(typed, instanceOf(
TypedTypeLevelReferenceNode.class,
has("name", TypedTypeLevelReferenceNode::name, equalTo("X")),
- has("value", TypedTypeLevelReferenceNode::value, equalTo(scalarType))
+ has("value", TypedTypeLevelReferenceNode::value, equalTo(nativeType))
));
}
}