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

unchecked warning issued even after unchecked annotation added #7119

Closed
scabug opened this issue Feb 12, 2013 · 3 comments
Closed

unchecked warning issued even after unchecked annotation added #7119

scabug opened this issue Feb 12, 2013 · 3 comments
Assignees
Labels
Milestone

Comments

@scabug
Copy link

scabug commented Feb 12, 2013

The following:

package filter

import akka.actor.Actor

trait FilteringActor extends Actor {
  
  type Message
  
  def output: Message => Unit
  
  /** Default is to just forward everything. */
  override def receive = {
    case m: (Message @unchecked) => output(m)
  }

}

when compiled with -unchecked, produces:

type FilteringActor.this.Message @unchecked in type pattern FilteringActor.this.Message @unchecked is unchecked since it is eliminated by erasure
[warn]     case m: (Message @unchecked) => output(m)
[warn]                       ^
[warn] one warning found

I tried adding the parentheses around (Message @unchecked), but it makes no difference whether they are there or not.

@scabug
Copy link
Author

scabug commented Feb 12, 2013

Imported From: https://issues.scala-lang.org/browse/SI-7119?orig=1
Reporter: Robin Green (greenrd)
Affected Versions: 2.9.1

@scabug
Copy link
Author

scabug commented Feb 13, 2013

@adriaanm said:
this produces no warnings under -unchecked on 2.10.0 (drop the @unchecked and you do get one)

trait FilteringActor  {
  type Message

  def output: Message => Unit

  /** Default is to just forward everything. */
  def receive: PartialFunction[Message, Unit] = {
    case m: (Message @unchecked) => output(m)
  }
}

@scabug
Copy link
Author

scabug commented Feb 13, 2013

@adriaanm said:
Fixed in 2.10. (Typesafe is happy to backport fixes to 2.9 on a commercial basis, contributions welcome too, of course.)

@scabug scabug closed this as completed Feb 13, 2013
@scabug scabug added the patmat label Apr 7, 2017
@scabug scabug added this to the 2.10.0 milestone Apr 7, 2017
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