-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add scala-styled lambdas rendering #373
add scala-styled lambdas rendering #373
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is another thing which is still missing. Currently we format prefixes and names in our own non-scala notation (there are some additional symbols, etc) we should take care of that aspect too.
override implicit lazy val r_TypeParam: Renderable[TypeParam] = new Renderable[TypeParam] { | ||
override def render(value: TypeParam): String = | ||
value.ref match { | ||
case n: NameReference if n.symName.name.forall(_.isDigit) => |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a heuristic which may fail. We need to preserve the context here and check the names against it. Also we might want to add more metadata into the model to simplify the logic here but that's undesirable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added LambdaParamNameMaker
to hold the logic for both creating param names and checking if a string is a param name in one place. Doesn't seem to me like a clean solution but can't think of any others except extra metadata in model
4a1e30a
to
f4ad8ef
Compare
This seems to be working, though it still looks like an ad-hoc solution. I would try one of two options:
|
…a-styled-lambda-rendering # Conflicts: # izumi-reflect/izumi-reflect/src/main/scala-2/izumi/reflect/macrortti/LightTypeTagImpl.scala # izumi-reflect/izumi-reflect/src/main/scala-3/izumi/reflect/TagMacro.scala # izumi-reflect/izumi-reflect/src/main/scala/izumi/reflect/macrortti/LightTypeTagRef.scala
f1b25c9
to
ac508a4
Compare
ac508a4
to
a811bbe
Compare
override def render(value: Boundaries): String = value match { | ||
case Boundaries.Defined(bottom, top) => | ||
(bottom.render(), top.render()) match { | ||
case (bottomRendered, topRendered) if bottomRendered == "scala.Nothing" => s"<: $topRendered" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is kinda dirty. We already have all the necessary constants in LightTypeTagInheritance
, please reuse them.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep, removed my hardcode
No description provided.