diff options
| author | Michael Williamson <mike@zwobble.org> | 2023-09-28 10:00:32 +0100 |
|---|---|---|
| committer | Michael Williamson <mike@zwobble.org> | 2023-09-28 10:00:32 +0100 |
| commit | aeb1cacb2114d9881764c3d3860db7df98d96c4c (patch) | |
| tree | 4ada928be97ad152a250300f1ed4a991edc00bf7 /src/main/java | |
| parent | 130b77ede3cce7d9b623174977429f2240e9fc11 (diff) | |
Add struct type
Diffstat (limited to 'src/main/java')
| -rw-r--r-- | src/main/java/org/shedlang/compiler/types/StructType.java | 11 | ||||
| -rw-r--r-- | src/main/java/org/shedlang/compiler/types/Type.java | 2 |
2 files changed, 12 insertions, 1 deletions
diff --git a/src/main/java/org/shedlang/compiler/types/StructType.java b/src/main/java/org/shedlang/compiler/types/StructType.java new file mode 100644 index 00000000..ab9b18a6 --- /dev/null +++ b/src/main/java/org/shedlang/compiler/types/StructType.java @@ -0,0 +1,11 @@ +package org.shedlang.compiler.types; + +/** + * A set of named fields. + */ +public record StructType(NamespaceName namespaceName, String name) implements Type { + @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 d4aea52f..b88cf42b 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, FunctionType, IntType, NamespaceType, StringType, TopType, TupleType, TypeLevelValueType, UnitType { + permits BoolType, BottomType, FunctionType, IntType, NamespaceType, StringType, StructType, TopType, TupleType, TypeLevelValueType, UnitType { } |
