cli: validate Copy content of source owning arrays

This commit is contained in:
dev committed 2026-10-08 09:01:58 +03:00
1 parent caf3b86e80
commit cfbe01a16f
42 files changed
+608 -3

No files matched your search

+13 -1
View File
@@ -3,6 +3,7 @@ const std = @import("std");
const ast = @import("ast.zig");
const lower = @import("lower.zig");
const type_positions = @import("type_positions.zig");
const type_properties = @import("type_properties.zig");
const authority = @import("../air/authority.zig");
const A = std.mem.Allocator;
const Error = error{ OutOfMemory, InvalidGeneric };
@@ -189,7 +190,18 @@ const Generator = struct {
}) };
return error.InvalidGeneric;
}
return g.headerType(t, params, depth);
try g.headerType(t, params, depth);
if (try type_properties.firstInvalid(t, g, propertyDecl, params)) |bad| {
g.problem = .{ .code = "E7005", .span = bad.span, .message = "dynamic heap arrays require Copy content", .fields = try g.arena.dupe(lower.Problem.Field, &.{
.{ .name = "constraint", .value = "Copy" },
.{ .name = "type_constructor", .value = "own_array" },
}) };
return error.InvalidGeneric;
}
}
fn propertyDecl(g: *Generator, name: []const u8, span: ast.Span) ?ast.TypeDecl {
return g.typeDecl(name, span);
}
fn headerType(g: *Generator, t: ast.Type, params: []const ast.TypeParam, depth: usize) Error!void {