-
Notifications
You must be signed in to change notification settings - Fork 276
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
Generalize with-chain wrapping for defs and type definitions #1132
Changes from 4 commits
2a04ef3
1873e71
3d06212
d9a481c
b60a53d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -9,3 +9,13 @@ | |
annotationOwnerLookUp: ScLiteral => Option[ | ||
PsiAnnotationOwner with PsiElement]): Option[PsiAnnotationOwner] = 1 | ||
} | ||
<<< #1133 | ||
implicit val catsStdInstancesForOption | ||
: Traverse[Option] with MonadError[Option, Unit] with Alternative[Option] | ||
with CommutativeMonad[Option] with CoflatMap[Option] = ??? | ||
>>> | ||
implicit val catsStdInstancesForOption: Traverse[Option] | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This may be more ambitious that you were planning for (so "no" is an acceptable answer), but while were fixing with chains, could we add a test case for? new A with B with C with D ... I've seen surprising behavior in these scenarios and I suspect fixing it likewise is a matter of adding another case to There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes no problem (I think) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I might need some help with this. I don't think this falls into the My thought is to treat this like the case tok @ FormatToken(_, right @ KwWith(), _) =>
rightOwner match {
+ // Anonymous template (new A with B { ... })
+ case template: Template if template.parent.exists(_.is[Term.New]) =>
+ val lastToken = template.tokens.last
+ binPackParentConstructorSplits(
+ Set(template),
+ lastToken,
+ 2
+ )
case template: Template =>
val hasSelfAnnotation = template.self.tokens.nonEmpty This almost works but it indents after every with
Any ideas? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I pushed the non-working change mentioned above. I'm assuming the fix is something analogous to the There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hmm, the changes seem unrelated enough to merit a separate PR. Your change already improves on the state-of-the-art so I propose you drop the last commit, we merge and move this case to another ticket. I'll need to locally play around with this case to see how would be best to solve it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. SGTM 👍. I rolled it back |
||
with MonadError[Option, Unit] | ||
with Alternative[Option] | ||
with CommutativeMonad[Option] | ||
with CoflatMap[Option] = ??? |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -85,3 +85,29 @@ type Row = | |
type a = b_! # D | ||
>>> | ||
type a = b_! #D | ||
<<< with-chain types #1125 | ||
type RequiredServices = Bag with | ||
SomeOtherService.RequiredServices | ||
with HasDynamicConfig with HasThrottles | ||
with HasThrowableNotifier | ||
>>> | ||
type RequiredServices = Bag | ||
with SomeOtherService.RequiredServices | ||
with HasDynamicConfig | ||
with HasThrottles | ||
with HasThrowableNotifier | ||
<<< abstract def #1125 | ||
trait NeedsServices { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This probably shouldn't be in There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
def services: Bag with | ||
SomeOtherService.RequiredServices | ||
with HasDynamicConfig with HasThrottles | ||
with HasThrowableNotifier | ||
} | ||
>>> | ||
trait NeedsServices { | ||
def services: Bag | ||
with SomeOtherService.RequiredServices | ||
with HasDynamicConfig | ||
with HasThrottles | ||
with HasThrowableNotifier | ||
} |
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.
I don't love this name but I wanted to change it to something more general than
SelfAnnotation
. Any suggestions?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 name is good 👍