|
Scala Programming Language
»
Scala
[scala] Type definitions within blocks
View:
Threaded
Chronologically
All Messages
New views
1 Messages —
Rating Filter:
0
1
2
3
4
5
Alert me
[scala] Type definitions within blocks
by nikov
:: Rate this Message:
Reply to Author
|
View Threaded
|
Show Only this Message
Hi,
Consider the following definitions:
//////////////////////////////////
class C[T](val x : T)
object A {
def f[T](x : T) = {
type S = T
new C[S](x)
}
}
//////////////////////////////////
scala> A.f(1)
res4: C[S] = C@126a408
So, type S escapes from the block. According to SLS, 6.11 Blocks, I
would expect that the type A.f(1) is C[_ >: Int <: Int]. Is it a bug?
Thanks,
Vladimir
Free embeddable forum
powered by
Nabble
Forum Help