diff options
author | Martin Odersky <odersky@gmail.com> | 2013-11-15 12:25:13 +0100 |
---|---|---|
committer | Martin Odersky <odersky@gmail.com> | 2013-11-15 12:25:13 +0100 |
commit | 18da7faf93ffaefa0ee7e37211c740c1f34ddfa2 (patch) | |
tree | 272e28de24a61720d8cf278124c325afdfc0823c /tests/pos/Coder.scala | |
parent | 7a9e632c64865084e6e8559a0e6ea90e2b706a8b (diff) | |
download | dotty-18da7faf93ffaefa0ee7e37211c740c1f34ddfa2.tar.gz dotty-18da7faf93ffaefa0ee7e37211c740c1f34ddfa2.tar.bz2 dotty-18da7faf93ffaefa0ee7e37211c740c1f34ddfa2.zip |
Tweaks to adaptation and interpolation
1. Needed to interpolate aftyer implicit parameyters are added.
2. Also needed to avoid constraining typevars if compared against selection proto.
Original coder example now typechecks.
Diffstat (limited to 'tests/pos/Coder.scala')
-rw-r--r-- | tests/pos/Coder.scala | 6 |
1 files changed, 2 insertions, 4 deletions
diff --git a/tests/pos/Coder.scala b/tests/pos/Coder.scala index 73e2542c0..cb6464e8b 100644 --- a/tests/pos/Coder.scala +++ b/tests/pos/Coder.scala @@ -38,14 +38,12 @@ class Coder(words: List[String]) { def encode(number: String): Set[List[String]] = if (number.isEmpty) Set(Nil) else { - val xs = (for { + for { splitPoint <- 1 to number.length word <- wordsForNum(number take splitPoint) rest <- encode(number drop splitPoint) } yield word :: rest - ).toSet - xs//.toSet - } + }.toSet /** Maps a number to a list of all word phrases that can represent it */ def translate(number: String): Set[String] = encode(number) map (_ mkString " ") |