aboutsummaryrefslogtreecommitdiff
path: root/src/test/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2016-10-30 20:25:05 +0000
committerMichael Williamson <mike@zwobble.org>2016-10-30 20:25:05 +0000
commitfee1878340fe2055f9d5b4c52eb2993c06c25f25 (patch)
treefb827034b5a4a2174b08803120c295f5affd764f /src/test/java
parentfd5dde9224680d46dd7081d051f1320194ff59ea (diff)
Store inner classes in ScalarType
Diffstat (limited to 'src/test/java')
-rw-r--r--src/test/java/org/zwobble/couscous/tests/BackendEvalTests.java6
-rw-r--r--src/test/java/org/zwobble/couscous/tests/CompilerTests.java44
-rw-r--r--src/test/java/org/zwobble/couscous/tests/ValueObjectTests.java8
-rw-r--r--src/test/java/org/zwobble/couscous/tests/backends/csharp/CsharpMethodRunner.java4
-rw-r--r--src/test/java/org/zwobble/couscous/tests/backends/csharp/CsharpSerializerTests.java110
-rw-r--r--src/test/java/org/zwobble/couscous/tests/backends/python/PythonMethodRunner.java2
-rw-r--r--src/test/java/org/zwobble/couscous/tests/frontends/java/ExpressionReadingTests.java64
-rw-r--r--src/test/java/org/zwobble/couscous/tests/frontends/java/JavaReaderTests.java42
-rw-r--r--src/test/java/org/zwobble/couscous/tests/frontends/java/JavaTypesTests.java4
-rw-r--r--src/test/java/org/zwobble/couscous/tests/interpreter/EvaluatorTests.java4
10 files changed, 146 insertions, 142 deletions
diff --git a/src/test/java/org/zwobble/couscous/tests/BackendEvalTests.java b/src/test/java/org/zwobble/couscous/tests/BackendEvalTests.java
index c9c7414..aab7a40 100644
--- a/src/test/java/org/zwobble/couscous/tests/BackendEvalTests.java
+++ b/src/test/java/org/zwobble/couscous/tests/BackendEvalTests.java
@@ -42,8 +42,8 @@ public abstract class BackendEvalTests {
assertEquals(
value(false),
evalExpression(same(
- constructorCall(ScalarType.of("java.lang.Object"), Collections.emptyList()),
- constructorCall(ScalarType.of("java.lang.Object"), Collections.emptyList()))));
+ constructorCall(ScalarType.topLevel("java.lang.Object"), Collections.emptyList()),
+ constructorCall(ScalarType.topLevel("java.lang.Object"), Collections.emptyList()))));
}
@Test
@@ -228,7 +228,7 @@ public abstract class BackendEvalTests {
@Test
public void staticConstructorIsExecutedOnReference() {
- ScalarType type = ScalarType.of("com.example.Example");
+ ScalarType type = ScalarType.topLevel("com.example.Example");
ClassNode classNode = ClassNode.builder(type)
.staticField("value", Types.INT)
.staticConstructor(list(
diff --git a/src/test/java/org/zwobble/couscous/tests/CompilerTests.java b/src/test/java/org/zwobble/couscous/tests/CompilerTests.java
index 94c6e6a..495f7ed 100644
--- a/src/test/java/org/zwobble/couscous/tests/CompilerTests.java
+++ b/src/test/java/org/zwobble/couscous/tests/CompilerTests.java
@@ -54,7 +54,7 @@ public abstract class CompilerTests {
value(720),
execTestProgram(
"recursive-factorial",
- ScalarType.of("com.example.RecursiveFactorial"),
+ ScalarType.topLevel("com.example.RecursiveFactorial"),
"factorial",
list(value(6)),
Types.INT));
@@ -66,7 +66,7 @@ public abstract class CompilerTests {
value(720),
execTestProgram(
"while-factorial",
- ScalarType.of("com.example.WhileFactorial"),
+ ScalarType.topLevel("com.example.WhileFactorial"),
"factorial",
list(value(6)),
Types.INT));
@@ -78,7 +78,7 @@ public abstract class CompilerTests {
value(720),
execTestProgram(
"for-factorial",
- ScalarType.of("com.example.ForFactorial"),
+ ScalarType.topLevel("com.example.ForFactorial"),
"factorial",
list(value(6)),
Types.INT));
@@ -90,7 +90,7 @@ public abstract class CompilerTests {
value("abc"),
execTestProgram(
"for-each",
- ScalarType.of("com.example.ForEach"),
+ ScalarType.topLevel("com.example.ForEach"),
"value",
list(),
Types.STRING));
@@ -102,7 +102,7 @@ public abstract class CompilerTests {
value(42),
execTestProgram(
"static-nested-class",
- ScalarType.of("com.example.StaticNestedClass"),
+ ScalarType.topLevel("com.example.StaticNestedClass"),
"value",
list(),
Types.INT));
@@ -114,7 +114,7 @@ public abstract class CompilerTests {
value(42),
execTestProgram(
"inner-class",
- ScalarType.of("com.example.InnerClass"),
+ ScalarType.topLevel("com.example.InnerClass"),
"run",
list(),
Types.INT));
@@ -126,7 +126,7 @@ public abstract class CompilerTests {
value(42),
execTestProgram(
"inner-class-with-constructor-args",
- ScalarType.of("com.example.InnerClass"),
+ ScalarType.topLevel("com.example.InnerClass"),
"run",
list(),
Types.INT));
@@ -138,7 +138,7 @@ public abstract class CompilerTests {
value(42),
execTestProgram(
"implement-user-interface",
- ScalarType.of("com.example.ConstantIntSupplier"),
+ ScalarType.topLevel("com.example.ConstantIntSupplier"),
"value",
list(),
Types.INT));
@@ -150,7 +150,7 @@ public abstract class CompilerTests {
value(42),
execTestProgram(
"anonymous-class",
- ScalarType.of("com.example.AnonymousClass"),
+ ScalarType.topLevel("com.example.AnonymousClass"),
"value",
list(),
Types.INT));
@@ -162,7 +162,7 @@ public abstract class CompilerTests {
value(42),
execTestProgram(
"anonymous-class-this-reference",
- ScalarType.of("com.example.AnonymousClass"),
+ ScalarType.topLevel("com.example.AnonymousClass"),
"value",
list(),
Types.INT));
@@ -174,7 +174,7 @@ public abstract class CompilerTests {
value(42),
execTestProgram(
"anonymous-class-capture",
- ScalarType.of("com.example.AnonymousClass"),
+ ScalarType.topLevel("com.example.AnonymousClass"),
"value",
list(value(42)),
Types.INT));
@@ -186,7 +186,7 @@ public abstract class CompilerTests {
value("Hello"),
execTestProgram(
"anonymous-class-type-capture",
- ScalarType.of("com.example.AnonymousClass"),
+ ScalarType.topLevel("com.example.AnonymousClass"),
"value",
list(),
Types.STRING));
@@ -198,7 +198,7 @@ public abstract class CompilerTests {
value(42),
execTestProgram(
"lambda",
- ScalarType.of("com.example.Lambda"),
+ ScalarType.topLevel("com.example.Lambda"),
"value",
list(),
Types.INT));
@@ -210,7 +210,7 @@ public abstract class CompilerTests {
value(42),
execTestProgram(
"lambda-capture",
- ScalarType.of("com.example.Lambda"),
+ ScalarType.topLevel("com.example.Lambda"),
"value",
list(value(2)),
Types.INT));
@@ -222,7 +222,7 @@ public abstract class CompilerTests {
value(84),
execTestProgram(
"lambda-multiple-capture",
- ScalarType.of("com.example.Lambda"),
+ ScalarType.topLevel("com.example.Lambda"),
"value",
list(value(2)),
Types.INT));
@@ -234,7 +234,7 @@ public abstract class CompilerTests {
value(42),
execTestProgram(
"lambda-this-capture",
- ScalarType.of("com.example.Lambda"),
+ ScalarType.topLevel("com.example.Lambda"),
"value",
list(value(2)),
Types.INT));
@@ -246,7 +246,7 @@ public abstract class CompilerTests {
value("two"),
execTestProgram(
"generic-method",
- ScalarType.of("com.example.GenericMethod"),
+ ScalarType.topLevel("com.example.GenericMethod"),
"value",
list(),
Types.STRING));
@@ -258,7 +258,7 @@ public abstract class CompilerTests {
value("Hello"),
execTestProgram(
"generic-interface-return-type",
- ScalarType.of("com.example.GenericInterface"),
+ ScalarType.topLevel("com.example.GenericInterface"),
"value",
list(),
Types.STRING));
@@ -270,7 +270,7 @@ public abstract class CompilerTests {
value("Hello"),
execTestProgram(
"generic-interface-non-generic-methods",
- ScalarType.of("com.example.GenericInterface"),
+ ScalarType.topLevel("com.example.GenericInterface"),
"value",
list(),
Types.STRING));
@@ -282,7 +282,7 @@ public abstract class CompilerTests {
value(42),
execTestProgram(
"static-method-overloads",
- ScalarType.of("com.example.StaticMethodOverloads"),
+ ScalarType.topLevel("com.example.StaticMethodOverloads"),
"value",
list(),
Types.INT));
@@ -306,7 +306,7 @@ public abstract class CompilerTests {
value(expected),
execTestProgram(
"switch-statements",
- ScalarType.of("com.example.SwitchStatements"),
+ ScalarType.topLevel("com.example.SwitchStatements"),
methodName,
list(value(input)),
Types.INT));
@@ -374,7 +374,7 @@ public abstract class CompilerTests {
Files.write(directoryPath.resolve("com/example/Example.java"), list(javaClass));
return execProgram(
directoryPath,
- ScalarType.of("com.example.Example"),
+ ScalarType.topLevel("com.example.Example"),
"main",
list(),
returnType);
diff --git a/src/test/java/org/zwobble/couscous/tests/ValueObjectTests.java b/src/test/java/org/zwobble/couscous/tests/ValueObjectTests.java
index dbdd483..86397a5 100644
--- a/src/test/java/org/zwobble/couscous/tests/ValueObjectTests.java
+++ b/src/test/java/org/zwobble/couscous/tests/ValueObjectTests.java
@@ -67,7 +67,6 @@ public class ValueObjectTests {
{OperationNode.class},
{ParameterizedType.class},
{ReturnNode.class},
- {ScalarType.class},
{StaticReceiver.class},
{TernaryConditionalNode.class},
{ThisReferenceNode.class},
@@ -75,7 +74,6 @@ public class ValueObjectTests {
{TryNode.class},
{TypeCoercionNode.class},
{TypeParameter.class},
- {ScalarType.class},
{VariableDeclaration.class},
{VariableReferenceNode.class},
{WhileNode.class}
@@ -166,6 +164,8 @@ public class ValueObjectTests {
return generateFirstInstance(VariableReferenceNode.class);
} else if (type.equals(Type.class)) {
return generateFirstInstance(ScalarType.class);
+ } else if (type.equals(ScalarType.class)) {
+ return ScalarType.topLevel("T1");
} else {
return generateValue(type, ValueObjectTests::generateFirstInstance).instance;
}
@@ -196,6 +196,8 @@ public class ValueObjectTests {
return generateSecondInstance(VariableReferenceNode.class);
} else if (type.equals(Type.class)) {
return generateSecondInstance(ScalarType.class);
+ } else if (type.equals(ScalarType.class)) {
+ return ScalarType.topLevel("T2");
} else {
return generateValue(type, ValueObjectTests::generateSecondInstance).instance;
}
@@ -226,6 +228,8 @@ public class ValueObjectTests {
return generateInstance(VariableReferenceNode.class);
} else if (type.equals(Type.class)) {
return generateInstance(ScalarType.class);
+ } else if (type.equals(ScalarType.class)) {
+ return ScalarType.topLevel("T");
} else {
return generateValue(type, ValueObjectTests::generateInstance).instance;
}
diff --git a/src/test/java/org/zwobble/couscous/tests/backends/csharp/CsharpMethodRunner.java b/src/test/java/org/zwobble/couscous/tests/backends/csharp/CsharpMethodRunner.java
index 822ee8b..68b053d 100644
--- a/src/test/java/org/zwobble/couscous/tests/backends/csharp/CsharpMethodRunner.java
+++ b/src/test/java/org/zwobble/couscous/tests/backends/csharp/CsharpMethodRunner.java
@@ -75,7 +75,7 @@ public class CsharpMethodRunner implements MethodRunner {
String csharpMethodName = CsharpCodeGenerator.NAMING.methodName(signature);
String value = CsharpSerializer.serialize(
staticMethodCall(
- ScalarType.of(NAMESPACE + "." + className.getQualifiedName()),
+ ScalarType.topLevel(NAMESPACE + "." + className.getQualifiedName()),
csharpMethodName,
eagerMap(arguments, LiteralNode::literal),
returnType));
@@ -200,7 +200,7 @@ public class CsharpMethodRunner implements MethodRunner {
return value(Types.STRING);
} else {
assertThat(value, Matchers.startsWith(NAMESPACE_PREFIX));
- return value(ScalarType.of(value.substring(NAMESPACE_PREFIX.length())));
+ return value(ScalarType.topLevel(value.substring(NAMESPACE_PREFIX.length())));
}
default:
throw new RuntimeException("Unhandled type: " + type);
diff --git a/src/test/java/org/zwobble/couscous/tests/backends/csharp/CsharpSerializerTests.java b/src/test/java/org/zwobble/couscous/tests/backends/csharp/CsharpSerializerTests.java
index 636b214..ca15ba9 100644
--- a/src/test/java/org/zwobble/couscous/tests/backends/csharp/CsharpSerializerTests.java
+++ b/src/test/java/org/zwobble/couscous/tests/backends/csharp/CsharpSerializerTests.java
@@ -70,49 +70,49 @@ public class CsharpSerializerTests {
@Test
public void typeLiteralUsesTypeOfOperator() {
- String output = serialize(literal(ScalarType.of("com.example.Example")));
+ String output = serialize(literal(ScalarType.topLevel("com.example.Example")));
assertEquals("typeof(com.example.Example)", output);
}
@Test
public void typeLiteralUsesAtSymbolToEscapeReservedIdentifiers() {
- String output = serialize(literal(ScalarType.of("internal")));
+ String output = serialize(literal(ScalarType.topLevel("internal")));
assertEquals("typeof(@internal)", output);
}
@Test
public void typeLiteralDoesntUseAtSymbolForReservedTypeIdentifiers() {
- String output = serialize(literal(ScalarType.of("string")));
+ String output = serialize(literal(ScalarType.topLevel("string")));
assertEquals("typeof(string)", output);
}
@Test
public void variableReferenceWritesIdentifier() {
- String output = serialize(reference(var(TestIds.ANY_ID, "x", ScalarType.of("X"))));
+ String output = serialize(reference(var(TestIds.ANY_ID, "x", ScalarType.topLevel("X"))));
assertEquals("x", output);
}
@Test
public void identifierIsEscapedWithAtSymbolIfItsAReservedWord() {
- String output = serialize(reference(var(TestIds.ANY_ID, "internal", ScalarType.of("X"))));
+ String output = serialize(reference(var(TestIds.ANY_ID, "internal", ScalarType.topLevel("X"))));
assertEquals("@internal", output);
}
@Test
public void thisReferenceUsesThisKeyword() {
- String output = serialize(thisReference(ScalarType.of("X")));
+ String output = serialize(thisReference(ScalarType.topLevel("X")));
assertEquals("this", output);
}
@Test
public void emptyArraySpecifiesTypeOfArray() {
- String output = serialize(array(ScalarType.of("X"), list()));
+ String output = serialize(array(ScalarType.topLevel("X"), list()));
assertEquals("new X[] {}", output);
}
@Test
public void arrayElementsAreSeparatedByComma() {
- String output = serialize(array(ScalarType.of("X"), list(literal(1), literal(2))));
+ String output = serialize(array(ScalarType.topLevel("X"), list(literal(1), literal(2))));
assertEquals("new X[] {1, 2}", output);
}
@@ -133,49 +133,49 @@ public class CsharpSerializerTests {
@Test
public void staticMethodCallWithNoArgumentsWritesStaticReceiver() {
String output = serialize(staticMethodCall(
- ScalarType.of("X"),
+ ScalarType.topLevel("X"),
"y",
list(),
- ScalarType.of("Y")));
+ ScalarType.topLevel("Y")));
assertEquals("X.y()", output);
}
@Test
public void methodCallWithNoArgumentsWritesReceiver() {
String output = serialize(methodCall(
- reference(var(TestIds.ANY_ID, "x", ScalarType.of("X"))),
+ reference(var(TestIds.ANY_ID, "x", ScalarType.topLevel("X"))),
"y",
list(),
- ScalarType.of("Y")));
+ ScalarType.topLevel("Y")));
assertEquals("x.y()", output);
}
@Test
public void methodCallWithArguments() {
String output = serialize(methodCall(
- reference(var(TestIds.ANY_ID, "x", ScalarType.of("X"))),
+ reference(var(TestIds.ANY_ID, "x", ScalarType.topLevel("X"))),
"y",
list(literal(1), literal(2)),
- ScalarType.of("Y")));
+ ScalarType.topLevel("Y")));
assertEquals("x.y(1, 2)", output);
}
@Test
public void methodCallWithTypeParameters() {
String output = serialize(methodCall(
- instanceReceiver(reference(var(TestIds.ANY_ID, "x", ScalarType.of("X")))),
+ instanceReceiver(reference(var(TestIds.ANY_ID, "x", ScalarType.topLevel("X")))),
"y",
- list(ScalarType.of("Z")),
+ list(ScalarType.topLevel("Z")),
list(),
- ScalarType.of("Y"),
- signature("y", list(typeParameter(Identifier.forType("X").method("y"), "T")), list(), ScalarType.of("Y"))));
+ ScalarType.topLevel("Y"),
+ signature("y", list(typeParameter(Identifier.forType("X").method("y"), "T")), list(), ScalarType.topLevel("Y"))));
assertEquals("x.y<Z>()", output);
}
@Test
public void constructorCallWithNoArguments() {
String output = serialize(constructorCall(
- ScalarType.of("X"),
+ ScalarType.topLevel("X"),
list()));
assertEquals("new X()", output);
}
@@ -183,7 +183,7 @@ public class CsharpSerializerTests {
@Test
public void constructorCallWithArguments() {
String output = serialize(constructorCall(
- ScalarType.of("X"),
+ ScalarType.topLevel("X"),
list(literal(1), literal(2))));
assertEquals("new X(1, 2)", output);
}
@@ -205,7 +205,7 @@ public class CsharpSerializerTests {
public void instanceOfIsWrittenUsingIsOperator() {
String output = serialize(instanceOf(
reference(var(TestIds.ANY_ID, "x", Types.OBJECT)),
- ScalarType.of("X")));
+ ScalarType.topLevel("X")));
assertEquals("x is X", output);
}
@@ -218,26 +218,26 @@ public class CsharpSerializerTests {
@Test
public void fieldAccessSeparatesReceiverAndNameWithDot() {
String output = serialize(fieldAccess(
- reference(var(TestIds.ANY_ID, "x", ScalarType.of("X"))),
+ reference(var(TestIds.ANY_ID, "x", ScalarType.topLevel("X"))),
"y",
- ScalarType.of("Y")));
+ ScalarType.topLevel("Y")));
assertEquals("x.y", output);
}
@Test
public void staticFieldAccessSeparatesReceiverAndNameWithDot() {
String output = serialize(fieldAccess(
- ScalarType.of("X"),
+ ScalarType.topLevel("X"),
"y",
- ScalarType.of("Y")));
+ ScalarType.topLevel("Y")));
assertEquals("X.y", output);
}
@Test
public void castIsWrittenWithParenthesisedType() {
String output = serialize(cast(
- reference(var(TestIds.ANY_ID, "x", ScalarType.of("X"))),
- ScalarType.of("Y")));
+ reference(var(TestIds.ANY_ID, "x", ScalarType.topLevel("X"))),
+ ScalarType.topLevel("Y")));
assertEquals("(Y) x", output);
}
@@ -255,7 +255,7 @@ public class CsharpSerializerTests {
@Test
public void throwStatementIncludesValue() {
- String output = serialize(throwNode(reference(var(TestIds.ANY_ID, "x", ScalarType.of("X")))));
+ String output = serialize(throwNode(reference(var(TestIds.ANY_ID, "x", ScalarType.topLevel("X")))));
assertEquals("throw x;\n", output);
}
@@ -270,7 +270,7 @@ public class CsharpSerializerTests {
String output = serialize(localVariableDeclaration(
TestIds.ANY_ID,
"x",
- ScalarType.of("X"),
+ ScalarType.topLevel("X"),
literal("[value]")));
assertEquals("X x = \"[value]\";\n", output);
}
@@ -280,7 +280,7 @@ public class CsharpSerializerTests {
String output = serialize(localVariableDeclaration(
TestIds.ANY_ID,
"x",
- ScalarType.of("string"),
+ ScalarType.topLevel("string"),
literal("[value]")));
assertEquals("string x = \"[value]\";\n", output);
}
@@ -349,8 +349,8 @@ public class CsharpSerializerTests {
@Test
public void tryStatementCanHaveBodyAndMultipleHandlers() {
- VariableDeclaration varX = var(TestIds.variable("x"), "x", ScalarType.of("X"));
- VariableDeclaration varY = var(TestIds.variable("y"), "y", ScalarType.of("Y"));
+ VariableDeclaration varX = var(TestIds.variable("x"), "x", ScalarType.topLevel("X"));
+ VariableDeclaration varY = var(TestIds.variable("y"), "y", ScalarType.topLevel("Y"));
String output = serialize(tryStatement(
list(returns(literal(1))),
list(
@@ -372,7 +372,7 @@ public class CsharpSerializerTests {
@Test
public void methodCanHaveVoidReturnType() {
String output = serialize(MethodNode.staticMethod("nothing")
- .returns(ScalarType.of("void"))
+ .returns(ScalarType.topLevel("void"))
.build());
assertEquals("public static void nothing() {\n}\n", output);
}
@@ -380,7 +380,7 @@ public class CsharpSerializerTests {
@Test
public void instanceMethodHasNoStaticKeword() {
String output = serialize(MethodNode.builder("nothing")
- .returns(ScalarType.of("void"))
+ .returns(ScalarType.topLevel("void"))
.build());
assertEquals("public void nothing() {\n}\n", output);
}
@@ -388,7 +388,7 @@ public class CsharpSerializerTests {
@Test
public void methodWithReturnType() {
MethodNode methodNode = MethodNode.staticMethod("nothing")
- .returns(ScalarType.of("X"))
+ .returns(ScalarType.topLevel("X"))
.build();
String output = serialize(methodNode);
@@ -399,9 +399,9 @@ public class CsharpSerializerTests {
@Test
public void methodWithArguments() {
MethodNode methodNode = MethodNode.staticMethod("nothing")
- .argument(formalArg(var(TestIds.variable("x"), "x", ScalarType.of("X"))))
- .argument(formalArg(var(TestIds.variable("y"), "y", ScalarType.of("Y"))))
- .returns(ScalarType.of("void"))
+ .argument(formalArg(var(TestIds.variable("x"), "x", ScalarType.topLevel("X"))))
+ .argument(formalArg(var(TestIds.variable("y"), "y", ScalarType.topLevel("Y"))))
+ .returns(ScalarType.topLevel("void"))
.build();
String output = serialize(methodNode);
@@ -412,7 +412,7 @@ public class CsharpSerializerTests {
@Test
public void methodHasSerializedBody() {
MethodNode method = MethodNode.staticMethod("nothing")
- .returns(ScalarType.of("void"))
+ .returns(ScalarType.topLevel("void"))
.statement(returns(literal(true)))
.build();
String output = serialize(method);
@@ -424,7 +424,7 @@ public class CsharpSerializerTests {
MethodNode methodNode = MethodNode.staticMethod("nothing")
.typeParameter(formalTypeParameter(Identifier.forType("com.Example.example").method("nothing"), "T"))
.typeParameter(formalTypeParameter(Identifier.forType("com.Example.example").method("nothing"), "U"))
- .returns(ScalarType.of("void"))
+ .returns(ScalarType.topLevel("void"))
.build();
String output = serialize(methodNode);
@@ -457,7 +457,7 @@ public class CsharpSerializerTests {
String output = serialize(localVariableDeclaration(
TestIds.ANY_ID,
"x",
- ScalarType.of("com.example.internal.Example"),
+ ScalarType.topLevel("com.example.internal.Example"),
literal("[value]")));
assertEquals("com.example.@internal.Example x = \"[value]\";\n", output);
}
@@ -467,8 +467,8 @@ public class CsharpSerializerTests {
ClassNode classNode = ClassNode.builder("com.example.Example")
.addTypeParameter("T")
.addTypeParameter("U")
- .field("x", ScalarType.of("X"))
- .staticField("y", ScalarType.of("Y"))
+ .field("x", ScalarType.topLevel("X"))
+ .staticField("y", ScalarType.topLevel("Y"))
.build();
String output = serialize(classNode);
@@ -506,7 +506,7 @@ public class CsharpSerializerTests {
@Test
public void constructorHasSerializedBody() {
ConstructorNode constructor = ConstructorNode.constructor(
- list(formalArg(var(TestIds.ANY_ID, "x", ScalarType.of("X")))),
+ list(formalArg(var(TestIds.ANY_ID, "x", ScalarType.topLevel("X")))),
list(expressionStatement(literal(true))));
ClassNode classNode = ClassNode.builder("com.example.Example")
.constructor(constructor)
@@ -521,8 +521,8 @@ public class CsharpSerializerTests {
@Test
public void classWithFields() {
ClassNode classNode = ClassNode.builder("com.example.Example")
- .staticField("x", ScalarType.of("X"))
- .field("y", ScalarType.of("Y"))
+ .staticField("x", ScalarType.topLevel("X"))
+ .field("y", ScalarType.topLevel("Y"))
.build();
String output = serialize(classNode);
@@ -532,7 +532,7 @@ public class CsharpSerializerTests {
@Test
public void interfaceIsInNamespace() {
- Node node = new ClassNodeBuilder(ScalarType.of("com.example.Example")).buildInterface();
+ Node node = new ClassNodeBuilder(ScalarType.topLevel("com.example.Example")).buildInterface();
String output = serialize(node);
@@ -541,7 +541,7 @@ public class CsharpSerializerTests {
@Test
public void interfaceWithTypeParameters() {
- Node node = new ClassNodeBuilder(ScalarType.of("com.example.Example"))
+ Node node = new ClassNodeBuilder(ScalarType.topLevel("com.example.Example"))
.addTypeParameter("T")
.addTypeParameter("U")
.buildInterface();
@@ -553,7 +553,7 @@ public class CsharpSerializerTests {
@Test
public void interfaceWithSuperTypes() {
- Node node = new ClassNodeBuilder(ScalarType.of("com.example.Example"))
+ Node node = new ClassNodeBuilder(ScalarType.topLevel("com.example.Example"))
.addSuperType("com.example.Base")
.buildInterface();
@@ -564,8 +564,8 @@ public class CsharpSerializerTests {
@Test
public void interfaceWithMethod() {
- MethodNode method = MethodNode.builder("get").isAbstract().returns(ScalarType.of("X")).build();
- Node node = new ClassNodeBuilder(ScalarType.of("com.example.Example"))
+ MethodNode method = MethodNode.builder("get").isAbstract().returns(ScalarType.topLevel("X")).build();
+ Node node = new ClassNodeBuilder(ScalarType.topLevel("com.example.Example"))
.method(method)
.buildInterface();
@@ -579,10 +579,10 @@ public class CsharpSerializerTests {
MethodNode method = MethodNode.staticMethod("nothing")
.typeParameter(formalTypeParameter(Identifier.forType("com.Example.example").method("nothing"), "T"))
.typeParameter(formalTypeParameter(Identifier.forType("com.Example.example").method("nothing"), "U"))
- .returns(ScalarType.of("void"))
+ .returns(ScalarType.topLevel("void"))
.build();
- Node node = new ClassNodeBuilder(ScalarType.of("com.example.Example"))
+ Node node = new ClassNodeBuilder(ScalarType.topLevel("com.example.Example"))
.method(method)
.buildInterface();
@@ -593,7 +593,7 @@ public class CsharpSerializerTests {
@Test
public void enumWithSimpleValues() {
- Node node = declareEnum(ScalarType.of("com.example.Example"), list("ONE", "TWO"));
+ Node node = declareEnum(ScalarType.topLevel("com.example.Example"), list("ONE", "TWO"));
String output = serialize(node);
@@ -602,7 +602,7 @@ public class CsharpSerializerTests {
@Test
public void arrayTypeUsesSquareBrackets() {
- String output = serialize(formalArg(var(TestIds.ANY_ID, "x", Types.array(ScalarType.of("string")))));
+ String output = serialize(formalArg(var(TestIds.ANY_ID, "x", Types.array(ScalarType.topLevel("string")))));
assertEquals("string[] x", output);
}
diff --git a/src/test/java/org/zwobble/couscous/tests/backends/python/PythonMethodRunner.java b/src/test/java/org/zwobble/couscous/tests/backends/python/PythonMethodRunner.java
index 87ece2d..e9bcdf0 100644
--- a/src/test/java/org/zwobble/couscous/tests/backends/python/PythonMethodRunner.java
+++ b/src/test/java/org/zwobble/couscous/tests/backends/python/PythonMethodRunner.java
@@ -86,7 +86,7 @@ public class PythonMethodRunner implements MethodRunner {
case "<class 'type'>":
String typeName = value.substring(value.indexOf("'") + 1, value.lastIndexOf("'"));
assertThat(typeName, Matchers.startsWith(PACKAGE_PREFIX));
- return value(ScalarType.of(typeName.substring(PACKAGE_PREFIX.length(), typeName.lastIndexOf("."))));
+ return value(ScalarType.topLevel(typeName.substring(PACKAGE_PREFIX.length(), typeName.lastIndexOf("."))));
default:
throw new RuntimeException("Unhandled type: " + type);
}
diff --git a/src/test/java/org/zwobble/couscous/tests/frontends/java/ExpressionReadingTests.java b/src/test/java/org/zwobble/couscous/tests/frontends/java/ExpressionReadingTests.java
index e7b2f66..4aa015e 100644
--- a/src/test/java/org/zwobble/couscous/tests/frontends/java/ExpressionReadingTests.java
+++ b/src/test/java/org/zwobble/couscous/tests/frontends/java/ExpressionReadingTests.java
@@ -65,7 +65,7 @@ public class ExpressionReadingTests {
@Test
public void canReadThisReference() {
assertEquals(
- thisReference(ScalarType.of("com.example.Example")),
+ thisReference(ScalarType.topLevel("com.example.Example")),
readExpressionInInstanceMethod("com.example.Example", "this"));
}
@@ -81,7 +81,7 @@ public class ExpressionReadingTests {
"private String name;");
assertEquals(
- list(field("name", ScalarType.of("java.lang.String"))),
+ list(field("name", ScalarType.topLevel("java.lang.String"))),
classNode.getFields());
}
@@ -91,7 +91,7 @@ public class ExpressionReadingTests {
"private static String name;");
assertEquals(
- list(staticField("name", ScalarType.of("java.lang.String"))),
+ list(staticField("name", ScalarType.topLevel("java.lang.String"))),
classNode.getFields());
}
@@ -115,7 +115,7 @@ public class ExpressionReadingTests {
ReturnNode returnNode = (ReturnNode) classNode.getMethods().get(0).getBody().get().get(0);
assertEquals(
fieldAccess(
- thisReference(ScalarType.of("com.example.Example")),
+ thisReference(ScalarType.topLevel("com.example.Example")),
"name",
Types.STRING),
returnNode.getValue());
@@ -132,7 +132,7 @@ public class ExpressionReadingTests {
ReturnNode returnNode = (ReturnNode) classNode.getMethods().get(0).getBody().get().get(1);
assertThat(returnNode.getValue(), isFieldAccess(
- fieldHasReceiver(isVariableReference("self", ScalarType.of("com.example.Example"))),
+ fieldHasReceiver(isVariableReference("self", ScalarType.topLevel("com.example.Example"))),
fieldHasName("name"),
expressionHasType(Types.STRING)));
}
@@ -167,7 +167,7 @@ public class ExpressionReadingTests {
ReturnNode returnNode = (ReturnNode) classNode.getMethods().get(0).getBody().get().get(0);
assertEquals(
fieldAccess(
- ScalarType.of("com.example.Example"),
+ ScalarType.topLevel("com.example.Example"),
"name",
Types.STRING),
returnNode.getValue());
@@ -197,7 +197,7 @@ public class ExpressionReadingTests {
assertEquals(
methodCall(
- ThisReferenceNode.thisReference(ScalarType.of("com.example.Example")),
+ ThisReferenceNode.thisReference(ScalarType.topLevel("com.example.Example")),
"loop",
list(),
Types.STRING),
@@ -208,7 +208,7 @@ public class ExpressionReadingTests {
public void canReadStaticMethodCalls() {
assertEquals(
staticMethodCall(
- ScalarType.of("java.lang.Integer"),
+ ScalarType.topLevel("java.lang.Integer"),
"parseInt",
list(literal("42")),
Types.INT),
@@ -225,7 +225,7 @@ public class ExpressionReadingTests {
assertEquals(
staticMethodCall(
- ScalarType.of("com.example.Example"),
+ ScalarType.topLevel("com.example.Example"),
"loop",
list(),
Types.STRING),
@@ -241,12 +241,12 @@ public class ExpressionReadingTests {
"asList",
list(Types.STRING),
list(array(Types.STRING, list())),
- parameterizedType(ScalarType.of("java.util.List"), list(Types.STRING)),
+ parameterizedType(ScalarType.topLevel("java.util.List"), list(Types.STRING)),
signature(
"asList",
list(typeParameter),
list(Types.array(typeParameter)),
- parameterizedType(ScalarType.of("java.util.List"), list(typeParameter)))),
+ parameterizedType(ScalarType.topLevel("java.util.List"), list(typeParameter)))),
readExpression("java.util.List<String>", "java.util.Arrays.asList()"));
}
@@ -259,12 +259,12 @@ public class ExpressionReadingTests {
"asList",
list(Types.STRING),
list(array(Types.STRING, list(literal("one"), literal("two")))),
- parameterizedType(ScalarType.of("java.util.List"), list(Types.STRING)),
+ parameterizedType(ScalarType.topLevel("java.util.List"), list(Types.STRING)),
signature(
"asList",
list(typeParameter),
list(Types.array(typeParameter)),
- parameterizedType(ScalarType.of("java.util.List"), list(typeParameter)))),
+ parameterizedType(ScalarType.topLevel("java.util.List"), list(typeParameter)))),
readExpression("java.util.List<String>", "java.util.Arrays.asList(\"one\", \"two\")"));
}
@@ -277,12 +277,12 @@ public class ExpressionReadingTests {
"asList",
list(Types.STRING),
list(array(Types.STRING, list())),
- parameterizedType(ScalarType.of("java.util.List"), list(Types.STRING)),
+ parameterizedType(ScalarType.topLevel("java.util.List"), list(Types.STRING)),
signature(
"asList",
list(typeParameter),
list(Types.array(typeParameter)),
- parameterizedType(ScalarType.of("java.util.List"), list(typeParameter)))),
+ parameterizedType(ScalarType.topLevel("java.util.List"), list(typeParameter)))),
readExpression("java.util.List<String>", "java.util.Arrays.asList(new String[]{})"));
}
@@ -295,12 +295,12 @@ public class ExpressionReadingTests {
"emptyList",
list(Types.STRING),
list(),
- parameterizedType(ScalarType.of("java.util.List"), list(Types.STRING)),
+ parameterizedType(ScalarType.topLevel("java.util.List"), list(Types.STRING)),
signature(
"emptyList",
list(typeParameter),
list(),
- parameterizedType(ScalarType.of("java.util.List"), list(typeParameter)))),
+ parameterizedType(ScalarType.topLevel("java.util.List"), list(typeParameter)))),
readExpression("java.util.List<String>", "java.util.Collections.<String>emptyList()"));
}
@@ -313,19 +313,19 @@ public class ExpressionReadingTests {
"emptyList",
list(Types.STRING),
list(),
- parameterizedType(ScalarType.of("java.util.List"), list(Types.STRING)),
+ parameterizedType(ScalarType.topLevel("java.util.List"), list(Types.STRING)),
signature(
"emptyList",
list(typeParameter),
list(),
- parameterizedType(ScalarType.of("java.util.List"), list(typeParameter)))),
+ parameterizedType(ScalarType.topLevel("java.util.List"), list(typeParameter)))),
readExpression("java.util.List<String>", "java.util.Collections.emptyList()"));
}
@Test
public void canReadConstructorCalls() {
assertEquals(
- constructorCall(ScalarType.of("java.lang.String"), list(literal("_"))),
+ constructorCall(ScalarType.topLevel("java.lang.String"), list(literal("_"))),
readExpression("String", "new String(\"_\")"));
}
@@ -343,20 +343,20 @@ public class ExpressionReadingTests {
public void canUseOperatorsOnReferences() {
assertEquals(
same(
- constructorCall(ScalarType.of("java.lang.Object"), emptyList()),
- constructorCall(ScalarType.of("java.lang.Object"), emptyList())),
+ constructorCall(ScalarType.topLevel("java.lang.Object"), emptyList()),
+ constructorCall(ScalarType.topLevel("java.lang.Object"), emptyList())),
readBooleanExpression("new Object() == new Object()"));
assertEquals(
not(same(
- constructorCall(ScalarType.of("java.lang.Object"), emptyList()),
- constructorCall(ScalarType.of("java.lang.Object"), emptyList()))),
+ constructorCall(ScalarType.topLevel("java.lang.Object"), emptyList()),
+ constructorCall(ScalarType.topLevel("java.lang.Object"), emptyList()))),
readBooleanExpression("new Object() != new Object()"));
assertEquals(
instanceOf(
- constructorCall(ScalarType.of("java.lang.Object"), emptyList()),
- ScalarType.of("java.lang.Object")),
+ constructorCall(ScalarType.topLevel("java.lang.Object"), emptyList()),
+ ScalarType.topLevel("java.lang.Object")),
readBooleanExpression("new Object() instanceof Object"));
}
@@ -417,13 +417,13 @@ public class ExpressionReadingTests {
assertEquals(
equal(
literal(1),
- unboxInt(constructorCall(ScalarType.of("java.lang.Integer"), list(literal(1))))),
+ unboxInt(constructorCall(ScalarType.topLevel("java.lang.Integer"), list(literal(1))))),
readBooleanExpression("1 == new Integer(1)"));
assertEquals(
notEqual(
literal(1),
- unboxInt(constructorCall(ScalarType.of("java.lang.Integer"), list(literal(1))))),
+ unboxInt(constructorCall(ScalarType.topLevel("java.lang.Integer"), list(literal(1))))),
readBooleanExpression("1 != new Integer(1)"));
}
@@ -446,8 +446,8 @@ public class ExpressionReadingTests {
public void integerOperatorUnboxesWhenBothOperandsAreBoxed() {
assertEquals(
integerAdd(
- unboxInt(constructorCall(ScalarType.of("java.lang.Integer"), list(literal(1)))),
- unboxInt(constructorCall(ScalarType.of("java.lang.Integer"), list(literal(2))))),
+ unboxInt(constructorCall(ScalarType.topLevel("java.lang.Integer"), list(literal(1)))),
+ unboxInt(constructorCall(ScalarType.topLevel("java.lang.Integer"), list(literal(2))))),
readIntExpression("new Integer(1) + new Integer(2)"));
}
@@ -470,7 +470,7 @@ public class ExpressionReadingTests {
assertEquals(
assign(
fieldAccess(
- thisReference(ScalarType.of("com.example.Example")),
+ thisReference(ScalarType.topLevel("com.example.Example")),
"name",
Types.STRING),
literal("blah")),
@@ -489,7 +489,7 @@ public class ExpressionReadingTests {
assertEquals(
assign(
fieldAccess(
- thisReference(ScalarType.of("com.example.Example")),
+ thisReference(ScalarType.topLevel("com.example.Example")),
"value",
Types.OBJECT),
typeCoercion(literal(4), Types.OBJECT)),
diff --git a/src/test/java/org/zwobble/couscous/tests/frontends/java/JavaReaderTests.java b/src/test/java/org/zwobble/couscous/tests/frontends/java/JavaReaderTests.java
index 7b208f5..7410324 100644
--- a/src/test/java/org/zwobble/couscous/tests/frontends/java/JavaReaderTests.java
+++ b/src/test/java/org/zwobble/couscous/tests/frontends/java/JavaReaderTests.java
@@ -92,7 +92,7 @@ public class JavaReaderTests {
"}");
MethodNode method = classNode.getMethods().get(0);
- assertThat(method.getArguments(), contains(isFormalArgument("value", ScalarType.of("int"))));
+ assertThat(method.getArguments(), contains(isFormalArgument("value", ScalarType.topLevel("int"))));
ReturnNode returnNode = (ReturnNode)method.getBody().get().get(0);
assertEquals(reference(method.getArguments().get(0)), returnNode.getValue());
@@ -119,7 +119,7 @@ public class JavaReaderTests {
public void canReadThrowStatements() {
assertEquals(
throwNode(
- constructorCall(ScalarType.of("java.lang.RuntimeException"), list())),
+ constructorCall(ScalarType.topLevel("java.lang.RuntimeException"), list())),
readStatement("void", "throw new RuntimeException();"));
}
@@ -128,7 +128,7 @@ public class JavaReaderTests {
assertEquals(
expressionStatement(
staticMethodCall(
- ScalarType.of("java.lang.Integer"),
+ ScalarType.topLevel("java.lang.Integer"),
"parseInt",
list(literal("42")),
Types.INT)),
@@ -224,7 +224,7 @@ public class JavaReaderTests {
isTryStatement(
hasTryBody(list(returns(literal(1)))),
hasExceptionHandlers(
- isExceptionHandler(ScalarType.of("java.lang.Exception"), "exception", list(returns(literal(2)))))));
+ isExceptionHandler(ScalarType.topLevel("java.lang.Exception"), "exception", list(returns(literal(2)))))));
}
@Test
@@ -249,7 +249,7 @@ public class JavaReaderTests {
@Test
public void canReadTryWithResourceWithoutOtherClauses() {
- ScalarType type = ScalarType.of("java.io.ByteArrayOutputStream");
+ ScalarType type = ScalarType.topLevel("java.io.ByteArrayOutputStream");
Identifier identifier = MAIN_IDENTIFIER.variable("closeable");
LocalVariableDeclarationNode expectedResource = localVariableDeclaration(identifier, "closeable", type, constructorCall(type, list()));
assertThat(
@@ -292,7 +292,7 @@ public class JavaReaderTests {
assertEquals(
list(assignStatement(
fieldAccess(
- thisReference(ScalarType.of("com.example.Example")),
+ thisReference(ScalarType.topLevel("com.example.Example")),
"name",
Types.STRING),
literal("Flaws"))),
@@ -315,13 +315,13 @@ public class JavaReaderTests {
list(
assignStatement(
fieldAccess(
- thisReference(ScalarType.of("com.example.Example")),
+ thisReference(ScalarType.topLevel("com.example.Example")),
"year",
Types.INT),
literal(2013)),
assignStatement(
fieldAccess(
- thisReference(ScalarType.of("com.example.Example")),
+ thisReference(ScalarType.topLevel("com.example.Example")),
"name",
Types.STRING),
literal("Flaws"))),
@@ -343,13 +343,13 @@ public class JavaReaderTests {
list(
assignStatement(
fieldAccess(
- thisReference(ScalarType.of("com.example.Example")),
+ thisReference(ScalarType.topLevel("com.example.Example")),
"year",
Types.INT),
literal(2013)),
assignStatement(
fieldAccess(
- thisReference(ScalarType.of("com.example.Example")),
+ thisReference(ScalarType.topLevel("com.example.Example")),
"name",
Types.STRING),
literal("Flaws"))),
@@ -369,7 +369,7 @@ public class JavaReaderTests {
assertEquals(
list(assignStatement(
fieldAccess(
- ScalarType.of("com.example.Example"),
+ ScalarType.topLevel("com.example.Example"),
"name",
Types.STRING),
literal("Flaws"))),
@@ -386,7 +386,7 @@ public class JavaReaderTests {
assertEquals(
list(assignStatement(
fieldAccess(
- ScalarType.of("com.example.Example"),
+ ScalarType.topLevel("com.example.Example"),
"name",
Types.STRING),
literal("Flaws"))),
@@ -400,7 +400,7 @@ public class JavaReaderTests {
MethodNode method = classNode.getMethods().get(0);
assertEquals(
- list(annotation(ScalarType.of("java.lang.Deprecated"))),
+ list(annotation(ScalarType.topLevel("java.lang.Deprecated"))),
method.getAnnotations());
}
@@ -422,7 +422,7 @@ public class JavaReaderTests {
List<TypeNode> classes = readSource("com/example/Example.java", source);
assertThat(classes, hasSize(1));
InterfaceNode classNode = (InterfaceNode) classes.get(0);
- assertEquals(ScalarType.of("com.example.Example"), classNode.getName());
+ assertEquals(ScalarType.topLevel("com.example.Example"), classNode.getName());
assertEquals(list(), classNode.getMethods());
assertEquals(set(), classNode.getSuperTypes());
assertEquals(list(), classNode.getTypeParameters());
@@ -435,7 +435,7 @@ public class JavaReaderTests {
List<TypeNode> classes = readSource("com/example/Example.java", source);
assertThat(classes, hasSize(1));
ClassNode classNode = (ClassNode) classes.get(0);
- assertEquals(ScalarType.of("com.example.Example"), classNode.getName());
+ assertEquals(ScalarType.topLevel("com.example.Example"), classNode.getName());
assertEquals(list(formalTypeParameter(Identifier.forType("com.example.Example"), "T")), classNode.getTypeParameters());
}
@@ -446,7 +446,7 @@ public class JavaReaderTests {
List<TypeNode> classes = readSource("com/example/Example.java", source);
assertThat(classes, hasSize(1));
InterfaceNode classNode = (InterfaceNode) classes.get(0);
- assertEquals(ScalarType.of("com.example.Example"), classNode.getName());
+ assertEquals(ScalarType.topLevel("com.example.Example"), classNode.getName());
assertEquals(list(formalTypeParameter(Identifier.forType("com.example.Example"), "T")), classNode.getTypeParameters());
}
@@ -457,9 +457,9 @@ public class JavaReaderTests {
List<TypeNode> classes = readSource("com/example/Example.java", source);
assertThat(classes, hasSize(1));
InterfaceNode classNode = (InterfaceNode) classes.get(0);
- assertEquals(ScalarType.of("com.example.Example"), classNode.getName());
+ assertEquals(ScalarType.topLevel("com.example.Example"), classNode.getName());
assertEquals(list(), classNode.getMethods());
- assertThat(classNode.getSuperTypes(), contains(ScalarType.of("java.util.function.IntSupplier")));
+ assertThat(classNode.getSuperTypes(), contains(ScalarType.topLevel("java.util.function.IntSupplier")));
}
@Test
@@ -493,7 +493,7 @@ public class JavaReaderTests {
assertEquals(
list(
assignStatement(
- FieldAccessNode.fieldAccess(ScalarType.of("com.example.Example"), "VALUE", Types.INT),
+ FieldAccessNode.fieldAccess(ScalarType.topLevel("com.example.Example"), "VALUE", Types.INT),
literal(1)
)
),
@@ -508,7 +508,7 @@ public class JavaReaderTests {
List<TypeNode> classes = readSource("com/example/Example.java", source);
assertThat(classes, hasSize(1));
EnumNode node = (EnumNode) classes.get(0);
- assertEquals(ScalarType.of("com.example.Example"), node.getName());
+ assertEquals(ScalarType.topLevel("com.example.Example"), node.getName());
}
@Test
@@ -518,7 +518,7 @@ public class JavaReaderTests {
List<TypeNode> classes = readSource("com/example/Example.java", source);
assertThat(classes, hasSize(1));
EnumNode node = (EnumNode) classes.get(0);
- assertEquals(ScalarType.of("com.example.Example"), node.getName());
+ assertEquals(ScalarType.topLevel("com.example.Example"), node.getName());
assertEquals(list("ONE", "TWO"), node.getValues());
}
diff --git a/src/test/java/org/zwobble/couscous/tests/frontends/java/JavaTypesTests.java b/src/test/java/org/zwobble/couscous/tests/frontends/java/JavaTypesTests.java
index f903eeb..f256fa9 100644
--- a/src/test/java/org/zwobble/couscous/tests/frontends/java/JavaTypesTests.java
+++ b/src/test/java/org/zwobble/couscous/tests/frontends/java/JavaTypesTests.java
@@ -13,7 +13,7 @@ import static org.zwobble.couscous.types.TypeParameter.typeParameter;
import static org.zwobble.couscous.util.ExtraLists.list;
public class JavaTypesTests {
- private static final ScalarType INT_TYPE = ScalarType.of("int");
+ private static final ScalarType INT_TYPE = ScalarType.topLevel("int");
@Test
public void bindingTypeToItselfReturnsType() {
@@ -32,7 +32,7 @@ public class JavaTypesTests {
@Test
public void bindingTypeToParameterizedTypeBindsParameters() {
- ScalarType rawList = ScalarType.of("List");
+ ScalarType rawList = ScalarType.topLevel("List");
TypeParameter typeParameter = typeParameter(Identifier.forType("List"), "T");
assertEquals(
parameterizedType(rawList, list(boundTypeParameter(typeParameter, INT_TYPE))),
diff --git a/src/test/java/org/zwobble/couscous/tests/interpreter/EvaluatorTests.java b/src/test/java/org/zwobble/couscous/tests/interpreter/EvaluatorTests.java
index 79c082d..f0cfba7 100644
--- a/src/test/java/org/zwobble/couscous/tests/interpreter/EvaluatorTests.java
+++ b/src/test/java/org/zwobble/couscous/tests/interpreter/EvaluatorTests.java
@@ -178,7 +178,7 @@ public class EvaluatorTests extends BackendEvalTests {
@Test
public void cannotSetValueOfInstanceFieldAsThoughItIsAStaticField() {
- ScalarType type = ScalarType.of("com.example.Example");
+ ScalarType type = ScalarType.topLevel("com.example.Example");
ClassNode classNode = ClassNode.builder(type)
.field("value", Types.INT)
.constructor(constructor -> constructor
@@ -253,7 +253,7 @@ public class EvaluatorTests extends BackendEvalTests {
@Test
public void typeOfValueCanBeParameterisedType() {
- ScalarType rawType = ScalarType.of("Box");
+ ScalarType rawType = ScalarType.topLevel("Box");
ClassNode classNode = ClassNode.builder(rawType)
.addTypeParameter("T")
.build();