-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix 1375: Infinite loop in interpreter #1383
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
Conversation
/rebuild |
@kcsongor: Thanks for your contribution! Before we can accept your patch, you'll need to sign the Scala CLA at http://www.lightbend.com/contribute/cla/scala |
@smarter: thanks, I've signed it |
@@ -38,7 +39,7 @@ object SyntaxHighlighting { | |||
def apply(chars: Iterable[Char]): Vector[Char] = { | |||
var prev: Char = 0 | |||
var remaining = chars.toStream | |||
val newBuf = new StringBuilder | |||
val newBuf = new mutable.StringBuilder |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since there is no immutable StringBuilder
, this distinction feels slightly redundant.
Otherwise LGTM |
I've made the suggested changes, not sure if/how I can squash the commits in the github web editor |
You can't do it online, but you can do it locally with git and then push-force ( |
I wasn't near my own computer at the time, and I was hoping that I can squash them quickly, but anyway, it should be good now |
Great, thanks for the contribution :) |
The code example in #1375 caused the REPL to get in an infinite loop, and eventually terminate in an out of memory error.
The cause of this was the way the
/
character was handled, or more precisely, the character following a/
. Instead of peeking the next character, it was polled, and in case of a no match, was put back using the lazy stream cons, which doesn't play nicely with expressions of the formstream = n #:: stream
(or I should say it can be surprising).