From cf10e28a54aaeab124f9a939f71da7e09d299bcb Mon Sep 17 00:00:00 2001 From: Martin Odersky Date: Tue, 14 Feb 2017 11:17:53 +0100 Subject: Change enumeration members. Based on the discussion in #1970, enumeration objects now have three public members: - valueOf: Map[Int, E] - withName: Map[String, E] - values: Iterable[E] Also, the variance of case type parameters is now the same as in the corresponding type parameter of the enum class. --- tests/run/generic/Color.scala | 3 ++- tests/run/generic/SearchResult.scala | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) (limited to 'tests') diff --git a/tests/run/generic/Color.scala b/tests/run/generic/Color.scala index 183f18349..7f2a8818c 100644 --- a/tests/run/generic/Color.scala +++ b/tests/run/generic/Color.scala @@ -13,7 +13,8 @@ sealed trait Color extends Enum object Color { private val $values = new runtime.EnumValues[Color] - def valueOf: Int => Color = $values + def valueOf = $values.fromInt + def withName = $values.fromName def values = $values.values private def $new(tag: Int, name: String) = new Color { diff --git a/tests/run/generic/SearchResult.scala b/tests/run/generic/SearchResult.scala index d39ee89a0..d4380a072 100644 --- a/tests/run/generic/SearchResult.scala +++ b/tests/run/generic/SearchResult.scala @@ -14,7 +14,8 @@ sealed trait SearchResult extends Enum object SearchResult extends { private val $values = new runtime.EnumValues[SearchResult] - def valueOf: Int => SearchResult = $values + def valueOf = $values.fromInt + def withName = $values.fromName def values = $values.values private def $new(tag: Int, name: String) = new SearchResult { -- cgit v1.2.3