R19SAFEfunctionParameter Mutability Widened
Flags when a parameter gains a readonly constraint. Callers passing mutable data automatically satisfy the new read-only constraint.
Applies to
TypeScriptRust
Why it matters
This is a safe change. A function that now accepts
readonly T[] will happily accept mutable T[] arrays too.Example
Before (mutable)
// processor.ts
export function process(data: number[]): number { ... }After (readonly)
// processor.ts (SAFE)
export function process(data: readonly number[]): number { ... }What you see in the terminal
$ npx dg check
[SAFE] process (signature_change)
src/processor.ts:2
Parameter 'data' now accepts readonly data. Existing mutable callers are unaffected.How detection works
The classifier detects when a parameter's type text gains 'readonly', 'Readonly', or 'ReadonlyArray' keywords.
Real-world scenario
A function adds readonly to its parameter to signal it won't mutate the input. All existing callers with mutable arrays still work.