My workaround:

..in package object ...
  def Rx(r: Receive): Receive = r

//no warnings!
class Act extends Actor {
  val x: Receive = Rx {
    case "hi" => sender ! "hello"
  }

  val y: Receive = Rx {
    case "bye" => sender ! "farewell"
  }

  def receive = Rx {x orElse y}
}

On 23 September 2014 17:29, Tim Pigden <[email protected]> wrote:

> The following example:
>
> class TestPF extends Actor {
>
>   val x: Receive = {
>     case "hi" => sender ! "hello"
>   }
>
>   val y: Receive = {
>     case "bye" => sender ! "farewell"
>   }
>
>   def receive = { x orElse y }
>
> }
>
> gets a warning
> Warning:(18, 28) a type was inferred to be `Any`; this may indicate a
> programming error.
>   def receive = { x orElse y }
>                            ^
>
> Am I doing something wrong? I thought this was the intended use pattern.
> Can I make these warnings go away?
>
> --
> >>>>>>>>>> Read the docs: http://akka.io/docs/
> >>>>>>>>>> Check the FAQ:
> http://doc.akka.io/docs/akka/current/additional/faq.html
> >>>>>>>>>> Search the archives: https://groups.google.com/group/akka-user
> ---
> You received this message because you are subscribed to the Google Groups
> "Akka User List" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/akka-user.
> For more options, visit https://groups.google.com/d/optout.
>

-- 
>>>>>>>>>>      Read the docs: http://akka.io/docs/
>>>>>>>>>>      Check the FAQ: 
>>>>>>>>>> http://doc.akka.io/docs/akka/current/additional/faq.html
>>>>>>>>>>      Search the archives: https://groups.google.com/group/akka-user
--- 
You received this message because you are subscribed to the Google Groups "Akka 
User List" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/akka-user.
For more options, visit https://groups.google.com/d/optout.

Reply via email to