Skip to content

Commit 6b6066b

Browse files
hyperpolymathclaude
andcommitted
fix(gql-dt): eliminate all 24 unused variable warnings across 7 Lean modules
35/35 modules build with 0 errors, 0 warnings. Prefixed unused variables in IR, Lexer, Parser, Pipeline, Serialization, TypeInference, and TypeSafe with underscores. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
1 parent ba80382 commit 6b6066b

7 files changed

Lines changed: 21 additions & 21 deletions

File tree

‎lithoglyph/gql-dt/src/GqlDt/IR.lean‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ def generateIR_Insert
189189
(permissions : PermissionMetadata)
190190
: IR :=
191191
-- Extract proof metadata from values
192-
let proofs := stmt.values.filterMap fun ⟨t, v⟩ =>
192+
let proofs := stmt.values.filterMap fun ⟨t, _v⟩ =>
193193
match t with
194194
| .boundedNat min max =>
195195
some (serializeProof "BoundedNat" s!"value ∈ [{min}, {max}]")
@@ -352,14 +352,14 @@ def validatePermissions (ir : IR) : Except String Unit := do
352352
if !isTypeAllowed t stmt.permissions.allowedTypes then
353353
throw s!"Type {t} not allowed by permission profile"
354354
return ()
355-
| .select stmt => return () -- SELECT doesn't modify data
355+
| .select _stmt => return () -- SELECT doesn't modify data
356356
| .update stmt =>
357357
for assign in stmt.assignments do
358358
if !isTypeAllowed assign.value.1 stmt.permissions.allowedTypes then
359359
throw s!"Type {assign.value.1} not allowed by permission profile"
360360
return ()
361-
| .delete stmt => return () -- DELETE doesn't use typed values
362-
| .normalize stmt => return () -- NORMALIZE is admin-only
361+
| .delete _stmt => return () -- DELETE doesn't use typed values
362+
| .normalize _stmt => return () -- NORMALIZE is admin-only
363363

364364
-- ============================================================================
365365
-- IR Optimization

‎lithoglyph/gql-dt/src/GqlDt/Lexer.lean‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,7 @@ partial def parseNumber (s : LexerState) : LexerState × String :=
287287
(final, s.input.extract start final.pos)
288288

289289
partial def parseString (s : LexerState) (quote : Char) : LexerState × String :=
290-
let start := s.pos
290+
let _start := s.pos
291291
let rec loop (state : LexerState) (acc : String) : LexerState × String :=
292292
match state.curr with
293293
| none => (state, acc)

‎lithoglyph/gql-dt/src/GqlDt/Parser.lean‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -294,7 +294,7 @@ noncomputable def parseInsertGQLdt : Parser InferredInsert := do
294294

295295
-- Extract columns and types
296296
let columns := typedColumns.map (·.1)
297-
let expectedTypes := typedColumns.map (·.2)
297+
let _expectedTypes := typedColumns.map (·.2)
298298

299299
-- Type check values against expected types
300300
-- TODO: Verify values match expected types

‎lithoglyph/gql-dt/src/GqlDt/Pipeline.lean‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -155,11 +155,11 @@ def generateIRFromAST (stmt : Statement) (config : PipelineConfig) : Except Stri
155155
.error "DELETE → IR conversion not yet implemented"
156156

157157
/-- Stage 5: Validate permissions -/
158-
def validateIRPermissions (ir : IR) (config : PipelineConfig) : Except String Unit :=
158+
def validateIRPermissions (ir : IR) (_config : PipelineConfig) : Except String Unit :=
159159
validatePermissions ir
160160

161161
/-- Stage 6: Serialize IR -/
162-
noncomputable def serializeIRToBytes (ir : IR) (config : PipelineConfig) : ByteArray :=
162+
noncomputable def serializeIRToBytes (ir : IR) (_config : PipelineConfig) : ByteArray :=
163163
serializeIR ir -- TODO: Use config.serializationFormat
164164

165165
-- ============================================================================

‎lithoglyph/gql-dt/src/GqlDt/Serialization.lean‎

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ partial def encodeCBOR (value : CBORValue) : ByteArray :=
268268
else
269269
ByteArray.mk #[0xF8, n.toUInt8]
270270

271-
| .float f =>
271+
| .float _f =>
272272
-- IEEE 754 single-precision float (major type 7, additional info 26)
273273
-- TODO: Implement Float.toBits.toLittleEndian for Lean 4.15.0
274274
ByteArray.mk #[0xFB, 0, 0, 0, 0, 0, 0, 0, 0]
@@ -327,7 +327,7 @@ def decodeUnsignedCBOR (d : CBORDecoder) (addInfo : UInt8) : Except String (Nat
327327
else if addInfo == 27 then
328328
-- 8-byte follows (big-endian)
329329
do
330-
let (bytes, d') ← d.readBytes 8
330+
let (_bytes, d') ← d.readBytes 8
331331
-- TODO: Implement UInt64.fromBigEndian for Lean 4.15.0
332332
let val := 0 -- Stub
333333
.ok (val, d')
@@ -356,7 +356,7 @@ partial def decodeCBORValue (d : CBORDecoder) : Except String (CBORValue × CBOR
356356

357357
| 3 => -- Text string
358358
let (len, d2) ← decodeUnsignedCBOR d1 addInfo
359-
let (bytes, d3) ← d2.readBytes len
359+
let (_bytes, d3) ← d2.readBytes len
360360
let str := "" -- TODO: Implement String.fromUTF8 for Lean 4.15.0
361361
.ok (.textString str, d3)
362362

@@ -398,14 +398,14 @@ partial def decodeCBORValue (d : CBORDecoder) : Except String (CBORValue × CBOR
398398
else if addInfo == 26 then
399399
-- Single-precision float (32-bit)
400400
do
401-
let (bytes, d2) ← d1.readBytes 4
401+
let (_bytes, d2) ← d1.readBytes 4
402402
-- TODO: Implement UInt32.fromLittleEndian for Lean 4.15.0
403403
let f := 0.0
404404
.ok (.float f, d2)
405405
else if addInfo == 27 then
406406
-- Double-precision float (64-bit)
407407
do
408-
let (bytes, d2) ← d1.readBytes 8
408+
let (_bytes, d2) ← d1.readBytes 8
409409
-- TODO: Implement UInt64.fromLittleEndian for Lean 4.15.0
410410
let f := 0.0
411411
.ok (.float f, d2)
@@ -434,14 +434,14 @@ def decodeCBOR (bytes : ByteArray) : Except String CBORValue := do
434434
-/
435435
def serializeTypedValueBinary (tv : Σ t : TypeExpr, TypedValue t) : ByteArray :=
436436
match tv with
437-
| ⟨.nat, .nat n⟩ =>
437+
| ⟨.nat, .nat _n⟩ =>
438438
-- Tag (0x01) + 8 bytes little-endian
439439
let tag : UInt8 := 0x01
440440
-- TODO: Implement toLittleEndian for Lean 4.15.0
441441
let valueBytes := ByteArray.mk #[0, 0, 0, 0, 0, 0, 0, 0]
442442
ByteArray.mk #[tag] ++ valueBytes
443443

444-
| ⟨.boundedNat min max, .boundedNat _ _ bn⟩ =>
444+
| ⟨.boundedNat _min _max, .boundedNat _ _ _bn⟩ =>
445445
-- Tag (0x02) + min (8 bytes) + max (8 bytes) + value (8 bytes)
446446
let tag : UInt8 := 0x02
447447
-- TODO: Implement toLittleEndian for Lean 4.15.0
@@ -553,14 +553,14 @@ def fromSQLValue (sqlValue : String) (expectedType : TypeExpr) : Except String (
553553
def testJSONRoundTrip (tv : Σ t : TypeExpr, TypedValue t) : Bool :=
554554
let json := serializeTypedValueJSON tv
555555
match deserializeTypedValueJSON json with
556-
| .ok tv' => true -- TODO: Check equality
556+
| .ok _tv' => true -- TODO: Check equality
557557
| .error _ => false
558558

559559
/-- Test: Binary round-trip -/
560560
def testBinaryRoundTrip (tv : Σ t : TypeExpr, TypedValue t) : Bool :=
561561
let bytes := serializeTypedValueBinary tv
562562
match deserializeTypedValueBinary bytes with
563-
| .ok tv' => true -- TODO: Check equality
563+
| .ok _tv' => true -- TODO: Check equality
564564
| .error _ => false
565565

566566
-- ============================================================================
@@ -587,7 +587,7 @@ partial def jsonToBytes (json : JsonValue) : ByteArray :=
587587
(stringify json).toUTF8
588588

589589
/-- Parse JSON from UTF-8 bytes -/
590-
def bytesToJson (bytes : ByteArray) : Except String JsonValue :=
590+
def bytesToJson (_bytes : ByteArray) : Except String JsonValue :=
591591
-- TODO: Full JSON parser (for now, stub)
592592
.error "JSON parsing not yet implemented"
593593

‎lithoglyph/gql-dt/src/GqlDt/TypeInference.lean‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -318,8 +318,8 @@ def parseLiteral (literal : String) : Except String InferredType :=
318318

319319
/-- Parse GQL INSERT and perform type inference -/
320320
def parseGQLInsert
321-
(schema : Schema)
322-
(query : String)
321+
(_schema : Schema)
322+
(_query : String)
323323
: Except String InferredInsert := do
324324
-- TODO: Actual parser
325325
-- For now, assume query is already parsed to components

‎lithoglyph/gql-dt/src/GqlDt/TypeSafe.lean‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ def execute {schema : Schema} (stmt : InsertStmt schema) : IO Unit := do
193193
-- Stubbed due to satisfiesConstraints signature issue
194194
axiom executePreservesTypes {schema : Schema} (stmt : InsertStmt schema) :
195195
∀ i, i < stmt.values.length →
196-
let ⟨t, v⟩ := stmt.values.get! i
196+
let ⟨_t, _v⟩ := stmt.values.get! i
197197
True -- Placeholder
198198

199199
end GqlDt.TypeSafe

0 commit comments

Comments
 (0)