Deprecation of @assignable_to

This commit is contained in:
Christoffer Lerno
2025-08-26 13:21:42 +02:00
parent 1634217fc4
commit cb17cfff7d
18 changed files with 46 additions and 37 deletions

View File

@@ -21,7 +21,7 @@ fn Ref wrap(Type* ptr, Allocator allocator = mem)
}
<*
@require $vacount < 2 : "Too many arguments."
@require $vacount == 0 ||| @assignable_to($vaexpr[0], Type) : "The first argument must be an initializer for the type"
@require $vacount == 0 ||| $defined(Type a = $vaexpr[0]) : "The first argument must be an initializer for the type"
*>
macro Ref new(..., Allocator allocator = mem)
{
@@ -99,7 +99,7 @@ struct RefCounted
}
<*
@require @assignable_to(refcounted, RefCounted*) : "Expected a ref counted value"
@require $defined(RefCounted* c = refcounted) : "Expected a ref counted value"
*>
macro retain(refcounted)
{
@@ -112,7 +112,7 @@ macro retain(refcounted)
}
<*
@require @assignable_to(refcounted, RefCounted*) : "Expected a ref counted value"
@require $defined(RefCounted* c = refcounted) : "Expected a ref counted value"
@require !$defined(refcounted.dealloc()) ||| @typeis(refcounted.dealloc(), void)
: "Expected refcounted type to have a valid dealloc"
*>