Skip to content

Commit

Permalink
Add a better error message for ValueEnum macro (#61)
Browse files Browse the repository at this point in the history
- Replace runtimeClass with runtimeClass.getSimpleName
- Add a note for nested ValueEnums
  • Loading branch information
lloydmeta committed Aug 12, 2016
1 parent ad5c601 commit 8aa7cc2
Showing 1 changed file with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,16 @@ object ValueEnumMacros {
val lacksValueMemberStr = lacksValueMember.map(_.tree.symbol).mkString(", ")
c.abort(
c.enclosingPosition,
s"It looks like not all of the members have a literal/constant 'value:${classTag.runtimeClass}' declaration, namely: $lacksValueMemberStr."
s"""
|It looks like not all of the members have a literal/constant 'value:${classTag.runtimeClass.getSimpleName}' declaration, namely: $lacksValueMemberStr.
|
|This can happen if:
|
|- The aforementioned members have their `value` supplied by a variable, or otherwise defined as a method
|- ValueEnums are nested. This happens because constructor methods are not yet typed during macro expansion if they're nested.
|
|If none of the above apply to your case, it's likely you have discovered an issue with Enumeratum, so please file an issue :)
""".stripMargin
)
}
hasValueMember.collect {
Expand Down

0 comments on commit 8aa7cc2

Please sign in to comment.