From a263ddee5ea10d822bb26db12e96661685020927 Mon Sep 17 00:00:00 2001 From: Richard Feldman Date: Sun, 16 Nov 2025 23:53:25 -0500 Subject: [PATCH] Make List be a phantom type --- src/build/roc/Builtin.roc | 2 +- src/types/store.zig | 2 +- src/types/types.zig | 1 - 3 files changed, 2 insertions(+), 3 deletions(-) diff --git a/src/build/roc/Builtin.roc b/src/build/roc/Builtin.roc index c36b5a4601..3c664a051e 100644 --- a/src/build/roc/Builtin.roc +++ b/src/build/roc/Builtin.roc @@ -6,7 +6,7 @@ Builtin :: [].{ contains = |_str, _other| True } - List :: [ProvidedByCompiler].{ + List(_item) :: [ProvidedByCompiler].{ len : List(_item) -> U64 is_empty : List(_item) -> Bool concat : List(item), List(item) -> List(item) diff --git a/src/types/store.zig b/src/types/store.zig index cae9c497d9..67cc8ab125 100644 --- a/src/types/store.zig +++ b/src/types/store.zig @@ -1366,7 +1366,7 @@ test "Store comprehensive CompactWriter roundtrip" { try std.testing.expectEqual(Content{ .structure = .{ .str = {} } }, deser_str.desc.content); const deser_list = deserialized.resolveVar(list_var); - // List is now a nominal type + // List is a nominal type try std.testing.expect(deser_list.desc.content.structure == .nominal_type); const deser_nominal = deser_list.desc.content.structure.nominal_type; const deser_list_args = deserialized.sliceNominalArgs(deser_nominal); diff --git a/src/types/types.zig b/src/types/types.zig index 25f37695cf..04aa9408ed 100644 --- a/src/types/types.zig +++ b/src/types/types.zig @@ -395,7 +395,6 @@ pub const TypeIdent = struct { pub const FlatType = union(enum) { str, box: Var, - // NOTE: .list and .list_unbound have been removed - List is now a nominal type record: Record, record_unbound: RecordField.SafeMultiList.Range, tuple: Tuple,