aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2023-12-29 11:35:42 +0000
committerMichael Williamson <mike@zwobble.org>2023-12-29 11:35:42 +0000
commit30d0819e32a4ba7bdd9f694a8b965d3122dbdd1b (patch)
treee69db7b306692806411eddb9494711e5638b36e3 /src/main/java
parent175395d22a4195c4021d2f0ff32c2d79d878dfab (diff)
Remove unnecessary methods
Diffstat (limited to 'src/main/java')
-rw-r--r--src/main/java/org/shedlang/compiler/typechecker/TypeChecker.java2
-rw-r--r--src/main/java/org/shedlang/compiler/typechecker/TypeCheckerSubTyping.java4
-rw-r--r--src/main/java/org/shedlang/compiler/types/SumVariant.java12
3 files changed, 4 insertions, 14 deletions
diff --git a/src/main/java/org/shedlang/compiler/typechecker/TypeChecker.java b/src/main/java/org/shedlang/compiler/typechecker/TypeChecker.java
index 73076a74..fd7fa39e 100644
--- a/src/main/java/org/shedlang/compiler/typechecker/TypeChecker.java
+++ b/src/main/java/org/shedlang/compiler/typechecker/TypeChecker.java
@@ -2093,7 +2093,7 @@ public class TypeChecker {
}
for (var variantType : variantTypes) {
- if (!handledVariantTypes.contains(variantType.toType())) {
+ if (!handledVariantTypes.contains(variantType.type())) {
throw new UnhandledVariantError(variantType, untyped.source());
}
}
diff --git a/src/main/java/org/shedlang/compiler/typechecker/TypeCheckerSubTyping.java b/src/main/java/org/shedlang/compiler/typechecker/TypeCheckerSubTyping.java
index 4aab5370..49560f38 100644
--- a/src/main/java/org/shedlang/compiler/typechecker/TypeCheckerSubTyping.java
+++ b/src/main/java/org/shedlang/compiler/typechecker/TypeCheckerSubTyping.java
@@ -25,7 +25,7 @@ public class TypeCheckerSubTyping {
if (supertype instanceof SumType supertypeSum) {
var superTypeInfo = context.sumTypeInfo(supertypeSum, Sources.NULL);
return superTypeInfo.variants().stream()
- .anyMatch(supertypeVariant -> isSubType(subtype, supertypeVariant.toType(), context));
+ .anyMatch(supertypeVariant -> isSubType(subtype, supertypeVariant.type(), context));
}
if (
@@ -35,7 +35,7 @@ public class TypeCheckerSubTyping {
// TODO: merge with logic for plain sum types
var superTypeInfo = context.sumTypeInfo((ConstructedType<SumType>) supertypeConstructedType, Sources.NULL);
return superTypeInfo.variants().stream()
- .anyMatch(supertypeVariant -> isSubType(subtype, supertypeVariant.toType(), context));
+ .anyMatch(supertypeVariant -> isSubType(subtype, supertypeVariant.type(), context));
}
if (
diff --git a/src/main/java/org/shedlang/compiler/types/SumVariant.java b/src/main/java/org/shedlang/compiler/types/SumVariant.java
index 0270a93c..9ea1c848 100644
--- a/src/main/java/org/shedlang/compiler/types/SumVariant.java
+++ b/src/main/java/org/shedlang/compiler/types/SumVariant.java
@@ -11,18 +11,13 @@ public sealed interface SumVariant {
String describe();
- Type toType();
+ Type type();
record ConstructedStruct(ConstructedType<StructType> type) implements SumVariant {
@Override
public String describe() {
return type.describe();
}
-
- @Override
- public Type toType() {
- return type;
- }
}
record Struct(StructType type) implements SumVariant {
@@ -30,10 +25,5 @@ public sealed interface SumVariant {
public String describe() {
return type.describe();
}
-
- @Override
- public Type toType() {
- return type;
- }
}
}