diff options
author | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-05-12 18:30:53 +0200 |
---|---|---|
committer | Dmitry Petrashko <dmitry.petrashko@gmail.com> | 2015-05-12 18:30:53 +0200 |
commit | 89bacb9c25a58454ff1878e67f7ea07ffc8c269f (patch) | |
tree | 51f1ff6c66aebe1b6109b1cffcc2bb8e4cf760a3 /tests/pending/run/repl-colon-type.check | |
parent | a0fa33deafbea1bf53edc068c5ed9db5592822f9 (diff) | |
download | dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.tar.gz dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.tar.bz2 dotty-89bacb9c25a58454ff1878e67f7ea07ffc8c269f.zip |
Run tests as they were in scala.
Diffstat (limited to 'tests/pending/run/repl-colon-type.check')
-rw-r--r-- | tests/pending/run/repl-colon-type.check | 221 |
1 files changed, 221 insertions, 0 deletions
diff --git a/tests/pending/run/repl-colon-type.check b/tests/pending/run/repl-colon-type.check new file mode 100644 index 000000000..9898027c1 --- /dev/null +++ b/tests/pending/run/repl-colon-type.check @@ -0,0 +1,221 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> :type List[1, 2, 3] +<console>:1: error: identifier expected but integer literal found. + List[1, 2, 3] + ^ + +scala> :type List(1, 2, 3) +List[Int] + +scala> :type def foo[T](x: T) = List(x) +[T](x: T)List[T] + +scala> :type val bar = List(Set(1)) +List[scala.collection.immutable.Set[Int]] + +scala> :type lazy val bar = Set(Set(1)) +scala.collection.immutable.Set[scala.collection.immutable.Set[Int]] + +scala> :type def f[T >: Null, U <: String](x: T, y: U) = Set(x, y) +[T >: Null, U <: String](x: T, y: U)scala.collection.immutable.Set[Any] + +scala> :type def x = 1 ; def bar[T >: Null <: AnyRef](xyz: T) = 5 +=> Int <and> [T >: Null <: AnyRef](xyz: T)Int + +scala> + +scala> :type 5 +Int + +scala> :type val f = 5 +Int + +scala> :type lazy val f = 5 +Int + +scala> :type protected lazy val f = 5 +<console>:5: error: lazy value f cannot be accessed in object $iw + Access to protected value f not permitted because + enclosing object $eval in package $line13 is not a subclass of + object $iw where target is defined + lazy val $result = f + ^ + +scala> :type def f = 5 +=> Int + +scala> :type def f() = 5 +()Int + +scala> + +scala> :type def g[T](xs: Set[_ <: T]) = Some(xs.head) +[T](xs: Set[_ <: T])Some[T] + +scala> + +scala> // verbose! + +scala> :type -v List(1,2,3) filter _ +// Type signature +(Int => Boolean) => List[Int] + +// Internal Type structure +TypeRef( + TypeSymbol(abstract trait Function1[-T1, +R] extends AnyRef) + args = List( + TypeRef( + TypeSymbol(abstract trait Function1[-T1, +R] extends AnyRef) + args = List( + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) + TypeRef( + TypeSymbol(final abstract class Boolean extends AnyVal) + ) + ) + ) + TypeRef( + TypeSymbol( + sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable + + ) + args = List( + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) + ) + ) + ) +) + +scala> :type -v def f[T >: Null, U <: String](x: T, y: U) = Set(x, y) +// Type signature +[T >: Null, U <: String](x: T, y: U)scala.collection.immutable.Set[Any] + +// Internal Type structure +PolyType( + typeParams = List(TypeParam(T >: Null), TypeParam(U <: String)) + resultType = MethodType( + params = List(TermSymbol(x: T), TermSymbol(y: U)) + resultType = TypeRef( + TypeSymbol( + abstract trait Set[A] extends Iterable[A] with Set[A] with GenericSetTemplate[A,scala.collection.immutable.Set] with SetLike[A,scala.collection.immutable.Set[A]] with Parallelizable[A,scala.collection.parallel.immutable.ParSet[A]] + + ) + args = List(TypeRef(TypeSymbol(abstract class Any extends ))) + ) + ) +) + +scala> :type -v def x = 1 ; def bar[T >: Null <: AnyRef](xyz: T) = 5 +// Type signature +=> Int <and> [T >: Null <: AnyRef](xyz: T)Int + +// Internal Type structure +OverloadedType( + alts = List( + NullaryMethodType( + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) + ) + PolyType( + typeParams = List(TypeParam(T >: Null <: AnyRef)) + resultType = MethodType( + params = List(TermSymbol(xyz: T)) + resultType = TypeRef( + TypeSymbol(final abstract class Int extends AnyVal) + ) + ) + ) + ) +) + +scala> :type -v Nil.combinations _ +// Type signature +Int => Iterator[List[Nothing]] + +// Internal Type structure +TypeRef( + TypeSymbol(abstract trait Function1[-T1, +R] extends AnyRef) + args = List( + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) + TypeRef( + TypeSymbol( + abstract trait Iterator[+A] extends TraversableOnce[A] + ) + args = List( + TypeRef( + TypeSymbol( + sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable + + ) + args = List( + TypeRef( + TypeSymbol(final abstract class Nothing extends Any) + ) + ) + ) + ) + ) + ) +) + +scala> :type -v def f[T <: AnyVal] = List[T]().combinations _ +// Type signature +[T <: AnyVal]=> Int => Iterator[List[T]] + +// Internal Type structure +PolyType( + typeParams = List(TypeParam(T <: AnyVal)) + resultType = NullaryMethodType( + TypeRef( + TypeSymbol(abstract trait Function1[-T1, +R] extends AnyRef) + args = List( + TypeRef(TypeSymbol(final abstract class Int extends AnyVal)) + TypeRef( + TypeSymbol( + abstract trait Iterator[+A] extends TraversableOnce[A] + ) + args = List( + TypeRef( + TypeSymbol( + sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable + + ) + args = List(TypeParamTypeRef(TypeParam(T <: AnyVal))) + ) + ) + ) + ) + ) + ) +) + +scala> :type -v def f[T, U >: T](x: T, y: List[U]) = x :: y +// Type signature +[T, U >: T](x: T, y: List[U])List[U] + +// Internal Type structure +PolyType( + typeParams = List(TypeParam(T), TypeParam(U >: T)) + resultType = MethodType( + params = List(TermSymbol(x: T), TermSymbol(y: List[U])) + resultType = TypeRef( + TypeSymbol( + sealed abstract class List[+A] extends AbstractSeq[A] with LinearSeq[A] with Product with GenericTraversableTemplate[A,List] with LinearSeqOptimized[A,List[A]] with Serializable + + ) + args = List(TypeParamTypeRef(TypeParam(U >: T))) + ) + ) +) + +scala> + +scala> // SI-7132 - :type doesn't understand Unit + +scala> :type () +Unit + +scala> :type println("side effect!") +Unit + +scala> :quit |