From dc0b16c61be0a41eda8a0f94d41118808e46d567 Mon Sep 17 00:00:00 2001 From: Michael Williamson Date: Thu, 19 Dec 2024 17:40:38 +0000 Subject: Type check methods fully --- .../TypeCheckerStructDefinitionTests.java | 32 +++++++++++----------- 1 file changed, 16 insertions(+), 16 deletions(-) (limited to 'src/test/java') diff --git a/src/test/java/org/shedlang/compiler/typechecker/TypeCheckerStructDefinitionTests.java b/src/test/java/org/shedlang/compiler/typechecker/TypeCheckerStructDefinitionTests.java index dee72117..116a7b6a 100644 --- a/src/test/java/org/shedlang/compiler/typechecker/TypeCheckerStructDefinitionTests.java +++ b/src/test/java/org/shedlang/compiler/typechecker/TypeCheckerStructDefinitionTests.java @@ -289,30 +289,30 @@ public class TypeCheckerStructDefinitionTests { UntypedFunctionDefinitionNode.builder() .addPositionalParam("this", Optional.empty()) .withName("a") - .withReturnType(Untyped.typeLevelReference("Bool")) + .withReturnType(Untyped.typeLevelReference("Unit")) .build() ) .build(); var context = TypeCheckerContext.EMPTY .enterGlobal(P.map( - Map.entry("Bool", Types.metaType(Types.BOOL)) + Map.entry("Unit", Types.metaType(Types.UNIT)) )); var typed = typeCheckNamespaceStatement(untyped, context); -// assertThat( -// typed.value(), -// isTypedStructDefinitionNode() -// .withMethods(isSequence( -// isTypedFunctionDefinitionNode() -// .withParams(isTypedParamsNode( -// isSequence( -// isTypedParamNode("this", isOptionalEmpty()) -// ), -// isSequence() -// )) -// )) -// ); + assertThat( + typed.value(), + isTypedStructDefinitionNode() + .withMethods(isSequence( + isTypedFunctionDefinitionNode() + .withParams(isTypedParamsNode( + isSequence( + isTypedParamNode("this", isOptionalEmpty()) + ), + isSequence() + )) + )) + ); var structTypeInfo = typed.context().toTypeInfos() .structTypeInfo(Types.struct(NAMESPACE_NAME, "ExampleStruct")) .orElseThrow(); @@ -323,7 +323,7 @@ public class TypeCheckerStructDefinitionTests { "a", FunctionType.builder() .addPositionalParam(Types.struct(NAMESPACE_NAME, "ExampleStruct")) - .withReturnType(Types.BOOL) + .withReturnType(Types.UNIT) .build() )) )) -- cgit v1.2.3