Skip to content

Fix/capturedvars #354

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

Merged
merged 3 commits into from
Feb 10, 2015
Merged

Fix/capturedvars #354

merged 3 commits into from
Feb 10, 2015

Conversation

odersky
Copy link
Contributor

@odersky odersky commented Feb 10, 2015

Review by @sjrd

Create an object Util for utility methods that are used in several places.
@odersky
Copy link
Contributor Author

odersky commented Feb 10, 2015

I accidentally slipped another change into this PR (Make line search logic in SourcePositions generally available). But that's OK. We want to do that anyway.

* as the first search point, otherwise use
* `candidates.length/2`.
* @pre candidates is sorted
* @pre candidates(0) <= x
Copy link
Member

Choose a reason for hiding this comment

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

The second precondition should not be there, since you specify what happens if it's not true, i.e., the method must return -1. (as opposed to: it crashes or loops indefinitely)

@sjrd
Copy link
Member

sjrd commented Feb 10, 2015

That's all I have. LGTM for the commit about the mutable flag.

@odersky
Copy link
Contributor Author

odersky commented Feb 10, 2015

Thanks for the quick review!

odersky added a commit that referenced this pull request Feb 10, 2015
@odersky odersky merged commit 92013ab into scala:master Feb 10, 2015
if (x < candidates(mid))
recur(lo, mid - 1, (lo + mid - 1) / 2)
else if (mid + 1 < candidates.length && x >= candidates(mid + 1))
recur(mid + 1, hi, (mid + 1 + hi) / 2)
Copy link
Member

Choose a reason for hiding this comment

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

This is prone to overflow (http://googleresearch.blogspot.com.au/2006/06/extra-extra-read-all-about-it-nearly.html).

Of course we're unlikely to deal with a source file long enough to hit the problem :)

@allanrenucci allanrenucci deleted the fix/capturedvars branch December 14, 2017 19:22
tgodzik added a commit to tgodzik/scala3 that referenced this pull request Apr 29, 2025
Backport "improvement: Support using directives in worksheets" to 3.3 LTS
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.

3 participants