From 82c4db686d07ae8e91f157f5c8b55a1a76917941 Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Mon, 5 May 2014 18:34:59 +0200 Subject: Pos tests t17xx - t19xx --- tests/pos/t1974.scala | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) create mode 100644 tests/pos/t1974.scala (limited to 'tests/pos/t1974.scala') diff --git a/tests/pos/t1974.scala b/tests/pos/t1974.scala new file mode 100644 index 000000000..3f4d41e7f --- /dev/null +++ b/tests/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) +} -- cgit v1.2.3