-
Notifications
You must be signed in to change notification settings - Fork 440
Fix spacing around <
, >
, *
, !
and ?
#1164
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
Conversation
eace5a9
to
2928570
Compare
@swift-ci please test |
36dc856
to
6656208
Compare
<
and >
and *
<
, >
, *
, !
and ?
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’ve got a few test cases that I think would be interesting and suspect that some of them will break with your changes 😬 Sorry.
myOptional!.someProperty
lhs < rhs
lhs > rhs
(lhs1, lhs2) < (rhs1, rhs2)
MyGeneric<String>!
(an implicitly unwrapped generic type)!(true)
If you want to fix the formatting of <
in generics, I think it might need to be explicitly done inside the generic parameter clause. I don’t think we’ve got any precedence for that though.
CodeGeneration/Sources/generate-swiftbasicformat/BasicFormatFile.swift
Outdated
Show resolved
Hide resolved
CodeGeneration/Sources/generate-swiftbasicformat/BasicFormatFile.swift
Outdated
Show resolved
Hide resolved
c64b8c7
to
4922721
Compare
Add test cases for
|
4922721
to
e7abba8
Compare
@ahoppen I've added tests cases with the examples you suggested. It seems to work. 😬 |
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.
Sorry, I’ve got some more thoughts inline. I hope that we can converge on a solution soon.
CodeGeneration/Sources/generate-swiftsyntax/templates/basicformat/BasicFormatFile.swift
Outdated
Show resolved
Hide resolved
CodeGeneration/Sources/generate-swiftsyntax/templates/basicformat/BasicFormatFile.swift
Outdated
Show resolved
Hide resolved
CodeGeneration/Sources/generate-swiftsyntax/templates/basicformat/BasicFormatFile.swift
Outdated
Show resolved
Hide resolved
CodeGeneration/Sources/generate-swiftsyntax/templates/basicformat/BasicFormatFile.swift
Outdated
Show resolved
Hide resolved
CodeGeneration/Sources/generate-swiftsyntax/templates/basicformat/BasicFormatFile.swift
Outdated
Show resolved
Hide resolved
17081bb
to
4e025d2
Compare
CodeGeneration/Sources/generate-swiftsyntax/templates/basicformat/BasicFormatFile.swift
Outdated
Show resolved
Hide resolved
CodeGeneration/Sources/generate-swiftsyntax/templates/basicformat/BasicFormatFile.swift
Outdated
Show resolved
Hide resolved
4e025d2
to
8b022d3
Compare
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.
One comment that a few of the special cases regarding angle brackets are superfluous now, otherwise LGTM.
8b022d3
to
b32e5e2
Compare
b32e5e2
to
a3ef115
Compare
@swift-ci please test |
(.postfixQuestionMark, .rightAngle), // Ensures there is not space in `ContiguousArray<RawSyntax?>` | ||
(.postfixQuestionMark, .rightParen), // Ensures there is not space in `myOptionalClosure?()` |
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 think those are also no longer necessary
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 see they are necessary to remove the trailing space on postfixQuestionMark
This fixes so we don't get
var newLayout: ContiguousArray < RawSyntax ? > ?
when doingVariableDecl("var newLayout: ContiguousArray<RawSyntax?>?")
.If you can think of other test cases that I nee to add, to ensure we have expected behaviour different places feel free to comment then.
this PR also fixes #853