-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Apply minor changes to the syntactic sugar rewrite #3915
Conversation
Generated by 🚫 Danger |
@PaulTaykalo looks like my changes unintentionally fixed some violations, but I think that's actually better, since the ones that were previously being flagged as violations were initializers like |
According to the docs, SyntaxAnyVisitor is slower than SyntaxVisitor and we don't override `visitAny(_:)`. > This subclass of `SyntaxVisitor` is slower than the type-specific visitation > of `SyntaxVisitor`. Use `SyntaxAnyVisitor` if the `visitAny(_)` function > would be useful to have, otherwise inherit from `SyntaxVisitor`. https://github.com/apple/swift-syntax/blob/0423e4d4a896c69b3ddecf74cdfba1c334ac929c/Sources/SwiftSyntax/SyntaxAnyVisitor.swift.gyb#L22-L24
And refactor the rule in other small ways.
336f39b
to
2fa23f9
Compare
In this case, I suggest adding these examples in non-triggering rules. So those will be documented |
…taxVisitor" This reverts commit 1432bda.
I still think this rule shouldn't apply to initializer cases, but doing that consistently will be more work, so I'll land these internal changes first. I believe I've reverted the change and if OSSCheck confirms, I'll merge. |
…r to SyntaxVisitor"" This reverts commit 2178c8b.
Codecov Report
@@ Coverage Diff @@
## master #3915 +/- ##
=========================================
Coverage ? 92.57%
=========================================
Files ? 439
Lines ? 22156
Branches ? 0
=========================================
Hits ? 20511
Misses ? 1645
Partials ? 0
📣 Codecov can now indicate which changes are the most critical in Pull Requests. Learn more |
* Improve docstrings for `StringView+SwiftSyntax.swift` * Move changelog entry to correct section & reword * Change parameter type from `Int` to `ByteCount` * Move AbsolutePosition / ByteCount conversion to internal API * Only warn once if syntax tree cannot be parsed * Move Syntactic Sugar examples to a dedicated file * Change SyntacticSugarRuleVisitor from SyntaxAnyVisitor to SyntaxVisitor * Add `SugaredType` enum to help with the implement `SyntacticSugarRule`
I was late in reviewing #3866, so I reviewed after it merged and am suggesting some minor changes here.
StringView+SwiftSyntax.swift
Int
toByteCount
SugaredType
enum to help with the implementSyntacticSugarRule