diff options
author | Martin Odersky <odersky@gmail.com> | 2014-01-15 19:04:07 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2014-01-15 19:04:07 +0100 |
commit | 1f604efa08bcef3604a2d6c373dc78b0730188fb (patch) | |
tree | 8e23d014e7f27e33c8cbd72ac76c4b5f9faaefd7 /tests/pos/typers.scala | |
parent | 24dff883751fb5a0920f8889e6570914a0f73a26 (diff) | |
download | dotty-1f604efa08bcef3604a2d6c373dc78b0730188fb.tar.gz dotty-1f604efa08bcef3604a2d6c373dc78b0730188fb.tar.bz2 dotty-1f604efa08bcef3604a2d6c373dc78b0730188fb.zip |
Tweak to typing of function values.
We now propagte the expected function result type (if it exists) into the function body even if it not fully defined.
Diffstat (limited to 'tests/pos/typers.scala')
-rw-r--r-- | tests/pos/typers.scala | 21 |
1 files changed, 14 insertions, 7 deletions
diff --git a/tests/pos/typers.scala b/tests/pos/typers.scala index 4edd7c2be..cb3bbc590 100644 --- a/tests/pos/typers.scala +++ b/tests/pos/typers.scala @@ -7,15 +7,17 @@ object typers { val names = List("a", "b", "c") val ints = List(1, 2, 3) - - for ((name, n) <- (names, ints).zipped) - println(name.length + n) - - val entries = Array("abc", "def") - for ((x, i) <- entries.zipWithIndex) - println(x) + object Inference { + + for ((name, n) <- (names, ints).zipped) + println(name.length + n) + + def double(x: Char): String = s"$x$x" + "abc" flatMap double + + } object Eta { def fun(x: Int): Int = x + 1 @@ -128,6 +130,11 @@ object typers { arr(i).charAt(0) val x = new ArrayBuffer[String] // testing overloaded polymorphic constructors + + val entries = Array("abc", "def") + + for ((x, i) <- entries.zipWithIndex) + println(x) } object SeqExtractors { |