Commit b7bf771f

b7bf771f317cMerged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 1 file · ~1 modified

Description

fix(analyze): warn on non-convergence after fixpoint cap (#806)

The param-array type inference fixpoint runs at most 4 iterations and exits silently. If the program's inter-procedural type dependencies need more iterations, types stay widened beyond what a converged fixpoint would have produced -- and the user has no signal that this happened.

Emit a stderr warning when the loop exits with changed == 1 (the last iteration still mutated state and would have run again). The 4-iter cap is preserved -- raising it would risk compile-time explosions on adversarial inputs. The warning at least surfaces the divergence so the user knows where to look.

Closes #806

Co-Authored-By: Claude Opus 4.7 [email protected]

Details

Commit
b7bf771f317c
Parent
710cbe2a7b80

spinel_analyze.rbmodifiedView file

@@ -16346,6 +16346,13 @@
1634616346 end
1634716347 @current_class_idx = -1
1634816348 end
16349+ # Issue #806: warn on non-convergence after the cap. changed == 1
16350+ # means the last iteration still mutated state and would have run
16351+ # again. Indicates types may remain widened beyond what a converged
16352+ # fixpoint would have produced.
16353+ if changed == 1
16354+ $stderr.puts "warning: param-array type inference did not converge after 4 iterations; some types may be widened to poly"
16355+ end
1634916356 end
1635016357
1635116358 # Body-side param narrowing (Stage 1 of the callee→caller direction