Commit 7ff5723b

7ff5723b542bMerged

Yukihiro "Matz" Matsumoto <[email protected]> · 5 months ago · 2 files · ~2 modified

Description

Range#overlap?

(a..b).overlap?(c..d) tests whether two integer ranges intersect, using each range's exclusive-end-adjusted bounds. With the existing depth-bounded flatten(n) this completes the range/flatten coverage test.

Co-Authored-By: Claude Opus 4.8 (1M context) [email protected]

Details

Commit
7ff5723b542b
Parent
5e9fea3869bb

src/analyze.cmodifiedView file

@@ -551,7 +551,8 @@
551551 if (!strcmp(name, "to_a") || !strcmp(name, "minmax")) return TY_INT_ARRAY;
552552 if (!strcmp(name, "include?") || !strcmp(name, "member?") ||
553553 !strcmp(name, "cover?") || !strcmp(name, "exclude_end?") ||
554- !strcmp(name, "eql?") || !strcmp(name, "==") || !strcmp(name, "!=")) return TY_BOOL;
554+ !strcmp(name, "eql?") || !strcmp(name, "==") || !strcmp(name, "!=") ||
555+ !strcmp(name, "overlap?")) return TY_BOOL;
555556 if (!strcmp(name, "step")) return TY_INT_ARRAY;
556557 if (!strcmp(name, "each") && nt_ref(nt, id, "block") < 0) return TY_INT_ARRAY;
557558 if (!strcmp(name, "sum") || !strcmp(name, "min") || !strcmp(name, "max") ||