-
Notifications
You must be signed in to change notification settings - Fork 5.8k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FIR] Add extracting contracts in raw fir builder and light tree builder
- Loading branch information
1 parent
25cee12
commit 4e1bf5f
Showing
12 changed files
with
302 additions
and
16 deletions.
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
5 changes: 5 additions & 0 deletions
5
...fir/tests/org/jetbrains/kotlin/fir/lightTree/LightTree2FirConverterTestCaseGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
62 changes: 62 additions & 0 deletions
62
compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contractDescription.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,62 @@ | ||
// Should have raw description | ||
fun test_1() { | ||
contract { | ||
callsInPlace() | ||
} | ||
test_1() | ||
} | ||
|
||
fun test_2() { | ||
kotlin.contracts.contract { | ||
callsInPlace() | ||
callsInPlace() | ||
} | ||
test_2() | ||
} | ||
|
||
var test_3: Int = 1 | ||
get() { | ||
contract { | ||
callsInPlace() | ||
} | ||
return 1 | ||
} | ||
set(value) { | ||
kotlin.contracts.contract { | ||
callsInPlace() | ||
callsInPlace() | ||
} | ||
} | ||
|
||
fun test_4() { | ||
contract() | ||
test_4() | ||
} | ||
|
||
// should not have raw description | ||
|
||
fun test_5() { | ||
test_5() | ||
contract() | ||
} | ||
|
||
fun test_6() { | ||
aaa.bbb.ccc.contract { | ||
|
||
} | ||
test_6() | ||
} | ||
|
||
fun test_7() { | ||
contracts.contract { | ||
|
||
} | ||
test_7() | ||
} | ||
|
||
fun test_8() { | ||
aaa.kotlin.contracts.contract { | ||
|
||
} | ||
test_8() | ||
} |
80 changes: 80 additions & 0 deletions
80
compiler/fir/raw-fir/psi2fir/testData/rawBuilder/declarations/contractDescription.txt
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,80 @@ | ||
FILE: contractDescription.kt | ||
public? final? fun test_1(): R|kotlin/Unit| | ||
[Contract description] < | ||
contract#(<L> = contract@fun <implicit>.<anonymous>(): <implicit> { | ||
callsInPlace#() | ||
} | ||
) | ||
> | ||
{ | ||
[StubStatement] | ||
test_1#() | ||
} | ||
public? final? fun test_2(): R|kotlin/Unit| | ||
[Contract description] < | ||
kotlin#.contracts#.contract#(<L> = contract@fun <implicit>.<anonymous>(): <implicit> { | ||
callsInPlace#() | ||
callsInPlace#() | ||
} | ||
) | ||
> | ||
{ | ||
[StubStatement] | ||
test_2#() | ||
} | ||
public? final? var test_3: Int = IntegerLiteral(1) | ||
public? get(): Int | ||
[Contract description] < | ||
contract#(<L> = contract@fun <implicit>.<anonymous>(): <implicit> { | ||
callsInPlace#() | ||
} | ||
) | ||
> | ||
{ | ||
[StubStatement] | ||
^ IntegerLiteral(1) | ||
} | ||
public? set(value: Int): R|kotlin/Unit| | ||
[Contract description] < | ||
kotlin#.contracts#.contract#(<L> = contract@fun <implicit>.<anonymous>(): <implicit> { | ||
callsInPlace#() | ||
callsInPlace#() | ||
} | ||
) | ||
> | ||
{ | ||
[StubStatement] | ||
} | ||
public? final? fun test_4(): R|kotlin/Unit| | ||
[Contract description] < | ||
contract#() | ||
> | ||
{ | ||
[StubStatement] | ||
test_4#() | ||
} | ||
public? final? fun test_5(): R|kotlin/Unit| { | ||
test_5#() | ||
contract#() | ||
} | ||
public? final? fun test_6(): R|kotlin/Unit| { | ||
aaa#.bbb#.ccc#.contract#(<L> = contract@fun <implicit>.<anonymous>(): <implicit> { | ||
Unit | ||
} | ||
) | ||
test_6#() | ||
} | ||
public? final? fun test_7(): R|kotlin/Unit| { | ||
contracts#.contract#(<L> = contract@fun <implicit>.<anonymous>(): <implicit> { | ||
Unit | ||
} | ||
) | ||
test_7#() | ||
} | ||
public? final? fun test_8(): R|kotlin/Unit| { | ||
aaa#.kotlin#.contracts#.contract#(<L> = contract@fun <implicit>.<anonymous>(): <implicit> { | ||
Unit | ||
} | ||
) | ||
test_8#() | ||
} |
Oops, something went wrong.