air: query cache-free nominal properties without recursion
This commit is contained in:
1 parent
897f538840
commit
35635603f9
9 files changed
+539
-229
No files matched your search
@@ -616,7 +616,7 @@ const Lowerer = struct {
|
||||
continue;
|
||||
}
|
||||
const cached = l.property_module.?;
|
||||
const ok = if (std.mem.eql(u8, r.property, "Copy")) verifier_types.isCopy(cached, t) else if (std.mem.eql(u8, r.property, "Send")) verifier_types.isSend(cached, t) else if (std.mem.eql(u8, r.property, "Share")) verifier_types.isShare(cached, t) else if (std.mem.eql(u8, r.property, "Freeze")) verifier_types.isIslandSafe(cached, t) else verifier_types.isLocalType(cached, t);
|
||||
const ok = if (std.mem.eql(u8, r.property, "Copy")) try verifier_types.isCopy(l.arena, cached, t) else if (std.mem.eql(u8, r.property, "Send")) try verifier_types.isSend(l.arena, cached, t) else if (std.mem.eql(u8, r.property, "Share")) try verifier_types.isShare(l.arena, cached, t) else if (std.mem.eql(u8, r.property, "Freeze")) try verifier_types.isIslandSafe(l.arena, cached, t) else try verifier_types.isLocalType(l.arena, cached, t);
|
||||
if (!ok) return l.fail("E7005", r.span, "generic argument does not satisfy structural constraint", &.{
|
||||
.{ .name = "parameter", .value = r.parameter },
|
||||
.{ .name = "constraint", .value = r.property },
|
||||
@@ -811,7 +811,7 @@ const Lowerer = struct {
|
||||
.{ .name = "position", .value = "member" },
|
||||
.{ .name = "type_constructor", .value = @tagName(t) },
|
||||
});
|
||||
if (repeated and !verifier_types.isCopy(l.property_module.?, t)) return l.fail("E7005", span, "an array repetition requires Copy content", &.{
|
||||
if (repeated and !try verifier_types.isCopy(l.arena, l.property_module.?, t)) return l.fail("E7005", span, "an array repetition requires Copy content", &.{
|
||||
.{ .name = "constraint", .value = "Copy" },
|
||||
.{ .name = "type_constructor", .value = "array" },
|
||||
});
|
||||
@@ -833,7 +833,7 @@ const Lowerer = struct {
|
||||
}
|
||||
|
||||
fn copyContent(l: *Lowerer, span: Span, ty: Ty, operation: []const u8) Error!void {
|
||||
if (!verifier_types.isCopy(l.property_module.?, try l.airType(ty))) return l.fail("E7005", span, "this allocation requires Copy content", &.{
|
||||
if (!try verifier_types.isCopy(l.arena, l.property_module.?, try l.airType(ty))) return l.fail("E7005", span, "this allocation requires Copy content", &.{
|
||||
.{ .name = "constraint", .value = "Copy" },
|
||||
.{ .name = "operation", .value = operation },
|
||||
});
|
||||
@@ -3414,7 +3414,7 @@ const Lowerer = struct {
|
||||
const n = try l.expr(args[0], usize_ty);
|
||||
try l.checkOperandTy(args[0].span, n.ty, usize_ty);
|
||||
const v = try l.consuming(args[1], null);
|
||||
if (!verifier_types.isCopy(l.property_module.?, try l.airType(v.ty))) return l.copyArrayError(args[1].span);
|
||||
if (!try verifier_types.isCopy(l.arena, l.property_module.?, try l.airType(v.ty))) return l.copyArrayError(args[1].span);
|
||||
const c = try l.expectCap(args[2], "mem.alloc");
|
||||
return .{ .text = try l.fmt("own.array %{s}, %{s}, %{s}", .{ n.name, v.name, c.name }), .outcomes = try l.outs(&.{ .{ .role = "ok", .params = &.{try l.wrap(.own_array, v.ty)} }, .{ .role = "err", .params = &.{alloc_err} } }) };
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user