Ryan Hendrickson
unread,May 9, 2013, 2:35:09 PM5/9/13Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to scala-l...@googlegroups.com
I was surprised and delighted by a bug a coworker found today, which hinged on my assuming that surely value types can never contain non-value types. Here's a simplified version:
import scala.reflect.runtime.universe._
class A {
object B
}
class C {
val a = new A
val b = a.B
}
object Test extends App {
val cType = typeOf[C]
val bType = cType.member("b": TermName).typeSignatureIn(cType)
bType match {
case NullaryMethodType(_) =>
println("That's what I thought.")
case ExistentialType(_, NullaryMethodType(_)) =>
println("Huh???")
}
}
Is this a bug, or is it reasonable to expect that ExistentialType, a value type, can contain a NullaryMethodType, a non-value type?
(please forgive me my corporate legal disclaimer)
----------------------------------------
This message is intended exclusively for the individual(s) or entity to
which it is addressed. It may contain information that is proprietary,
privileged or confidential or otherwise legally exempt from disclosure.
If you are not the named addressee, you are not authorized to read,
print, retain, copy or disseminate this message or any part of it.
If you have received this message in error, please notify the sender
immediately by e-mail and delete all copies of the message.