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

wrong “fruitless type test” warning #6537

Closed
scabug opened this issue Oct 18, 2012 · 5 comments
Closed

wrong “fruitless type test” warning #6537

scabug opened this issue Oct 18, 2012 · 5 comments
Assignees
Milestone

Comments

@scabug
Copy link

scabug commented Oct 18, 2012

The following appeared in 2.10.0-RC1 in the Akka build (was not present in 2.10.0-M7):

[warn] /Users/rkuhn/comp/akka/akka-actor/src/main/scala/akka/actor/dungeon/Children.scala:124: fruitless type test: a value of type akka.actor.dungeon.ChildrenContainer.SuspendReason cannot also be a akka.actor.dungeon.ChildrenContainer.WaitingForChildren
[warn]     case TerminatingChildrenContainer(_, _, w: WaitingForChildren)  w
[warn]                                                ^

You can see the full file here: https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/actor/dungeon/Children.scala#L124

And the traits/classes involved are defined here: https://github.com/akka/akka/blob/master/akka-actor/src/main/scala/akka/actor/dungeon/ChildrenContainer.scala#L45

My attempts at minimizing it have not been successful: I found that I can sometimes provoke it with the following two files in Eclipse, seeing the warning from the PC (i.e. not the build compiler), and the warning then goes away after a clean build:

package tester

object PatMatWarning {

  sealed trait X
  case object X1 extends X
  case object X2 extends X with Y

  trait Y

  case class Wrap(x: X)

}
package tester

class PatMatWarning2 {

  import PatMatWarning.{ Wrap, Y }

  def f(w: Wrap) = w match {
    case Wrap(_: Y) 
  }

}

Having all within the same file never triggered the warning for me.

@scabug
Copy link
Author

scabug commented Oct 18, 2012

Imported From: https://issues.scala-lang.org/browse/SI-6537?orig=1
Reporter: @rkuhn
Affected Versions: 2.10.0-M7
Other Milestones: 2.10.0

@scabug
Copy link
Author

scabug commented Oct 18, 2012

@paulp said:
Based on that characterization I think it's only going to need a .initialize somewhere. isSealed tells lies if the symbol isn't initialized yet. Or there may be a deeper problem with sealed tracking, such that it is giving me an incomplete set of children. Or, there could just be a regular bug which is actually my fault, but obviously that is the least likely scenario.

@scabug
Copy link
Author

scabug commented Oct 18, 2012

@paulp said:
Fix pending.

@scabug
Copy link
Author

scabug commented Oct 18, 2012

@paulp said:
scala/scala#1509

@scabug
Copy link
Author

scabug commented Oct 26, 2012

@paulp said:
6daf9c6

@scabug scabug closed this as completed Oct 26, 2012
@scabug scabug added this to the 2.10.0-RC1 milestone Apr 7, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants