Skip to content

Handle empty-interval edge case in find_intersections - #201

Open
haberdashPI wants to merge 9 commits into
invenia:masterfrom
haberdashPI:dfl/empty-find-interval
Open

Handle empty-interval edge case in find_intersections#201
haberdashPI wants to merge 9 commits into
invenia:masterfrom
haberdashPI:dfl/empty-find-interval

Conversation

@haberdashPI

@haberdashPI haberdashPI commented Oct 6, 2022

Copy link
Copy Markdown
Contributor

Closes #200

Title says it all. This fix also will address some edge cases where find_intersections would throw a StackOverflowError when passed an incorrect type.

Small aside: When I ran tests locally there was a failure on 1.8 (had to run on 1.7). Looks to be related to a now closed issue in 1.8.

@haberdashPI
haberdashPI requested a review from omus as a code owner October 6, 2022 15:55
@codecov

codecov Bot commented Oct 6, 2022

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 75.00000% with 1 line in your changes missing coverage. Please review.
✅ Project coverage is 84.35%. Comparing base (2999a5d) to head (8eec69f).
⚠️ Report is 29 commits behind head on master.

Files with missing lines Patch % Lines
src/interval_sets.jl 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master     #201      +/-   ##
==========================================
+ Coverage   84.31%   84.35%   +0.03%     
==========================================
  Files          12       12              
  Lines         848      850       +2     
==========================================
+ Hits          715      717       +2     
  Misses        133      133              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ericphanson ericphanson left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

closes #200?

I suggested arranging the dispatches slightly differently there, which I think has some advantages. With this version:

  • Empty checks are repeated in two methods
  • errors depend on contents, not type: if the array has the wrong type and is empty, no error. Non-empty, and error

Comment thread src/interval_sets.jl Outdated
Comment thread src/interval_sets.jl
Comment thread test/sets.jl Outdated
Comment thread src/interval_sets.jl
Comment thread test/anchoredinterval.jl Outdated

# https://github.com/JuliaLang/julia/issues/33882
@test r isa StepRangeLen
@test r isa (VERSION < v"1.8" ? StepRangeLen : StepRange)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Best to make these fixes as separate PRs so they can be merged faster

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After looking into it I think this fix is incorrect. I've made a new fix in #204

Suggested change
@test r isa (VERSION < v"1.8" ? StepRangeLen : StepRange)
@test r isa StepRangeLen

@omus omus mentioned this pull request Oct 18, 2022
@haberdashPI
haberdashPI force-pushed the dfl/empty-find-interval branch from ffa9a1a to 375dd59 Compare October 21, 2022 20:33
@haberdashPI
haberdashPI requested a review from omus October 25, 2022 14:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

stackoverflow from recursive call in find_intersections

3 participants