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

Identify more statically resolved (effectively final) methods #51

Open
lrytz opened this issue Sep 23, 2015 · 1 comment
Open

Identify more statically resolved (effectively final) methods #51

lrytz opened this issue Sep 23, 2015 · 1 comment

Comments

@lrytz
Copy link
Member

lrytz commented Sep 23, 2015

trait TravLike { def map = ... }
sealed trait List extends TravLike { ... } // map is not overridden
final case class ::
final case object Nil
(l: List).map // can be inlined

we need to know that

  • the recevier is sealed
  • what are the children of the receiver
  • all children are final
  • none of the children overrides map

https://github.com/scala/scala/blob/2.12.x/src/compiler/scala/tools/nsc/backend/jvm/opt/CallGraph.scala#L293

@som-snytt
Copy link

relatedly scala/scala#10629 for tailrec

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

No branches or pull requests

3 participants