diff options
Diffstat (limited to 'tests')
-rw-r--r-- | tests/pos/inferred.scala | 5 | ||||
-rw-r--r-- | tests/pos/sigs.scala | 21 |
2 files changed, 23 insertions, 3 deletions
diff --git a/tests/pos/inferred.scala b/tests/pos/inferred.scala index 441ae9650..525848541 100644 --- a/tests/pos/inferred.scala +++ b/tests/pos/inferred.scala @@ -16,13 +16,12 @@ object NIL extends LIST[Nothing] { def tail = ??? } -class CONS[T](hd: T, tl: LIST[T]) extends LIST[T] { +class CONS[U](hd: U, tl: LIST[U]) extends LIST[U] { def isEmpty = false - def head = hd + def head: U = hd def tail = tl } - object Inferred { def foo[T](x: T): T = x diff --git a/tests/pos/sigs.scala b/tests/pos/sigs.scala new file mode 100644 index 000000000..4b91015ee --- /dev/null +++ b/tests/pos/sigs.scala @@ -0,0 +1,21 @@ +object sigs { + + var x = 7 * 9 + + class Base { + + def foo(x: Int): Any = 33 + + def foo: Object = "x" + + } + + class Sub extends Base { + + override def foo = "abc" + + override def foo(x: Int) = "abc" + } + + +}
\ No newline at end of file |