aboutsummaryrefslogtreecommitdiff
path: root/src/main/java
diff options
context:
space:
mode:
authorMichael Williamson <mike@zwobble.org>2024-01-03 21:24:25 +0000
committerMichael Williamson <mike@zwobble.org>2024-01-03 21:24:45 +0000
commit49560f36988842341a97fce7f81a5041fb1dd0d4 (patch)
treed0c2833e99f96b7a329009a7e31e6e8c885c615d /src/main/java
parent09f15965cf8fb86077e06bcf6c4f34af4ad7b0e7 (diff)
Rename StructuredType to ConstructibleType
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/types/ConstructedType.java2
-rw-r--r--src/main/java/org/shedlang/compiler/types/ConstructibleType.java5
-rw-r--r--src/main/java/org/shedlang/compiler/types/StructType.java2
-rw-r--r--src/main/java/org/shedlang/compiler/types/StructuredType.java5
-rw-r--r--src/main/java/org/shedlang/compiler/types/SumType.java2
-rw-r--r--src/main/java/org/shedlang/compiler/types/Type.java2
-rw-r--r--src/main/java/org/shedlang/compiler/types/TypeConstructor.java2
-rw-r--r--src/main/java/org/shedlang/compiler/types/TypeOrConstructor.java10
-rw-r--r--src/main/java/org/shedlang/compiler/types/TypeSubstitution.java2
-rw-r--r--src/main/java/org/shedlang/compiler/types/Types.java2
11 files changed, 18 insertions, 18 deletions
diff --git a/src/main/java/org/shedlang/compiler/typechecker/TypeChecker.java b/src/main/java/org/shedlang/compiler/typechecker/TypeChecker.java
index 8ac346a3..37fd18b3 100644
--- a/src/main/java/org/shedlang/compiler/typechecker/TypeChecker.java
+++ b/src/main/java/org/shedlang/compiler/typechecker/TypeChecker.java
@@ -2244,7 +2244,7 @@ public class TypeChecker {
));
}
- private static <T extends StructuredType> TypeOrConstructor<T> createTypeOrConstructor(
+ private static <T extends ConstructibleType> TypeOrConstructor<T> createTypeOrConstructor(
Optional<List<UntypedTypeLevelParamNode>> untypedTypeLevelParamNodes,
T type,
Scope scope
diff --git a/src/main/java/org/shedlang/compiler/types/ConstructedType.java b/src/main/java/org/shedlang/compiler/types/ConstructedType.java
index daf7bcb4..b56e6a85 100644
--- a/src/main/java/org/shedlang/compiler/types/ConstructedType.java
+++ b/src/main/java/org/shedlang/compiler/types/ConstructedType.java
@@ -4,7 +4,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.stream.Collectors;
-public sealed interface ConstructedType<T extends StructuredType> extends Type permits ConstructedStructType, ConstructedSumType {
+public sealed interface ConstructedType<T extends ConstructibleType> extends Type permits ConstructedStructType, ConstructedSumType {
TypeConstructor<T> constructor();
List<? extends Type> args();
diff --git a/src/main/java/org/shedlang/compiler/types/ConstructibleType.java b/src/main/java/org/shedlang/compiler/types/ConstructibleType.java
new file mode 100644
index 00000000..28cc62a0
--- /dev/null
+++ b/src/main/java/org/shedlang/compiler/types/ConstructibleType.java
@@ -0,0 +1,5 @@
+package org.shedlang.compiler.types;
+
+public sealed interface ConstructibleType extends Type permits StructType, SumType {
+ String name();
+}
diff --git a/src/main/java/org/shedlang/compiler/types/StructType.java b/src/main/java/org/shedlang/compiler/types/StructType.java
index 04e42057..fbde821f 100644
--- a/src/main/java/org/shedlang/compiler/types/StructType.java
+++ b/src/main/java/org/shedlang/compiler/types/StructType.java
@@ -3,7 +3,7 @@ package org.shedlang.compiler.types;
/**
* A set of named fields.
*/
-public record StructType(NamespaceName namespaceName, String name) implements StructuredType {
+public record StructType(NamespaceName namespaceName, String name) implements ConstructibleType {
@Override
public String describe() {
return namespaceName.toString() + "." + name;
diff --git a/src/main/java/org/shedlang/compiler/types/StructuredType.java b/src/main/java/org/shedlang/compiler/types/StructuredType.java
deleted file mode 100644
index bc836379..00000000
--- a/src/main/java/org/shedlang/compiler/types/StructuredType.java
+++ /dev/null
@@ -1,5 +0,0 @@
-package org.shedlang.compiler.types;
-
-public sealed interface StructuredType extends Type permits StructType, SumType {
- String name();
-}
diff --git a/src/main/java/org/shedlang/compiler/types/SumType.java b/src/main/java/org/shedlang/compiler/types/SumType.java
index 08fef92f..675135c8 100644
--- a/src/main/java/org/shedlang/compiler/types/SumType.java
+++ b/src/main/java/org/shedlang/compiler/types/SumType.java
@@ -3,7 +3,7 @@ package org.shedlang.compiler.types;
/**
* A discriminated union of several different types.
*/
-public record SumType(NamespaceName namespaceName, String name) implements StructuredType {
+public record SumType(NamespaceName namespaceName, String name) implements ConstructibleType {
@Override
public String describe() {
return namespaceName.toString() + "." + name;
diff --git a/src/main/java/org/shedlang/compiler/types/Type.java b/src/main/java/org/shedlang/compiler/types/Type.java
index f6f51b1e..cdb7ed0a 100644
--- a/src/main/java/org/shedlang/compiler/types/Type.java
+++ b/src/main/java/org/shedlang/compiler/types/Type.java
@@ -6,5 +6,5 @@ package org.shedlang.compiler.types;
* found through auxiliary data.
*/
public sealed interface Type extends TypeLevelValue
- permits BoolType, BottomType, ConstructedType, FunctionType, IntType, NamespaceType, StringType, StructuredType, TopType, TupleType, TypeLevelValueType, TypeParam, UnitType {
+ permits BoolType, BottomType, ConstructedType, ConstructibleType, FunctionType, IntType, NamespaceType, StringType, TopType, TupleType, TypeLevelValueType, TypeParam, UnitType {
}
diff --git a/src/main/java/org/shedlang/compiler/types/TypeConstructor.java b/src/main/java/org/shedlang/compiler/types/TypeConstructor.java
index a43001bc..ba4b44b9 100644
--- a/src/main/java/org/shedlang/compiler/types/TypeConstructor.java
+++ b/src/main/java/org/shedlang/compiler/types/TypeConstructor.java
@@ -2,7 +2,7 @@ package org.shedlang.compiler.types;
import java.util.List;
-public record TypeConstructor<T extends StructuredType>(
+public record TypeConstructor<T extends ConstructibleType>(
List<TypeParam> params,
T genericType
) implements TypeLevelValue {
diff --git a/src/main/java/org/shedlang/compiler/types/TypeOrConstructor.java b/src/main/java/org/shedlang/compiler/types/TypeOrConstructor.java
index 8c040c2d..24d4ae48 100644
--- a/src/main/java/org/shedlang/compiler/types/TypeOrConstructor.java
+++ b/src/main/java/org/shedlang/compiler/types/TypeOrConstructor.java
@@ -1,18 +1,18 @@
package org.shedlang.compiler.types;
-public sealed interface TypeOrConstructor<T extends StructuredType> {
- static <T extends StructuredType> TypeOrConstructor<T> type(T value) {
+public sealed interface TypeOrConstructor<T extends ConstructibleType> {
+ static <T extends ConstructibleType> TypeOrConstructor<T> type(T value) {
return new Type<>(value);
}
- static <T extends StructuredType> TypeOrConstructor<T> constructor(TypeConstructor<T> value) {
+ static <T extends ConstructibleType> TypeOrConstructor<T> constructor(TypeConstructor<T> value) {
return new Constructor<>(value);
}
T toType();
org.shedlang.compiler.types.Type toMetaType();
- record Type<T extends StructuredType>(T value) implements TypeOrConstructor<T> {
+ record Type<T extends ConstructibleType>(T value) implements TypeOrConstructor<T> {
@Override
public T toType() {
return value;
@@ -24,7 +24,7 @@ public sealed interface TypeOrConstructor<T extends StructuredType> {
}
}
- record Constructor<T extends StructuredType>(TypeConstructor<T> value) implements TypeOrConstructor<T> {
+ record Constructor<T extends ConstructibleType>(TypeConstructor<T> value) implements TypeOrConstructor<T> {
@Override
public T toType() {
return value.genericType();
diff --git a/src/main/java/org/shedlang/compiler/types/TypeSubstitution.java b/src/main/java/org/shedlang/compiler/types/TypeSubstitution.java
index db6d554f..6a4bc45b 100644
--- a/src/main/java/org/shedlang/compiler/types/TypeSubstitution.java
+++ b/src/main/java/org/shedlang/compiler/types/TypeSubstitution.java
@@ -94,7 +94,7 @@ public class TypeSubstitution {
}
private static <
- T extends StructuredType,
+ T extends ConstructibleType,
TConstructedType extends ConstructedType<T>
> TConstructedType substituteConstructedType(
BiFunction<TypeConstructor<T>, List<Type>, TConstructedType> createConstructedType,
diff --git a/src/main/java/org/shedlang/compiler/types/Types.java b/src/main/java/org/shedlang/compiler/types/Types.java
index dbf5b441..191f9481 100644
--- a/src/main/java/org/shedlang/compiler/types/Types.java
+++ b/src/main/java/org/shedlang/compiler/types/Types.java
@@ -42,7 +42,7 @@ public class Types {
return new TypeLevelValueType(typeConstructor);
}
- public static <T extends StructuredType> TypeConstructor<T> typeConstructor(
+ public static <T extends ConstructibleType> TypeConstructor<T> typeConstructor(
List<TypeParam> params,
T genericType
) {