Skip to content

Commit bb23ce9

Browse files
committed
Add FIR tests for header compilation.
^KT-78422
1 parent b8e2036 commit bb23ce9

File tree

12 files changed

+262
-0
lines changed

12 files changed

+262
-0
lines changed

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

Lines changed: 28 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-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLPartialDiagnosticsFirTestGenerated.java

Lines changed: 28 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-gen/org/jetbrains/kotlin/analysis/low/level/api/fir/diagnostic/compiler/based/LLReversedDiagnosticsFirTestGenerated.java

Lines changed: 28 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
FILE: classDeclaration.kt
2+
public final class A : R|kotlin/Any| {
3+
public constructor(): R|A| {
4+
super<R|kotlin/Any|>()
5+
}
6+
7+
public final fun funA(): R|kotlin/String|
8+
9+
public final inline fun funB(): R|kotlin/String| {
10+
^funB String(A.funB body)
11+
}
12+
13+
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun isNotNull(value: R|kotlin/Any?|): R|kotlin/Boolean|
14+
[R|Contract description]
15+
<
16+
Returns(TRUE) -> value != null
17+
>
18+
19+
20+
private final fun funC(): R|kotlin/String|
21+
22+
}
23+
public abstract interface B : R|kotlin/Any| {
24+
public abstract fun funA(): R|kotlin/String|
25+
26+
public abstract fun funB(): R|kotlin/String|
27+
28+
}
29+
public final class C : R|B| {
30+
public constructor(): R|C| {
31+
super<R|kotlin/Any|>()
32+
}
33+
34+
public open override fun funB(): R|kotlin/String|
35+
36+
}
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
// RUN_PIPELINE_TILL: BACKEND
2+
// FIR_DUMP
3+
import kotlin.contracts.ExperimentalContracts
4+
import kotlin.contracts.contract
5+
6+
class A {
7+
fun funA(): String {
8+
return "A.funA body"
9+
}
10+
11+
inline fun funB(): String {
12+
return "A.funB body"
13+
}
14+
15+
@OptIn(ExperimentalContracts::class)
16+
fun isNotNull(value: Any?): Boolean {
17+
contract {
18+
returns(true) implies (value != null)
19+
}
20+
return value != null
21+
}
22+
23+
private fun funC(): String {
24+
return "A.funC body"
25+
}
26+
}
27+
28+
interface B {
29+
fun funA(): String {
30+
"B.funA body"
31+
}
32+
33+
fun funB(): String
34+
}
35+
36+
class C: B {
37+
override fun funB(): String {
38+
return "C.funB body"
39+
}
40+
}
41+
42+
/* GENERATED_FIR_TAGS: classDeclaration, classReference, contractConditionalEffect, contracts, functionDeclaration,
43+
inline, interfaceDeclaration, nullableType, override, stringLiteral */
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
FILE: functionDeclaration.kt
2+
public final fun funA(): R|kotlin/String|
3+
public final inline fun funB(): R|kotlin/String| {
4+
^funB String(funB body)
5+
}
6+
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun isNotNull(value: R|kotlin/Any?|): R|kotlin/Boolean|
7+
[R|Contract description]
8+
<
9+
Returns(TRUE) -> value != null
10+
>
11+
12+
private final fun funC(): R|kotlin/String|
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
// RUN_PIPELINE_TILL: BACKEND
2+
// FIR_DUMP
3+
import kotlin.contracts.ExperimentalContracts
4+
import kotlin.contracts.contract
5+
6+
fun funA(): String {
7+
return "funA body"
8+
}
9+
10+
inline fun funB: String {
11+
return "funB body"
12+
}
13+
14+
@OptIn(ExperimentalContracts::class)
15+
fun isNotNull(value: Any?): Boolean {
16+
contract {
17+
returns(true) implies (value != null)
18+
}
19+
return value != null
20+
}
21+
22+
private fun funC(): String {
23+
return "funC body"
24+
}
25+
26+
/* GENERATED_FIR_TAGS: classReference, contractConditionalEffect, contracts, functionDeclaration, inline, nullableType,
27+
stringLiteral */
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
FILE: objectDeclaration.kt
2+
public final object A : R|kotlin/Any| {
3+
private constructor(): R|A| {
4+
super<R|kotlin/Any|>()
5+
}
6+
7+
public final fun funA(): R|kotlin/String|
8+
9+
public final inline fun funB(): R|kotlin/String| {
10+
^funB String(A.funB body)
11+
}
12+
13+
@R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun isNotNull(value: R|kotlin/Any?|): R|kotlin/Boolean|
14+
[R|Contract description]
15+
<
16+
Returns(TRUE) -> value != null
17+
>
18+
19+
20+
private final fun funC(): R|kotlin/String|
21+
22+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// RUN_PIPELINE_TILL: BACKEND
2+
// FIR_DUMP
3+
import kotlin.contracts.ExperimentalContracts
4+
import kotlin.contracts.contract
5+
6+
object A {
7+
fun funA(): String {
8+
return "A.funA body"
9+
}
10+
11+
inline fun funB(): String {
12+
return "A.funB body"
13+
}
14+
15+
@OptIn(ExperimentalContracts::class)
16+
fun isNotNull(value: Any?): Boolean {
17+
contract {
18+
returns(true) implies (value != null)
19+
}
20+
return value != null
21+
}
22+
23+
private fun funC(): String {
24+
return "A.funC body"
25+
}
26+
}
27+
28+
/* GENERATED_FIR_TAGS: classReference, contractConditionalEffect, contracts, functionDeclaration, inline, nullableType,
29+
objectDeclaration, stringLiteral */

compiler/test-infrastructure/testFixtures/org/jetbrains/kotlin/test/builders/LanguageVersionSettingsBuilder.kt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -105,6 +105,7 @@ class LanguageVersionSettingsBuilder {
105105
analysisFlag(AnalysisFlags.dontWarnOnErrorSuppression, trueOrNull(LanguageSettingsDirectives.DONT_WARN_ON_ERROR_SUPPRESSION in directives)),
106106
analysisFlag(AnalysisFlags.stdlibCompilation, trueOrNull(LanguageSettingsDirectives.STDLIB_COMPILATION in directives)),
107107
analysisFlag(AnalysisFlags.lenientMode, trueOrNull(LanguageSettingsDirectives.LENIENT_MODE in directives)),
108+
analysisFlag(AnalysisFlags.headerMode, trueOrNull(LanguageSettingsDirectives.HEADER_MODE in directives)),
108109

109110
analysisFlag(JvmAnalysisFlags.jvmDefaultMode, directives.singleOrZeroValue(LanguageSettingsDirectives.JVM_DEFAULT_MODE)),
110111
analysisFlag(JvmAnalysisFlags.inheritMultifileParts, trueOrNull(LanguageSettingsDirectives.INHERIT_MULTIFILE_PARTS in directives)),

0 commit comments

Comments
 (0)