mirror of
https://github.com/kucherenko/jscpd.git
synced 2026-09-19 08:11:03 +08:00
c7a8850785
Two bugs in flush_clone/post-processing fixed: 1. Overlap guard off-by-one: the strict check fired for adjacent duplicate blocks sharing exactly one boundary token (ex_end == cur_start). This caused the primary loop to discard legitimate consecutive self-clones (e.g. haxe/file1.hx blocks at lines 6-47 and 47-88). Fixed to use strict less-than on both ends: ex_end > cur_start for the overlap condition. 2. Secondary pass over-generation: the open_clone SM suppresses sub-windows for cross-file detection but the secondary pass still generates overlapping sub-clones for intra-file matches (repeated_windows has all adjacent windows; coverage tracking misses them when primary produces no primary clone). Re-add suppress_subclones (O(n^2) on clones, not on tokens) to remove fully-contained sub-clones after dedup_exact_clones. Regenerate tests/golden.json from the corrected binary: 218 stable pairs. Regression gate exits 0 on three consecutive runs.