chore: import upstream snapshot with attribution
CI / Deep Native Runtime Cases (1/6) (push) Has been skipped
CI / Native Preflight (push) Failing after 1s
CI / Native Runtime Cases (1/2) (push) Failing after 0s
CI / Native Runtime Cases (2/2) (push) Failing after 1s
CI / Native Metadata Reports (push) Failing after 0s
CI / Native Direct Backend Artifacts (push) Failing after 0s
CI / Native Sanitizer Smoke (push) Failing after 1s
CI / Command Contract Snapshots (push) Failing after 1s
CI / Deep Conformance Suite (push) Has been skipped
CI / Graph Build Perf (push) Failing after 1s
CI / Deep Native Preflight (push) Has been skipped
CI / Deep Native Runtime Cases (2/6) (push) Has been skipped
CI / Deep Native Runtime Cases (3/6) (push) Has been skipped
CI / Conformance Suite (push) Failing after 1s
CI / Workspace Checks (push) Failing after 0s
CI / Deep Native Runtime Cases (5/6) (push) Has been skipped
CI / Deep Native Runtime Cases (6/6) (push) Has been skipped
CI / Deep Native Runtime Cases (4/6) (push) Has been skipped
CI / Deep Graph Build Perf (push) Has been skipped

This commit is contained in:
wehub-resource-sync
2026-07-13 12:29:30 +08:00
commit e7738de6d2
1723 changed files with 216139 additions and 0 deletions
@@ -0,0 +1,46 @@
{
"schema": 1,
"purpose": "Track minimized agent-surface repros without preserving report source context.",
"fixtures": [
{
"id": "interface-method-generic-binding",
"path": "conformance/agent-surface/fixtures/interface-method-generic-binding.0",
"classification": "intended-behavior",
"currentBehavior": "check-pass",
"followUp": "Keep interface method generic binders independent from interface type parameters.",
"runner": "assert-check-pass"
},
{
"id": "direct-generic-recursion",
"path": "conformance/agent-surface/fixtures/direct-generic-recursion.0",
"classification": "intended-behavior",
"currentBehavior": "check-pass-target-ready",
"followUp": "Keep self-recursive generic call targets present in the direct backend function table.",
"runner": "assert-target-ready"
},
{
"id": "direct-generic-specialization-name-collision",
"path": "conformance/agent-surface/fixtures/direct-generic-specialization-name-collision.0",
"classification": "unsupported-program-shape",
"currentBehavior": "check-pass-target-blocked-BLD004",
"followUp": "Keep direct generic specialization names from silently resolving to unrelated concrete functions.",
"runner": "assert-target-blocked"
},
{
"id": "stdlib-signature-parity",
"path": "scripts/compiler-metrics.mts",
"classification": "enforced-structure-guardrail",
"currentBehavior": "budget-pass-no-violations",
"followUp": "Keep compiler structure budgets enforced for file size, strcmp growth, large functions, and stdlib signature parity until one standard-library signature and capability source replaces duplicated metadata.",
"runner": "assert-budget-pass"
},
{
"id": "owned-drop-direct-backend-unsupported",
"path": "conformance/agent-surface/fixtures/owned-drop-direct-backend-unsupported.0",
"classification": "target-buildability-blocker",
"currentBehavior": "check-pass-target-blocked-BLD004",
"followUp": "Keep target-aware backend blockers before emission and keep backend diagnostics target-correct.",
"runner": "assert-diagnostic-code"
}
]
}
@@ -0,0 +1,8 @@
fn loop<T: Type>(value: T) -> Void {
loop<T>(value)
}
pub fn main(world: World) -> Void raises {
loop<i32>(1)
check world.out.write("direct generic recursion ok\n")
}
@@ -0,0 +1,16 @@
fn identity<T: Type>(value: T) -> T {
return value
}
fn identity__i32(value: i32) -> i32 {
return value + 1
}
pub fn main(world: World) -> Void raises {
let value: i32 = identity<i32>(1)
if value == 1 {
check world.out.write("direct specialization collision avoided\n")
} else {
check world.out.write("direct specialization collision reached wrong target\n")
}
}
@@ -0,0 +1,20 @@
type Identity {
fn id<X: Type>(x: X) -> X {
return x
}
}
interface Id {
fn id<X: Type>(x: X) -> X
}
fn useId<F: Id, X: Type>(value: X) -> X {
return F.id(value)
}
pub fn main(world: World) -> Void raises {
let value: i32 = useId<Identity, i32>(1)
if value == 1 {
check world.out.write("interface method generic ok\n")
}
}
@@ -0,0 +1,13 @@
type Tracked {
value: i32,
fn drop(self: mutref<Self>) -> Void {
self.value = 0
}
}
pub fn main(world: World) -> Void raises {
let tracked: owned<Tracked> = Tracked { value: 42 }
if tracked.value == 42 {
check world.out.write("owned drop backend unsupported current ok\n")
}
}
@@ -0,0 +1,3 @@
pub fn main(world: World) -> Void raises {
check world.out.write("host leak package\n")
}
Binary file not shown.
+14
View File
@@ -0,0 +1,14 @@
[package]
name = "host-leak-package"
version = "0.1.0"
[targets.cli]
kind = "exe"
main = "src/main.0"
[c.libs.hostonly]
headers = ["hostonly.h"]
include = ["/usr/include"]
lib = ["/usr/lib"]
link = ["hostonly"]
pkg_config = "hostonly"
+1
View File
@@ -0,0 +1 @@
int zero_c_old_style();
+15
View File
@@ -0,0 +1,15 @@
#define ZERO_C_ANSWER 42
typedef int zero_c_int;
typedef struct zero_c_point {
int x;
int y;
} zero_c_point;
enum zero_c_color {
ZERO_C_RED = 1,
ZERO_C_BLUE = 2
};
int zero_c_add(int a, int b);
+20
View File
@@ -0,0 +1,20 @@
#ifndef ZERO_TARGET_CONDITIONAL_H
#define ZERO_TARGET_CONDITIONAL_H
#if defined(_WIN32) && !defined(__linux__)
int zero_c_windows_add(int left, int right);
#elif defined(__linux__)
int zero_c_linux_add(int left, int right);
#else
int zero_c_fallback_add(int left, int right);
#endif
#ifndef _WIN32
int zero_c_not_windows(int value);
#endif
#ifdef __aarch64__
int zero_c_arm64_only(int value);
#endif
#endif
+1
View File
@@ -0,0 +1 @@
int zero_log(const char *fmt, ...);
@@ -0,0 +1,8 @@
pub fn main(world: World) -> Void raises {
let values: [3]u8 = [1, 2, 3]
var count: i32 = 0
count = count + 1
if count == 1 {
check world.out.write("array assignment ok\n")
}
}
Binary file not shown.
+4
View File
@@ -0,0 +1,4 @@
extern c "conformance/c/simple.h" as c
pub fn main() -> Void {
}
Binary file not shown.
@@ -0,0 +1,13 @@
extern c "conformance/c/simple.h" as c
type Counter {
value: i32,
fn get(self: ref<Self>) -> i32 {
return self.value
}
}
pub fn main() -> Void {
let c: Counter = Counter { value: 42 }
expect c.get() == 42
}
@@ -0,0 +1,5 @@
extern c "conformance/c/target-conditional.h" as c
export c fn main() -> i32 {
return c.zero_c_linux_add(20, 22) + c.zero_c_not_windows(1)
}
Binary file not shown.
@@ -0,0 +1,5 @@
extern c "conformance/c/target-conditional.h" as c
export c fn main() -> i32 {
return c.zero_c_windows_add(20, 22)
}
Binary file not shown.
@@ -0,0 +1,23 @@
const constTotal: i32 = add(20, 22)
choice PayloadResult {
text: String,
count: i32,
}
fn add(left: i32, right: i32) -> i32 {
return left + right
}
pub fn main() -> Void {
let result: PayloadResult = PayloadResult.text("zero")
match result {
.text(message) {
let size: usize = std.mem.len(message)
expect (size == 4)
}
.count(value) {
expect (value == constTotal)
}
}
}
@@ -0,0 +1,72 @@
type Counter {
value: i32 = defaultCount(),
fn init(value: i32) -> Self {
return Counter { value: value }
}
fn read(self: ref<Self>) -> i32 {
return self.value
}
fn bump(self: mutref<Self>, amount: i32) -> Void {
self.value = self.value + amount
}
fn checkedRead(self: ref<Self>) -> i32 raises [EmptyCounter] {
if self.value == 0 {
raise EmptyCounter
}
return self.value
}
}
interface Readable<T: Type> {
fn read(self: ref<T>) -> i32
}
choice Event {
key: i32,
quit,
}
fn defaultCount() -> i32 {
return 41
}
fn add(left: i32, right: i32) -> i32 {
return left + right
}
fn id<T: Type>(value: T) -> T {
return value
}
fn wrap<T: Type>(value: T) -> T {
return id(value)
}
fn readValue<T: Readable<T>>(value: ref<T>) -> i32 {
return T.read(value)
}
fn risky(flag: Bool) -> i32 raises [BadInput] {
if flag {
raise BadInput
}
return 7
}
pub fn main(world: World) -> Void raises {
var counter: Counter = Counter.init(41)
let defaulted: Counter = Counter {}
counter.bump(1)
let total: i32 = add(id<i32>(40), 2)
let wrapped: i32 = wrap<i32>(total)
let size: usize = std.mem.len("zero")
let event: Event = Event.key(total)
let direct: i32 = Counter.read(&counter)
let defaultedValue: i32 = Counter.read(&defaulted)
let viaInterface: i32 = readValue<Counter>(&counter)
let checked: i32 = check counter.checkedRead()
let safe: i32 = check risky(false)
if total == 42 && wrapped == 42 && size == 4 && defaultedValue == 41 && (direct == 42 && viaInterface == 42) && (checked == 42 && safe == 7) {
check world.out.write("call resolution inspection ok\n")
}
}
@@ -0,0 +1,71 @@
type Point {
x: i32,
y: i32,
}
enum Mode: u8 {
off,
on,
}
choice Event {
none,
point: Point,
}
fn noop() -> Void {
return
}
fn read_x(point: ref<Point>) -> i32 {
return point.x
}
fn bump_x(point: mutref<Point>) -> Void {
point.x = point.x + 1
}
fn first_byte(bytes: Span<u8>) -> u8 {
return bytes[0]
}
fn set_second(bytes: MutSpan<u8>) -> Void {
bytes[1] = 9
}
fn branch(flag: Bool) -> i32 {
if flag {
return 1
} else {
return 0
}
}
pub fn main(world: World) -> Void raises {
noop()
var point: Point = Point { x: 1, y: 2 }
let mode: Mode = Mode.on
let event: Event = Event.point(point)
var bytes: [4]u8 = [1, 2, 3, 4]
let writable: MutSpan<u8> = bytes
set_second(writable)
let readonly: Span<u8> = bytes
let label: String = "checker"
let byte: u8 = first_byte(readonly)
let widened: u32 = byte as u32
let window: Span<u8> = readonly[1..3]
bump_x(&mut point)
while false {
return
}
match mode {
on {
if read_x(&point) == 2 && branch(true) == 1 && widened > 0 && std.mem.len(window) == 2 {
check world.out.write("checker type forms ok\n")
}
}
off {
check world.out.write(label)
}
}
}
Binary file not shown.
@@ -0,0 +1,7 @@
const base: i32 = 40
const answer: i32 = base + 2
pub fn main() -> Void {
expect (answer == 42)
}
Binary file not shown.
@@ -0,0 +1,8 @@
pub fn main(world: World) -> Void raises {
var filled: [8]u8 = [7_u8; 8]
var listed: [4]u8 = [1, 2, 3, 4]
filled[0] = listed[3]
if filled[0] == 4 {
check world.out.write("fixed array lengths ok\n")
}
}
@@ -0,0 +1,27 @@
alias ByteCount = usize
type Counter {
value: i32,
fn add(self: ref<Self>, amount: i32) -> i32 {
return self.value + amount
}
}
enum State {
ready,
done,
}
pub fn main() -> Void {
let count: ByteCount = 42_usize
let counter: Counter = Counter { value: 40 }
let state: State = State.ready
match state {
ready {
expect (Counter.add(&counter, 2) == 42)
}
_ {
expect (count == 42_usize)
}
}
}
Binary file not shown.
@@ -0,0 +1,11 @@
const cap: usize = 3
fn head<T: Type, static N: usize>(items: ref<[N]T>) -> T {
return items[0]
}
pub fn main() -> Void {
let values: [cap]i32 = [3, 4, 5]
let first: i32 = head(&values)
expect (first == 3)
}
Binary file not shown.
@@ -0,0 +1,31 @@
const T: usize = 3
const N: usize = 3
type Holder<U: Type> {
value: U,
}
type Box<static N: usize> {
value: i32,
}
fn unwrap<T: Type>(holder: ref<Holder<T>>) -> T {
return holder.value
}
fn forwardUnwrap<T: Type>(holder: ref<Holder<T>>) -> T {
return unwrap(holder)
}
fn read<static N: usize>(box: ref<Box<N>>) -> i32 {
return box.value
}
pub fn main() -> Void {
let holder: Holder<i32> = Holder { value: 5 }
let value: i32 = forwardUnwrap(&holder)
let box: Box<4> = Box { value: 9 }
let boxed: i32 = read(&box)
expect (value == 5 && boxed == 9)
}
Binary file not shown.
@@ -0,0 +1,28 @@
const Foo: usize = 3
type Foo {
value: i32,
}
type Holder<T: Type> {
value: T,
}
type Sized<static N: usize> {
value: i32,
}
fn take<T: Type>(holder: ref<Holder<T>>) -> T {
return holder.value
}
fn touchSized<static N: usize>(item: ref<Sized<N>>) -> Void {
}
pub fn main() -> Void {
let holder: Holder<Foo> = Holder { value: Foo { value: 7 } }
let value: Foo = take(&holder)
let sized: Sized<Foo> = Sized { value: 9 }
touchSized(&sized)
expect (value.value == 7)
}
@@ -0,0 +1,10 @@
fn identity<T: Type>(value: T) -> T {
return value
}
pub fn main() -> Void {
let a: i32 = identity<i32>(41)
let b: u8 = identity<u8>(7_u8)
expect (a == 41)
expect (b == 7_u8)
}
Binary file not shown.
@@ -0,0 +1,37 @@
type Pair<A: Type, B: Type> {
left: A,
right: B,
}
type Box<T: Type> {
value: T,
fn rightOf<U: Type>(self: ref<Self>, pair: ref<Pair<T, U>>) -> U {
return pair.right
}
}
type PlainBox {
value: i32,
fn project<U: Type>(self: ref<Self>, pair: ref<Pair<Self, U>>) -> U {
return pair.right
}
}
interface Projector<T: Type> {
fn project<U: Type>(self: ref<T>, pair: ref<Pair<T, U>>) -> U
}
fn project<T: Projector<T>, U: Type>(value: ref<T>, pair: ref<Pair<T, U>>) -> U {
return T.project(value, pair)
}
pub fn main() -> Void {
let box: Box<i32> = Box { value: 1 }
let pair: Pair<i32, Bool> = Pair { left: 2, right: true }
let receiver: Bool = box.rightOf(&pair)
let namespaced: Bool = Box.rightOf(&box, &pair)
let plain: PlainBox = PlainBox { value: 3 }
let projectedPair: Pair<PlainBox, Bool> = Pair { left: PlainBox { value: 4 }, right: true }
let projected: Bool = project(&plain, &projectedPair)
expect (receiver && namespaced && projected)
}
@@ -0,0 +1,20 @@
const Foo: usize = 3
type Foo {
value: i32,
}
type Mixed<T: Type, static N: usize> {
value: T,
items: [N]i32,
}
fn take<T: Type, static N: usize>(item: ref<Mixed<T, N>>) -> T {
return item.value
}
pub fn main() -> Void {
let mixed: Mixed<Foo, Foo> = Mixed { value: Foo { value: 7 }, items: [1, 2, 3] }
let value: Foo = take(&mixed)
expect (value.value == 7)
}
@@ -0,0 +1,8 @@
type Box<T: Type> {
value: T,
}
pub fn main() -> Void {
let box: Box<i32> = Box { value: 42 }
expect (box.value == 42)
}
Binary file not shown.
@@ -0,0 +1,22 @@
type FixedVec<T: Type, static N: usize> {
len: usize,
items: [N]T,
fn push(self: mutref<Self>, value: T) -> Void raises [Full] {
if self.len == N {
raise Full
}
self.items[self.len] = value
self.len = self.len + 1
}
fn get(self: ref<Self>, index: usize) -> Maybe<T> {
let items: [N]T = self.items
return std.mem.get(items, index)
}
}
pub fn main() -> Void raises {
var vec: FixedVec<u8, 4> = FixedVec { len: 0, items: [0, 0, 0, 0] }
check FixedVec.push(&mut vec, 7)
let first: Maybe<u8> = FixedVec.get(&vec, 0)
expect (first.has && first.value == 7)
}
Binary file not shown.
@@ -0,0 +1,14 @@
type Pair<T: Type, U: Type> {
left: T,
right: U,
}
fn makePair<T: Type, U: Type>(left: T, right: U) -> Pair<T, U> {
return Pair { left: left, right: right }
}
pub fn main() -> Void {
let pair: Pair<i32, u8> = makePair(7, 9_u8)
expect (pair.left == 7)
expect (pair.right == 9_u8)
}
Binary file not shown.
@@ -0,0 +1,19 @@
const N: usize = 4
type Helper {
fn needsSame<static M: usize>(left: ref<[M]i32>, right: ref<[M]i32>) -> Void {
}
}
fn needsSame<static M: usize>(left: ref<[M]i32>, right: ref<[M]i32>) -> Void {
}
fn caller<static N: usize>(left: ref<[N]i32>, right: ref<[N]i32>) -> Void {
needsSame<N>(left, right)
Helper.needsSame<N>(left, right)
}
pub fn main() -> Void {
let values: [3]i32 = [1, 2, 3]
caller(&values, &values)
}
@@ -0,0 +1,15 @@
const cap: usize = 3
fn head<T: Type, static N: usize>(items: ref<[N]T>) -> T {
return items[0]
}
fn forward<T: Type, static N: usize>(items: ref<[N]T>) -> T {
return head(items)
}
pub fn main() -> Void {
let values: [cap]i32 = [7, 8, 9]
let first: i32 = forward(&values)
expect (first == 7)
}
@@ -0,0 +1,28 @@
type Helper {
fn head<T: Type, static N: usize>(items: ref<[N]T>) -> T {
return items[0]
}
}
type FixedVec<T: Type, static N: usize> {
items: [N]T,
fn first(self: ref<Self>) -> T {
return self.items[0]
}
}
fn forwardHead<T: Type, static N: usize>(items: ref<[N]T>) -> T {
return Helper.head(items)
}
fn forwardFirst<T: Type, static N: usize>(items: ref<FixedVec<T, N>>) -> T {
return items.first()
}
pub fn main() -> Void {
let values: [3]i32 = [1, 2, 3]
let vec: FixedVec<i32, 3> = FixedVec { items: [4, 5, 6] }
let first: i32 = forwardHead(&values)
let second: i32 = forwardFirst(&vec)
expect (first == 1 && second == 4)
}
@@ -0,0 +1,20 @@
const Len: usize = 3
type Len {
value: i32,
}
type Bundle<T: Type, static N: usize> {
value: T,
items: [N]i32,
}
fn payload<T: Type, static N: usize>(bundle: Bundle<T, N>) -> [N]i32 {
return bundle.items
}
pub fn main() -> Void {
let bundle: Bundle<Len, Len> = Bundle { value: Len { value: 7 }, items: [1, 2, 3] }
let values: [Len]i32 = payload(bundle)
expect (values[2] == 3)
}
@@ -0,0 +1,20 @@
const Foo: usize = 3
type Foo {
value: i32,
}
fn read(value: ref<Foo>) -> i32 {
return value.value
}
fn pass(value: Maybe<Foo>) -> Maybe<Foo> {
return value
}
pub fn main() -> Void {
let foo: Foo = Foo { value: 7 }
let maybe: Maybe<Foo> = null
let result: Maybe<Foo> = pass(maybe)
expect (read(&foo) == 7 && !result.has)
}
@@ -0,0 +1,33 @@
const cap = 3
const enabled = true
const selected = Mode.fast
type Gate<static enabledFlag: Bool, static selectedMode: Mode> {
value: i32,
}
enum Mode: u8 {
fast,
tiny,
}
fn head<T: Type, static N: usize>(items: ref<[N]T>) -> T {
return items[0]
}
fn readGate<static enabledFlag: Bool, static selectedMode: Mode>(gate: ref<Gate<enabledFlag, selectedMode>>) -> i32 {
if enabledFlag {
return gate.value
}
return 0
}
pub fn main() -> Void {
let values: [cap]i32 = [3, 4, 5]
let first: i32 = head(&values)
let gate: Gate<enabled, selected> = Gate { value: 9 }
let gated: i32 = readGate(&gate)
expect (first == 3 && gated == 9)
}
+10
View File
@@ -0,0 +1,10 @@
use math
use types
pub fn main(world: World) -> Void raises {
let point: Point = Point { value: add_one(41) }
if point.value == 42 {
check world.out.write("imports pass\n")
}
}
@@ -0,0 +1,3 @@
fn add_one(value: i32) -> i32 {
return value + 1
}
@@ -0,0 +1,3 @@
type Point {
value: i32,
}
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
[package]
name = "imports-pass"
version = "0.1.0"
[targets.cli]
kind = "exe"
main = "src/main.0"
+16
View File
@@ -0,0 +1,16 @@
enum Mode {
fast,
slow,
}
pub fn main() -> Void {
let mode: Mode = Mode.fast
match mode {
fast {
expect (true)
}
_ {
expect (true)
}
}
}
Binary file not shown.
+16
View File
@@ -0,0 +1,16 @@
type BufferView {
bytes: Span<u8>,
owner: Maybe<ref<Alloc>>,
}
type SliceView {
bytes: Span<u8>,
}
pub fn main(world: World) -> Void raises {
let bytes: Span<u8> = std.mem.span("memory")
let view: SliceView = SliceView { bytes: bytes }
if std.mem.len(view.bytes) == 6 {
check world.out.write("memory types ok\n")
}
}
Binary file not shown.
+23
View File
@@ -0,0 +1,23 @@
use std.codec
use std.parse
use std.time
use types
fn cleanup() -> Void {
return
}
pub fn main(world: World) -> Void raises {
defer cleanup()
let mode: Mode = Mode.fast
let outcome: Outcome = Outcome.ok
let bytes: Maybe<u32> = std.codec.readU32Le("abcd")
let digits: usize = std.parse.scanDigits("123abc")
let duration: Duration = std.time.add(std.time.ms(1), std.time.seconds(1))
if digits == 3 && bytes.has && bytes.value > 0 && std.time.asMsFloor(duration) > 0 {
check world.out.write("package pass\n")
}
}
@@ -0,0 +1,9 @@
enum Mode {
fast,
safe,
}
choice Outcome {
ok,
failed: i32,
}
Binary file not shown.
+7
View File
@@ -0,0 +1,7 @@
[package]
name = "package-pass"
version = "0.1.0"
[targets.cli]
kind = "exe"
main = "src/main.0"
+16
View File
@@ -0,0 +1,16 @@
choice Result {
ok: i32,
err: String,
}
pub fn main(world: World) -> Void raises {
let result: Result = Result.ok(42)
match result {
ok {
check world.out.write("payload match\n")
}
err {
check world.out.write("unexpected\n")
}
}
}
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
use std.codec
use std.parse
pub fn main(world: World) -> Void raises {
let len: usize = std.codec.encodedVarintLen(300)
let digit: Bool = std.parse.isAsciiDigit("7")
if len == 2 && digit {
check world.out.write("primitive std ok\n")
}
}
Binary file not shown.
@@ -0,0 +1,24 @@
type FixedVec<T: Type, static N: usize> {
len: usize,
items: [N]T,
fn push(self: mutref<Self>, value: T) -> Void raises [Full] {
if self.len == N {
raise Full
}
self.items[self.len] = value
self.len = self.len + 1
}
fn get(self: ref<Self>, index: usize) -> Maybe<T> {
return std.mem.get(self.items, index)
}
fn count(self: ref<Self>) -> usize {
return self.len
}
}
pub fn main() -> Void raises {
var vec: FixedVec<u8, 4> = FixedVec { len: 0, items: [0, 0, 0, 0] }
check vec.push(7)
let first: Maybe<u8> = vec.get(0)
expect (first.has && first.value == 7 && vec.count() == 1)
}
Binary file not shown.
@@ -0,0 +1,9 @@
type Pair {
left: u8 = 1,
right: u8,
}
pub fn main() -> Void {
let pair: Pair = Pair { right: 2 }
expect (pair.left == 1 && pair.right == 2)
}
Binary file not shown.
+11
View File
@@ -0,0 +1,11 @@
type Point {
x: i32,
y: i32,
}
pub fn main(world: World) -> Void raises {
let point: Point = Point { x: 1, y: 2 }
if point.x < point.y {
check world.out.write("shape ok\n")
}
}
Binary file not shown.
@@ -0,0 +1,19 @@
type Counter {
value: i32,
fn read(self: ref<Self>) -> i32 {
return self.value
}
}
interface Readable<T: Type> {
fn read(self: ref<T>) -> i32
}
fn readValue<T: Readable<T>>(value: ref<T>) -> i32 {
return T.read(value)
}
pub fn main() -> Void {
let counter: Counter = Counter { value: 42 }
expect (readValue<Counter>(&counter) == 42)
}
Binary file not shown.
@@ -0,0 +1,25 @@
type Bytes<static N: usize> {
items: [N]u8,
fn bytes(self: ref<Self>) -> [N]u8 {
return self.items
}
}
interface Sized<T: Type, static N: usize> {
fn bytes(self: ref<T>) -> [N]u8
}
fn readSized<T: Sized<T, N>, static N: usize>(value: ref<T>) -> [N]u8 {
return T.bytes(value)
}
fn readFour<T: Sized<T, 4>>(value: ref<T>) -> [4]u8 {
return T.bytes(value)
}
pub fn main() -> Void {
let bytes: Bytes<4> = Bytes { items: [1, 2, 3, 4] }
let fromGeneric: [4]u8 = readSized<Bytes<4>, 4>(&bytes)
let fromLiteral: [4]u8 = readFour<Bytes<4>>(&bytes)
expect (fromGeneric[3] == 4 && fromLiteral[0] == 1)
}
@@ -0,0 +1,11 @@
type Counter {
value: i32,
fn add(self: ref<Self>, amount: i32) -> i32 {
return self.value + amount
}
}
pub fn main() -> Void {
let counter: Counter = Counter { value: 40 }
expect (Counter.add(&counter, 2) == 42)
}
Binary file not shown.
@@ -0,0 +1,17 @@
const cap: usize = 4
type FixedVec<T: Type, static N: usize> {
len: usize,
items: [N]T,
}
fn first<T: Type, static N: usize>(vec: ref<FixedVec<T, N>>) -> T {
return vec.items[0]
}
pub fn main(world: World) -> Void raises {
let vec: FixedVec<u8, cap> = FixedVec { len: cap, items: [1, 2, 3, 4] }
if first<u8, cap>(&vec) == 1 {
check world.out.write("static value params check\n")
}
}
Binary file not shown.
@@ -0,0 +1,9 @@
pub fn main() -> Void {
var random_buf: [8]u8 = [0_u8; 8]
var entropy_buf: [8]u8 = [0_u8; 8]
let random_id: Maybe<Span<u8>> = std.crypto.randomId32(random_buf)
let entropy_hex: Maybe<Span<u8>> = std.rand.entropyHex32(entropy_buf)
if random_id.has && entropy_hex.has {
let _lengths: usize = std.mem.len(random_id.value) + std.mem.len(entropy_hex.value)
}
}

Some files were not shown because too many files have changed in this diff Show More