From 10c745ae976f8e488dcde66587d0741890112c13 Mon Sep 17 00:00:00 2001 From: Lukas Rytz Date: Mon, 3 Nov 2014 17:23:05 +0100 Subject: Fix default value for ScalaVersionSetting The default value was NoScalaVersion before, because tryToSet (where the default was supposed to be set) is not called at all if the option is not specified. The initial value of Xmigration is set to NoScalaVersion (which it was before, the AnyScalaVersion argument was ignored). AnyScalaVersion would be wrong, it would give a warning in `Map(1 -> "eis").values` if the option was not specified. See tests. --- test/files/run/xMigration.check | 49 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) create mode 100644 test/files/run/xMigration.check (limited to 'test/files/run/xMigration.check') diff --git a/test/files/run/xMigration.check b/test/files/run/xMigration.check new file mode 100644 index 0000000000..378f7bb6c3 --- /dev/null +++ b/test/files/run/xMigration.check @@ -0,0 +1,49 @@ +Type in expressions to have them evaluated. +Type :help for more information. + +scala> Map(1 -> "eis").values // no warn +res0: Iterable[String] = MapLike(eis) + +scala> :setting -Xmigration:none + +scala> Map(1 -> "eis").values // no warn +res1: Iterable[String] = MapLike(eis) + +scala> :setting -Xmigration:any + +scala> Map(1 -> "eis").values // warn +:8: warning: method values in trait MapLike has changed semantics in version 2.8.0: +`values` returns `Iterable[B]` rather than `Iterator[B]`. + Map(1 -> "eis").values // warn + ^ +res2: Iterable[String] = MapLike(eis) + +scala> :setting -Xmigration:2.8 + +scala> Map(1 -> "eis").values // no warn +res3: Iterable[String] = MapLike(eis) + +scala> :setting -Xmigration:2.7 + +scala> Map(1 -> "eis").values // warn +:8: warning: method values in trait MapLike has changed semantics in version 2.8.0: +`values` returns `Iterable[B]` rather than `Iterator[B]`. + Map(1 -> "eis").values // warn + ^ +res4: Iterable[String] = MapLike(eis) + +scala> :setting -Xmigration:2.11 + +scala> Map(1 -> "eis").values // no warn +res5: Iterable[String] = MapLike(eis) + +scala> :setting -Xmigration // same as :any + +scala> Map(1 -> "eis").values // warn +:8: warning: method values in trait MapLike has changed semantics in version 2.8.0: +`values` returns `Iterable[B]` rather than `Iterator[B]`. + Map(1 -> "eis").values // warn + ^ +res6: Iterable[String] = MapLike(eis) + +scala> :quit -- cgit v1.2.3