According to SLS, a type in value definition(in method definition, too) is not determined by the local type inference, so
scala> val p = "hello"
p: String = hello
scala> val v = p : p.type
v: p.type = hello
seems ok, but
scala> def v = p : p.type
v: String
. Or SLS is wrong?