todokr / zugen

An architecture diagram generator for Scala project.
Eclipse Public License 2.0
77 stars 7 forks source link

Literal types are not supported. #22

Closed FunFunFine closed 2 years ago

FunFunFine commented 3 years ago

Describe the bug Currently zugen task fails on literal types:

 final case class Success(id: JsonRpcId, result: Json, jsonrpc: String = "2.0")
processing... src/main/scala/tochka/ul/api/jsonrpc/JsonRpcResponse.scala
[error] stack trace is suppressed; run last Compile / zugen for the full output
[error] (Compile / zugen) <input>:11: error: identifier expected but string constant found
[error]   final case class Success(id: JsonRpcId, result: Json, jsonrpc: "2.0" = "2.0")
[error]    

Or for integer:

 type Code = String Refined (Forall[Digit] And Size[Equal[9]])
processing... src/main/scala/tochka/ul/api/jsonrpc/TaxRiskCheck.scala
[error] stack trace is suppressed; run last Compile / zugen for the full output
[error] (Compile / zugen) <input>:23: error: identifier expected but integer constant found
[error]   type CustomerCode = String Refined (Forall[Digit] And Size[Equal[9]])
[error]                                                                    ^

To Reproduce

Define any literal type value: val foo: "aaa" = "aaa"

Expected behavior Zugen completes successfully.

todokr commented 2 years ago

@FunFunFine Thank you for reporting and sorry for late reply!

Now I pushed a commit to handle literal types correctly.

Also I'll publish 2021.12.0 contains this fix soon.