feat(primitive): semantic nil-err check -- detect bare return nil #93

Open
opened 2026-05-27 18:13:38 +02:00 by michael · 0 comments
Owner

Goal

Add a primitive that semantically checks whether functions follow the
DAW nil, err return standard:
return nil, "[ERROR] ..." -- correct
return nil -- missing error value, violation

Static pattern matching is not sufficient here -- the primitive must
understand return statement structure to distinguish:
return nil -- violation
return nil, err -- correct
return nil, "[ERROR] ..." -- correct

Approach

Parse return statements and check that any bare return nil (without
a second value) is flagged as a violation.

Acceptance criteria

  • primitive detects bare return nil without second value
  • primitive does not flag return nil, err or return nil, "..."
  • primitive handles multi-line return statements
  • rule added to daw-lua-code pack

Notes

Good test candidate for semantic analysis beyond linepattern capabilities.
Part of enforcing DAW/fragjan nil, err return standard across the codebase.

## Goal Add a primitive that semantically checks whether functions follow the DAW nil, err return standard: return nil, "[ERROR] ..." -- correct return nil -- missing error value, violation Static pattern matching is not sufficient here -- the primitive must understand return statement structure to distinguish: return nil -- violation return nil, err -- correct return nil, "[ERROR] ..." -- correct ## Approach Parse return statements and check that any bare `return nil` (without a second value) is flagged as a violation. ## Acceptance criteria - [ ] primitive detects bare `return nil` without second value - [ ] primitive does not flag `return nil, err` or `return nil, "..."` - [ ] primitive handles multi-line return statements - [ ] rule added to daw-lua-code pack ## Notes Good test candidate for semantic analysis beyond linepattern capabilities. Part of enforcing DAW/fragjan nil, err return standard across the codebase.
michael added this to the Basic Version milestone 2026-05-30 16:08:42 +02:00
Sign in to join this conversation.
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
DAW/fragjan#93
No description provided.