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

Inlining fails due to imprecise type analysis #11874

Open
lrytz opened this issue Jan 31, 2020 · 0 comments
Open

Inlining fails due to imprecise type analysis #11874

lrytz opened this issue Jan 31, 2020 · 0 comments
Labels
Milestone

Comments

@lrytz
Copy link
Member

@lrytz lrytz commented Jan 31, 2020

trait Try
object Try {
  def apply(s: String): Try = Success(s)
}
case class Failure(e: Throwable) extends Try

class C {
  private def get(a: String): Unit = Try(a) match {
    case Failure(e: Exception) => 
    case Failure(e) => println(e.toString)
  }
}
$> scalac Test.scala -opt:l:inline -opt-inline-from:'**' -opt-warnings:_
Test.scala:10: warning: failed to determine if e should be inlined:
The method e()Ljava/lang/Throwable; could not be found in the class java/lang/Object or any of its parents.
    case Failure(e) => println(e.toString)
                 ^
one warning found

The issue is in TypeFlowInterpreter, a lub collapses to Object -> the method can not be found.

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

Successfully merging a pull request may close this issue.

None yet
1 participant
You can’t perform that action at this time.