-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Make the member trees search use an iterator so we only grab the very first one
- Loading branch information
Showing
2 changed files
with
28 additions
and
2 deletions.
There are no files selected for viewing
25 changes: 25 additions & 0 deletions
25
enumeratum-core/src/test/scala/enumeratum/values/Compilation.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package enumeratum.values | ||
|
||
/** | ||
* Created by Lloyd on 1/4/17. | ||
* | ||
* Copyright 2017 | ||
*/ | ||
// From https://github.com/lloydmeta/enumeratum/issues/96 | ||
|
||
sealed abstract class A private (val value: Int) extends IntEnumEntry { | ||
val text: String | ||
} | ||
|
||
object A extends IntEnum[A] { | ||
|
||
val values = findValues | ||
|
||
case object A1 extends A(1) { | ||
val text = identity("something") // Error:(9, 16) object A1 has a value with the wrong type: something:class java.lang.String, instead of int. | ||
//val text = "something" | ||
} | ||
|
||
def identity(str: String) = str | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters