Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Infinite recursion between Absolute.range and Absolute.approximateMidPoint #47

Closed
AverageHelper opened this issue May 17, 2020 · 2 comments

Comments

@AverageHelper
Copy link

The Absolute.approximateMidPoint and Absolute.range getters seem to call each other. I'm running an app which corroborates this.

In Time/5. Absolute Values/Absolute.swift:

public var range: Range<Instant> {
    let date = approximateMidPoint.date  <--
    ...
}

And in Time/5. Absolute Values/Absolute+Internal.swift:

...
internal var approximateMidPoint: Instant {
    let r = self.range  <--
    ...
}

One simply has to call Absolute(...).range to get a hang and then a crash.

The implementations of these seem to make sense when considered independent of each other, but the fact that they depend on each other recursively is an issue.

I'm not enough of an expert yet on working with Foundation.Date or Time to know quite what to do to split these, but I can at least cobble together some test cases to demonstrate it.

@davedelong
Copy link
Owner

Yep, this is a dupe of #19 and is fixed on the master branch.

@AverageHelper
Copy link
Author

Ah, that works then. Thank you!

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

No branches or pull requests

2 participants