diff options
Diffstat (limited to 'tests/untried/pos/t1974.scala')
-rw-r--r-- | tests/untried/pos/t1974.scala | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/untried/pos/t1974.scala b/tests/untried/pos/t1974.scala new file mode 100644 index 000000000..3f4d41e7f --- /dev/null +++ b/tests/untried/pos/t1974.scala @@ -0,0 +1,20 @@ +object Broken { + private var map = Map[Class[_], String]() + + def addToMap(c : Class[_], s : String) = map += (c -> s) + def fetch(c : Class[_]) = map(c) +} + +object Works { + private var map = Map[Class[_], String]() + + def addToMap(c : Class[_], s : String) = map += ((c, s)) + def fetch(c : Class[_]) = map(c) +} + +object Works2 { + private var map = Map[Class[_], String]() + + def addToMap(c : Class[_], s : String) = map += ((c : Class[_]) -> s) + def fetch(c : Class[_]) = map(c) +} |