diff options
author | Martin Odersky <odersky@gmail.com> | 2013-09-26 12:03:10 +0200 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-09-26 12:43:55 +0200 |
commit | 54acd26dcf377e2eb2a474399894e10cfd4322f5 (patch) | |
tree | a275062a8cab9e81b401a4745400f8db71fed1ae /tests/pos/inferred.scala | |
parent | b7f5aa30383730dc1d2b34f9773695d0f5669bcd (diff) | |
download | dotty-54acd26dcf377e2eb2a474399894e10cfd4322f5.tar.gz dotty-54acd26dcf377e2eb2a474399894e10cfd4322f5.tar.bz2 dotty-54acd26dcf377e2eb2a474399894e10cfd4322f5.zip |
Added isRef method to determine whether a type is a typeref that refers to a symbol.
The alternative (tpe eq sym.typeConstructor) does not work because types are not unique.
The alternative (tpe.typeSymbol == sym) does not work because other types than TypeRefs have typeSymbols.
Diffstat (limited to 'tests/pos/inferred.scala')
-rw-r--r-- | tests/pos/inferred.scala | 15 |
1 files changed, 11 insertions, 4 deletions
diff --git a/tests/pos/inferred.scala b/tests/pos/inferred.scala index 48889dc48..29e1345c1 100644 --- a/tests/pos/inferred.scala +++ b/tests/pos/inferred.scala @@ -1,11 +1,15 @@ class List[+T] { - def prepend [U >: T] (x: U): List[U] = null + def prepend [U >: T] (x: U): List[U] = null//new Cons(x, this) + + def map[U](f: T => U): List[U] = null } object Nil extends List[Nothing] +//class Cons[T](hd: T, tl: List[T]) extends List[T] + object Inferred { @@ -27,8 +31,11 @@ object Inferred { val n2 = scala.collection.immutable.Nil - val ints2: scala.collection.immutable.List[String] = "abc" :: n2 + val ss2: scala.collection.immutable.List[String] = "abc" :: n2 - val ints3 = "abc" :: n2 - + val ss3 = "abc" :: n2 + + def closure = ((x: Int) => x) + + val ints2 = ints map closure }
\ No newline at end of file |