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
Tail calls within catch blocks not optimized #1672
Comments
Imported From: https://issues.scala-lang.org/browse/SI-1672?orig=1
|
@eengbrec said: |
@dragos said: |
@dragos said: |
@retronym said: |
Erik Allik (eallik) said (edited on Mar 6, 2014 5:03:33 AM UTC): @tailrec
def retryOn[T](thCls: Class[_ <: Throwable], maxTimes: Int)(block: => T): T = {
try block
catch {
case t: Throwable if thCls.isInstance(t) && maxTimes > 0 =>
retryOn(thCls, maxTimes - 1)(block)
}
} ...because currently I'm getting a compile error. It works when the guard is turned into {code}case ... => if (...) ... else throw t{code} |
@adriaanm said: |
The text was updated successfully, but these errors were encountered: