Rewrite and fix OneVariableDeclarationPerLine
.
#208
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The old rule implementation assumed that if there were
multiple bindings in a single var decl, the last one
contained the type that should be applied to all of
them. The rules are actually more complex than that,
because they don't apply to bindings that have
initializer clauses (from which the type is inferred),
and they also allow multiple sequences of bindings in
the same decl (e.g.,
var a, b: Int, c, d: String
).This change also ensures proper handling of leading
comments (does not duplicate them) and that nested
declarations are transformed correctly.
Fixes SR-13051.