Commit dcb5f0e
Support name-based destructuring declarations (#630)
Summary:
- Preserve square-bracket destructuring delimiters instead of always emitting parentheses.
- Format name-based destructuring entries with renames such as `x = b`.
- Add regression coverage for bracket destructuring and rename spacing.
Fixes #629
## Tests
- `./gradlew :ktfmt:test --tests "com.facebook.ktfmt.format.FormatterTest.handle name based destructuring declaration" --no-daemon --console=plain --stacktrace`
- `./gradlew :ktfmt:test --tests "com.facebook.ktfmt.format.FormatterTest" --no-daemon --console=plain --stacktrace`
- `./gradlew :ktfmt:build --no-daemon --console=plain --stacktrace`
Note: I also tried `./gradlew build --no-daemon --console=plain --stacktrace`; the local run reached ktfmt checks, then failed in unrelated `:lambda:test` dependency resolution because local Maven is missing `io.netty:netty-transport-native-epoll:4.1.42.Final:linux-x86_64`.
Pull Request resolved: #630
Reviewed By: cortinico
Differential Revision: D108969079
Pulled By: hick209
fbshipit-source-id: 2a30f0fac7ab7db5b95ddb2ffaa0ce9e9cb8c9a41 parent 78ac5d7 commit dcb5f0e
3 files changed
Lines changed: 35 additions & 5 deletions
File tree
- core/src
- main/java/com/facebook/ktfmt/format
- test/java/com/facebook/ktfmt/format
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
| |||
Lines changed: 7 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2248 | 2248 | | |
2249 | 2249 | | |
2250 | 2250 | | |
2251 | | - | |
| 2251 | + | |
2252 | 2252 | | |
2253 | 2253 | | |
2254 | 2254 | | |
| |||
2257 | 2257 | | |
2258 | 2258 | | |
2259 | 2259 | | |
| 2260 | + | |
| 2261 | + | |
2260 | 2262 | | |
2261 | | - | |
| 2263 | + | |
2262 | 2264 | | |
2263 | 2265 | | |
2264 | 2266 | | |
| |||
2268 | 2270 | | |
2269 | 2271 | | |
2270 | 2272 | | |
2271 | | - | |
| 2273 | + | |
2272 | 2274 | | |
2273 | 2275 | | |
2274 | 2276 | | |
| |||
2282 | 2284 | | |
2283 | 2285 | | |
2284 | 2286 | | |
2285 | | - | |
| 2287 | + | |
2286 | 2288 | | |
2287 | 2289 | | |
2288 | 2290 | | |
2289 | 2291 | | |
2290 | 2292 | | |
2291 | | - | |
| 2293 | + | |
2292 | 2294 | | |
2293 | 2295 | | |
2294 | 2296 | | |
| |||
Lines changed: 24 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3073 | 3073 | | |
3074 | 3074 | | |
3075 | 3075 | | |
| 3076 | + | |
| 3077 | + | |
| 3078 | + | |
| 3079 | + | |
| 3080 | + | |
| 3081 | + | |
| 3082 | + | |
| 3083 | + | |
| 3084 | + | |
| 3085 | + | |
| 3086 | + | |
| 3087 | + | |
| 3088 | + | |
| 3089 | + | |
| 3090 | + | |
| 3091 | + | |
| 3092 | + | |
| 3093 | + | |
| 3094 | + | |
| 3095 | + | |
| 3096 | + | |
| 3097 | + | |
| 3098 | + | |
| 3099 | + | |
3076 | 3100 | | |
3077 | 3101 | | |
3078 | 3102 | | |
| |||
0 commit comments