length: int- Module
- std.
bytes - Receiver
- Byte
Buffer - Minimum arity
- 0
- Maximum arity
- 0
Declaration and parameters
LinkAvailability
Included by default: Pending
Import std.bytes in language mode 5.21.
The current compiler selects std/bytes.tpz for this language mode. Availability in other released editions and inclusion in each installed distribution are Pending.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 983 - compiler/crates/topaz_resolve/src/stdlib.rs at
b48527d0a174· 52 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 983 - compiler/crates/topaz_self_frontend/topaz/checker/builtin_signatures.tpz at
b48527d0a174· 426 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
b48527d0a174· 1296 - compiler/crates/topaz_value/src/value/members.rs at
b48527d0a174· 255
Receiver
ByteBuffer
Parameter constraints
Bytes.length and ByteBuffer.length are read-only int properties that report the number of bytes.
JSONValue.length is an Option<int> property. Arrays and objects return Some(count) for their element or member count. Other JSON kinds return None().
JSONValue.keys and JSONValue.values are properties returning Option<Array<string>> and Option<Array<JSON. Objects return Some(keys) or Some(values). Other JSON kinds return None().
Read these properties without parentheses, as with Array.length, Map.length, Map.keys, Map.values, and Set.length. Calling a property value is rejected as a non-callable value.
Related rule: Read collection sizes, keys, and values as propertiesByteBuffer.allocate accepts a nonnegative int length and an int initial value from 0 through 255. The initial value defaults to zero.
The new buffer has exactly that many copies of the initial byte. Zero length is valid and still requires a valid initial byte.
A negative length produces TPZ4001 at runtime. An invalid initial byte or an allocation that cannot be satisfied produces TPZ5001 at runtime.
ByteBuffer.fromBytes converts an immutable Bytes value into a mutable ByteBuffer value containing the same bytes.
ByteBuffer.toBytes converts the current buffer contents into an immutable Bytes value.
ByteBuffer.length is a read-only byte count property. Buffer operations never change its length.
Assignment, argument passing, return, capture, and aggregate storage follow collection value semantics.
Supplied expressions evaluate once from left to right before allocation or conversion. These operations have no I/O effects.
Related rule: Allocate buffers and convert byte valuesResult
The declared result type is int.
Effects
Failures
Result and effects
LinkSelect this field from a value of its named type without call parentheses.
Read the fixed number of buffer bytes as a read-only int property. Buffer writes preserve this count.
Why
LinkCollection observations use the same property syntax as Array, Map, and Set. Parentheses identify calls rather than stored or derived values.
Related entries
LinkRead collection sizes, keys, and values as properties
LinkRead collection sizes, keys, and values as properties
Bytes.length and ByteBuffer.length are read-only int properties that report the number of bytes.
JSONValue.length is an Option<int> property. Arrays and objects return Some(count) for their element or member count. Other JSON kinds return None().
JSONValue.keys and JSONValue.values are properties returning Option<Array<string>> and Option<Array<JSON. Objects return Some(keys) or Some(values). Other JSON kinds return None().
Read these properties without parentheses, as with Array.length, Map.length, Map.keys, Map.values, and Set.length. Calling a property value is rejected as a non-callable value.
Why
The same collection observation should use the same syntax across core collections and library values. Keeping JSONValue results optional preserves its distinction between collections and scalar values.
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 781 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 858 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 875 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 954 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 983 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 487 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 734 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 753 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 793 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
271329b482bc· 1328 -
topaz.stdlib.contract.collection-propertiesatworking-tree - topaz.decision.collection-properties.1 at
topaz.decisi
Read the same properties on core collections
Linkimport std.iolet array = [2, 3]let entries = map { "name": "Topaz" }let values = set { 2, 3 }io.writeLine("{array.length}:{entries.length}:{values.length}")io.writeLine(entries.keys[0])io.writeLine(entries.values[0])
2:1:2 name Topaz
Expected result
Expected result
Execution completes. Exit code 0.
2:1:2nameTopaz
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 781 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 858 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 875 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 954 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 983 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 487 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 734 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 753 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 793 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
271329b482bc· 1328 -
topaz.stdlib.contract.collection-propertiesatworking-tree - topaz.decision.collection-properties.1 at
topaz.decisi
Read a byte sequence size
Linkimport std.bytes { Bytes }import std.iolet bytes = Bytes.empty()let size: int = bytes.lengthio.writeLine("{size}")
0
Expected result
Expected result
Execution completes. Exit code 0.
0
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 781 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 858 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 875 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 954 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 983 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 487 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 734 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 753 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 793 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
271329b482bc· 1328 -
topaz.stdlib.contract.collection-propertiesatworking-tree - topaz.decision.collection-properties.1 at
topaz.decisi
Read a byte buffer size
Linkimport std.bytes { ByteBuffer }import std.iolet buffer = ByteBuffer.allocate(3)let size: int = buffer.lengthio.writeLine("{size}")
3
Expected result
Expected result
Execution completes. Exit code 0.
3
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 781 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 858 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 875 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 954 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 983 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 487 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 734 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 753 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 793 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
271329b482bc· 1328 -
topaz.stdlib.contract.collection-propertiesatworking-tree - topaz.decision.collection-properties.1 at
topaz.decisi
Read JSON sizes and preserve optional results
Linkimport std.jsonimport std.testimport std.iolet array = test.assertOk(json.parse("[1,2]"))let object = test.assertOk(json.parse("\{\"name\":\"Topaz\"\}"))let scalar = test.assertOk(json.parse("42"))let arraySize: Option<int> = array.lengthlet objectSize: Option<int> = object.lengthlet scalarSize: Option<int> = scalar.lengthtest.assertEq(test.assertSome(arraySize), 2)test.assertEq(test.assertSome(objectSize), 1)test.assertNone(scalarSize)io.writeLine("JSON sizes read")
JSON sizes read
Expected result
Expected result
Execution completes. Exit code 0.
JSON sizes read
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 781 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 858 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 875 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 954 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 983 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 487 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 734 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 753 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 793 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
271329b482bc· 1328 -
topaz.stdlib.contract.collection-propertiesatworking-tree - topaz.decision.collection-properties.1 at
topaz.decisi
Read JSON object keys
Linkimport std.jsonimport std.testimport std.iolet object = test.assertOk(json.parse("\{\"name\":\"Topaz\"\}"))let array = test.assertOk(json.parse("[]"))let scalar = test.assertOk(json.parse("42"))let names: Option<Array<string>> = object.keystest.assertEq(test.assertSome(names)[0], "name")test.assertNone(array.keys)test.assertNone(scalar.keys)io.writeLine("JSON keys read")
JSON keys read
Expected result
Expected result
Execution completes. Exit code 0.
JSON keys read
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 781 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 858 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 875 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 954 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 983 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 487 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 734 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 753 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 793 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
271329b482bc· 1328 -
topaz.stdlib.contract.collection-propertiesatworking-tree - topaz.decision.collection-properties.1 at
topaz.decisi
Read JSON object values
Linkimport std.jsonimport std.testimport std.iolet object = test.assertOk(json.parse("\{\"name\":\"Topaz\"\}"))let array = test.assertOk(json.parse("[]"))let scalar = test.assertOk(json.parse("42"))let values = test.assertSome(object.values)test.assertEq(test.assertSome(values[0].asString()), "Topaz")test.assertNone(array.values)test.assertNone(scalar.values)io.writeLine("JSON values read")
JSON values read
Expected result
Expected result
Execution completes. Exit code 0.
JSON values read
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 781 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 858 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 875 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 954 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 983 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 487 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 734 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 753 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 793 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
271329b482bc· 1328 -
topaz.stdlib.contract.collection-propertiesatworking-tree - topaz.decision.collection-properties.1 at
topaz.decisi
Reject calling Bytes.length
Linkimport std.bytes { Bytes }function inspect(value: Bytes) -> () {let result = value.length()return ()}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5005stdlib-property-not-callable atmain.tpz:3:22
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 781 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 858 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 875 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 954 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 983 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 487 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 734 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 753 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 793 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
271329b482bc· 1328 -
topaz.stdlib.contract.collection-propertiesatworking-tree - topaz.decision.collection-properties.1 at
topaz.decisi
Reject calling ByteBuffer.length
Linkimport std.bytes { ByteBuffer }function inspect(value: ByteBuffer) -> () {let result = value.length()return ()}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5005stdlib-property-not-callable atmain.tpz:3:22
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 781 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 858 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 875 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 954 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 983 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 487 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 734 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 753 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 793 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
271329b482bc· 1328 -
topaz.stdlib.contract.collection-propertiesatworking-tree - topaz.decision.collection-properties.1 at
topaz.decisi
Reject calling JSONValue.length
Linkimport std.json { JSONValue }function inspect(value: JSONValue) -> () {let result = value.length()return ()}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5005stdlib-property-not-callable atmain.tpz:3:22
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 781 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 858 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 875 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 954 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 983 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 487 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 734 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 753 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 793 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
271329b482bc· 1328 -
topaz.stdlib.contract.collection-propertiesatworking-tree - topaz.decision.collection-properties.1 at
topaz.decisi
Reject calling JSONValue.keys
Linkimport std.json { JSONValue }function inspect(value: JSONValue) -> () {let result = value.keys()return ()}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5005stdlib-property-not-callable atmain.tpz:3:22
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 781 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 858 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 875 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 954 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 983 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 487 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 734 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 753 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 793 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
271329b482bc· 1328 -
topaz.stdlib.contract.collection-propertiesatworking-tree - topaz.decision.collection-properties.1 at
topaz.decisi
Reject calling JSONValue.values
Linkimport std.json { JSONValue }function inspect(value: JSONValue) -> () {let result = value.values()return ()}
No stdout.
Expected result
Expected result
Rejection during check. Nonzero exit.
TPZ5005stdlib-property-not-callable atmain.tpz:3:22
Source evidence
- compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 781 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 858 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 875 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 954 - compiler/crates/topaz_self_frontend/topaz/checker/members_capabilities.tpz at
271329b482bc· 983 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 487 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 734 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 753 - compiler/crates/topaz_value/src/value/members.rs at
271329b482bc· 793 - compiler/crates/topaz_self_frontend/topaz/checker/call_complete.tpz at
271329b482bc· 1328 -
topaz.stdlib.contract.collection-propertiesatworking-tree - topaz.decision.collection-properties.1 at
topaz.decisi
Diagnostics
LinkAllocate buffers and convert byte values
LinkAllocate buffers and convert byte values
ByteBuffer.allocate accepts a nonnegative int length and an int initial value from 0 through 255. The initial value defaults to zero.
The new buffer has exactly that many copies of the initial byte. Zero length is valid and still requires a valid initial byte.
A negative length produces TPZ4001 at runtime. An invalid initial byte or an allocation that cannot be satisfied produces TPZ5001 at runtime.
ByteBuffer.fromBytes converts an immutable Bytes value into a mutable ByteBuffer value containing the same bytes.
ByteBuffer.toBytes converts the current buffer contents into an immutable Bytes value.
ByteBuffer.length is a read-only byte count property. Buffer operations never change its length.
Assignment, argument passing, return, capture, and aggregate storage follow collection value semantics.
Supplied expressions evaluate once from left to right before allocation or conversion. These operations have no I/O effects.
Why
A fixed length gives binary algorithms stable byte positions. Explicit conversion distinguishes mutable construction from immutable byte data.
Source evidence
- compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 108 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 127 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 137 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 315 -
topaz.stdlib.contract.byte-buffer-storageatworking-tree - topaz.decision.collection-value-semantics.1 at
topaz.decisi
Allocate zero-filled and initialized buffers
Linkimport std.bytes { ByteBuffer }import std.ioio.writeLine(ByteBuffer.allocate(0).toBytes().toHex())io.writeLine(ByteBuffer.allocate(3).toBytes().toHex())io.writeLine(ByteBuffer.allocate(2, 255).toBytes().toHex())
000000 ffff
Expected result
Expected result
Execution completes. Exit code 0.
000000ffff
Source evidence
- compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 108 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 127 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 137 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 315 -
topaz.stdlib.contract.byte-buffer-storageatworking-tree - topaz.decision.collection-value-semantics.1 at
topaz.decisi
Keep the original buffer and converted bytes unchanged
Linkimport std.bytes { ByteBuffer }import std.iolet source = "ab".encodeUtf8()let buffer = ByteBuffer.fromBytes(source)let independent = ByteBuffer.fromBytes(source)let before = buffer.toBytes()let mut alias = bufferalias.set(0, 99)io.writeLine(source.toHex())io.writeLine(before.toHex())io.writeLine(independent.toBytes().toHex())io.writeLine(buffer.toBytes().toHex())
6162 6162 6162 6162
Expected result
Expected result
Execution completes. Exit code 0.
6162616261626162
Source evidence
- compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 108 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 127 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 137 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 315 -
topaz.stdlib.contract.byte-buffer-storageatworking-tree - topaz.decision.collection-value-semantics.1 at
topaz.decisi
Reject a negative buffer length
Linkimport std.bytes { ByteBuffer }ByteBuffer.allocate(-1)
No stdout.
Expected result
Expected result
Rejection during run. Nonzero exit.
TPZ4001byte-buffer-negative-bound atmain.tpz:2:1
Source evidence
- compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 108 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 127 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 137 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 315 -
topaz.stdlib.contract.byte-buffer-storageatworking-tree - topaz.decision.collection-value-semantics.1 at
topaz.decisi
Validate the initial byte of an empty buffer
Linkimport std.bytes { ByteBuffer }import std.ioByteBuffer.allocate(0, -1)io.writeLine("after")
No stdout.
Expected result
Source evidence
- compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 108 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 127 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 137 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 315 -
topaz.stdlib.contract.byte-buffer-storageatworking-tree - topaz.decision.collection-value-semantics.1 at
topaz.decisi
Validate the initial byte of an empty buffer
Linkimport std.bytes { ByteBuffer }import std.ioByteBuffer.allocate(0, 256)io.writeLine("after")
No stdout.
Expected result
Source evidence
- compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 108 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 127 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 137 - compiler/crates/topaz_value/src/value/builtins/byte_buffer.rs at
912a5e86e1f9· 315 -
topaz.stdlib.contract.byte-buffer-storageatworking-tree - topaz.decision.collection-value-semantics.1 at
topaz.decisi