Skip to content

Commit 0f56fc7

Browse files
lunakolySpace Team
authored andcommitted
[FIR] Add a test for a tn CAN_BE_REPLACED_WITH_OPERATOR_ASSIGNMENT
1 parent 53ebc0b commit 0f56fc7

File tree

7 files changed

+79
-0
lines changed

7 files changed

+79
-0
lines changed

analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/DiagnosticCompilerTestFirTestdataTestGenerated.java

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

analysis/low-level-api-fir/tests/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLFirPreresolvedReversedDiagnosticCompilerFirTestDataTestGenerated.java

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
FILE: trueNegativeOperatorAssignmentOnPropertyFromClass.kt
2+
public final class Test : R|kotlin/Any| {
3+
public constructor(number: R|kotlin/Int| = Int(10)): R|Test| {
4+
super<R|kotlin/Any|>()
5+
}
6+
7+
public final var number: R|kotlin/Int| = R|<local>/number|
8+
public get(): R|kotlin/Int|
9+
public set(value: R|kotlin/Int|): R|kotlin/Unit| {
10+
}
11+
12+
}
13+
public final var index: R|kotlin/Int| = Int(10)
14+
public get(): R|kotlin/Int|
15+
public set(value: R|kotlin/Int|): R|kotlin/Unit|
16+
public final val test: R|Test|
17+
public get(): R|Test| {
18+
^ R|/Test.Test|(R|/index|).R|kotlin/also|<R|Test|>(<L> = also@fun <anonymous>(it: R|Test|): R|kotlin/Unit| <inline=Inline, kind=EXACTLY_ONCE> {
19+
{
20+
lval <unary>: R|kotlin/Int| = R|/index|
21+
R|/index| = R|<local>/<unary>|.R|kotlin/Int.inc|()
22+
R|<local>/<unary>|
23+
}
24+
25+
}
26+
)
27+
}
28+
public final fun main(): R|kotlin/Unit| {
29+
R|/test|.R|/Test.number| = R|/test|.R|/Test.number|.R|kotlin/Int.plus|(Int(100))
30+
}
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
// WITH_EXPERIMENTAL_CHECKERS
2+
// WITH_EXTRA_CHECKERS
3+
4+
class Test(number: Int = 10) {
5+
var number: Int = number
6+
set(value) { /* println(value) */ }
7+
}
8+
9+
var index = 10
10+
11+
val test: Test
12+
get() = Test(index).also { index++ }
13+
14+
fun main() {
15+
// This results in printing 111
16+
test.number = test.number + 100
17+
// But this should print 110
18+
// test.number += 100
19+
}

compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeDiagnosticsTestGenerated.java

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirLightTreeDiagnosticsWithLatestLanguageVersionTestGenerated.java

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

compiler/fir/analysis-tests/tests-gen/org/jetbrains/kotlin/test/runners/FirPsiDiagnosticTestGenerated.java

Lines changed: 6 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)