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

-Yvirtpatmat does not optimize tail calls #5394

Closed
scabug opened this issue Jan 20, 2012 · 4 comments
Closed

-Yvirtpatmat does not optimize tail calls #5394

scabug opened this issue Jan 20, 2012 · 4 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Jan 20, 2012

The following tail recursive function is not optimized when using -Yvirtpatmat

def f[T](l: List[T]): Int = l match { case x :: xs => f(xs) case Nil => 0 }
f(List.fill(10000)(0))

will cause a stack overflow.

Also when using @annotation.tailrec the compiler will report that f contains a call not in tail position.

@scabug
Copy link
Author

scabug commented Jan 20, 2012

Imported From: https://issues.scala-lang.org/browse/SI-5394?orig=1
Reporter: huynhjl
Affected Versions: 2.10.0
Other Milestones: 2.10.0

@scabug
Copy link
Author

scabug commented May 6, 2012

@retronym said:
Fixed in scala/scala@cd3d342. I'm not sure if there is a test case.

@scabug
Copy link
Author

scabug commented May 12, 2012

@soc said:
Now there is: scala/scala#543

Thanks!

@scabug
Copy link
Author

scabug commented May 14, 2012

@soc said:
Closing after test is merged in scala/scala@5797aab.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants