Skip to content

Commit ab40206

Browse files
committed
add warnings
* changed api so that it's not breaking * cut down unused warning to just the variable * add unused warnings for match and functions * add warning category deny and allow * move warning to own file * add json for warnings
1 parent eeabada commit ab40206

File tree

10 files changed

+1299
-323
lines changed

10 files changed

+1299
-323
lines changed

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,3 +27,5 @@ node_modules/
2727

2828
# macOS
2929
.DS_Store
30+
31+
.claude

examples/hash_loop.simf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// Add counter to streaming hash and finalize when the loop exists
2-
fn hash_counter_8(ctx: Ctx8, unused: (), byte: u8) -> Either<u256, Ctx8> {
2+
fn hash_counter_8(ctx: Ctx8, _unused: (), byte: u8) -> Either<u256, Ctx8> {
33
let new_ctx: Ctx8 = jet::sha_256_ctx_8_add_1(ctx, byte);
44
match jet::all_8(byte) {
55
true => Left(jet::sha_256_ctx_8_finalize(new_ctx)),
@@ -8,7 +8,7 @@ fn hash_counter_8(ctx: Ctx8, unused: (), byte: u8) -> Either<u256, Ctx8> {
88
}
99

1010
// Add counter to streaming hash and finalize when the loop exists
11-
fn hash_counter_16(ctx: Ctx8, unused: (), bytes: u16) -> Either<u256, Ctx8> {
11+
fn hash_counter_16(ctx: Ctx8, _unused: (), bytes: u16) -> Either<u256, Ctx8> {
1212
let new_ctx: Ctx8 = jet::sha_256_ctx_8_add_2(ctx, bytes);
1313
match jet::all_16(bytes) {
1414
true => Left(jet::sha_256_ctx_8_finalize(new_ctx)),

run_examples.ps1

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
$ErrorActionPreference = "Stop"
2+
3+
function Invoke-Cargo {
4+
& cargo run -- @args
5+
if ($LASTEXITCODE -ne 0) { exit $LASTEXITCODE }
6+
}
7+
8+
$examplesDir = Join-Path $PSScriptRoot "examples"
9+
$simfFiles = Get-ChildItem -Path $examplesDir -Filter "*.simf" | Sort-Object Name
10+
11+
foreach ($simf in $simfFiles) {
12+
$base = $simf.BaseName
13+
$argsFile = Join-Path $examplesDir "$base.args"
14+
$witFiles = Get-ChildItem -Path $examplesDir -Filter "*.wit" |
15+
Where-Object { $_.Name -like "$base.*" } |
16+
Sort-Object Name
17+
18+
$baseArgs = @($simf.FullName, "--deny-warnings")
19+
if (Test-Path $argsFile) {
20+
$baseArgs += "-a", $argsFile
21+
}
22+
23+
# Run without witness
24+
Write-Host "`n=== $base (no witness) ===" -ForegroundColor Cyan
25+
Invoke-Cargo @baseArgs
26+
27+
# Run once per .wit file
28+
foreach ($wit in $witFiles) {
29+
Write-Host "`n=== $base + $($wit.Name) ===" -ForegroundColor Cyan
30+
$witArgs = $baseArgs + @("-w", $wit.FullName)
31+
Invoke-Cargo @witArgs
32+
}
33+
}

run_examples.sh

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
examples_dir="$(dirname "$0")/examples"
5+
6+
for simf in "$examples_dir"/*.simf; do
7+
base=$(basename "$simf" .simf)
8+
args_file="$examples_dir/$base.args"
9+
10+
base_args=("$simf" "--deny-warnings")
11+
if [ -f "$args_file" ]; then
12+
base_args+=("-a" "$args_file")
13+
fi
14+
15+
# Run without witness
16+
echo ""
17+
echo "=== $base (no witness) ==="
18+
cargo run -- "${base_args[@]}"
19+
20+
# Run once per .wit file
21+
for wit in "$examples_dir/$base".*.wit "$examples_dir/$base".wit; do
22+
[ -f "$wit" ] || continue
23+
echo ""
24+
echo "=== $base + $(basename "$wit") ==="
25+
cargo run -- "${base_args[@]}" -w "$wit"
26+
done
27+
done

0 commit comments

Comments
 (0)