Skip to content

Instantly share code, notes, and snippets.

@mpilquist
Created July 2, 2014 16:06
Show Gist options
  • Save mpilquist/7f2c6efcf9916c6519a3 to your computer and use it in GitHub Desktop.
Save mpilquist/7f2c6efcf9916c6519a3 to your computer and use it in GitHub Desktop.
Spurious warning from -Xlint in Scala 2.11.1
› scala -Xlint
Welcome to Scala version 2.11.1 (Java HotSpot(TM) 64-Bit Server VM, Java 1.8.0).
Type in expressions to have them evaluated.
Type :help for more information.
scala> val x: PartialFunction[Any, Unit] = PartialFunction.empty
x: PartialFunction[Any,Unit] = <function1>
scala> val y: PartialFunction[Any, Unit] = PartialFunction.empty
y: PartialFunction[Any,Unit] = <function1>
scala> val z: PartialFunction[Any, Unit] = x orElse y
z: PartialFunction[Any,Unit] = <function1>
scala> type Receive = PartialFunction[Any, Unit]
defined type alias Receive
scala> val x: Receive = PartialFunction.empty
x: Receive = <function1>
scala> val y: Receive = PartialFunction.empty
y: Receive = <function1>
scala> val z: Receive = x orElse y
<console>:10: warning: a type was inferred to be `Any`; this may indicate a programming error.
val z: Receive = x orElse y
^
z: Receive = <function1>
scala>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment