-
Notifications
You must be signed in to change notification settings - Fork 39
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Incorrect fix in COMPACT_OBJECT_INITIALIZATION rule (#1036)
### What's done: * Fix bug and process case, when receiver name is also used in right part of expression * Add tests
- Loading branch information
1 parent
9fb026f
commit 0a975e7
Showing
4 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
.../resources/test/chapter6/compact_initialization/StatementUseFieldMultipleTimesExpected.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
fun foo() { | ||
val execution = Execution().apply { | ||
id = executionService.saveExecution(this)} | ||
return execution.id!! | ||
} | ||
|
||
fun foo() { | ||
val execution = Execution().apply { | ||
id = executionService.saveExecution(this) | ||
sdk = this.defaultSdk(this) | ||
id2 = this.id + shift | ||
name = this.execution(this)} | ||
return execution.id!! | ||
} |
14 changes: 14 additions & 0 deletions
14
...test/resources/test/chapter6/compact_initialization/StatementUseFieldMultipleTimesTest.kt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
fun foo() { | ||
val execution = Execution() | ||
execution.id = executionService.saveExecution(execution) | ||
return execution.id!! | ||
} | ||
|
||
fun foo() { | ||
val execution = Execution() | ||
execution.id = executionService.saveExecution(execution) | ||
execution.sdk = execution.defaultSdk(execution) | ||
execution.id2 = execution.id + shift | ||
execution.name = execution.execution(execution) | ||
return execution.id!! | ||
} |
0a975e7
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 wasn't able to retrieve PDD puzzles from the code base and submit them to GitHub. If you think that it's a bug on our side, please submit it to yegor256/0pdd:
Please, copy and paste this stack trace to GitHub: