-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Create header mode to enable eliding function / method bodies #5516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
aviroop-123
wants to merge
9
commits into
JetBrains:master
Choose a base branch
from
aviroop-123:header-compilation-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+468
−48
Open
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
58bf238
Create compiler arguments and configurations for enabling header mode.
aviroop-123 92da29f
Disable checkers and platform checkers in header mode.
aviroop-123 352c5ae
Enable eliding function bodies in header mode.
aviroop-123 062d57d
Skip function body AST -> FIR conversion and only process contracts.
aviroop-123 5213885
Elide class and object method bodies in header mode.
aviroop-123 49852fb
Set IrFileSerializer.publicAbiOnly for header mode.
aviroop-123 3cc60ca
Add FIR tests for header compilation.
aviroop-123 8134ffb
Handle bodies of interfaces with default method body.
aviroop-123 f300414
Handle functions & methods with implicit return types.
aviroop-123 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
28 changes: 28 additions & 0 deletions
28
...n/analysis/low/level/api/fir/diagnostic/compiler/based/LLDiagnosticsFirTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
...sis/low/level/api/fir/diagnostic/compiler/based/LLPartialDiagnosticsFirTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
28 changes: 28 additions & 0 deletions
28
...is/low/level/api/fir/diagnostic/compiler/based/LLReversedDiagnosticsFirTestGenerated.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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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
38 changes: 38 additions & 0 deletions
38
compiler/fir/analysis-tests/testData/resolve/headerMode/classDeclaration.fir.txt
This file contains hidden or 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,38 @@ | ||
| FILE: classDeclaration.kt | ||
| public final class A : R|kotlin/Any| { | ||
| public constructor(): R|A| { | ||
| super<R|kotlin/Any|>() | ||
| } | ||
|
|
||
| public final fun funA(): R|kotlin/String| | ||
|
|
||
| public final inline fun funB(): R|kotlin/String| { | ||
| ^funB String(A.funB body) | ||
| } | ||
|
|
||
| @R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun isNotNull(value: R|kotlin/Any?|): R|kotlin/Boolean| | ||
| [R|Contract description] | ||
| < | ||
| Returns(TRUE) -> value != null | ||
| > | ||
|
|
||
|
|
||
| private final fun funC(): R|kotlin/String| | ||
|
|
||
| public final fun funD(): R|kotlin/Int| | ||
|
|
||
| } | ||
| public abstract interface B : R|kotlin/Any| { | ||
| public open fun funA(): R|kotlin/String| | ||
|
|
||
| public abstract fun funB(): R|kotlin/String| | ||
|
|
||
| } | ||
| public final class C : R|B| { | ||
| public constructor(): R|C| { | ||
| super<R|kotlin/Any|>() | ||
| } | ||
|
|
||
| public open override fun funB(): R|kotlin/String| | ||
|
|
||
| } |
45 changes: 45 additions & 0 deletions
45
compiler/fir/analysis-tests/testData/resolve/headerMode/classDeclaration.kt
This file contains hidden or 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,45 @@ | ||
| // RUN_PIPELINE_TILL: BACKEND | ||
| // FIR_DUMP | ||
| import kotlin.contracts.ExperimentalContracts | ||
| import kotlin.contracts.contract | ||
|
|
||
| class A { | ||
| fun funA(): String { | ||
| return "A.funA body" | ||
| } | ||
|
|
||
| inline fun funB(): String { | ||
| return "A.funB body" | ||
| } | ||
|
|
||
| @OptIn(ExperimentalContracts::class) | ||
| fun isNotNull(value: Any?): Boolean { | ||
| contract { | ||
| returns(true) implies (value != null) | ||
| } | ||
| return value != null | ||
| } | ||
|
|
||
| private fun funC(): String { | ||
| return "A.funC body" | ||
| } | ||
|
|
||
| fun funD() = 1 + 2 | ||
| } | ||
|
|
||
| interface B { | ||
| fun funA(): String { | ||
| "B.funA body" | ||
| } | ||
|
|
||
| fun funB(): String | ||
| } | ||
|
|
||
| class C: B { | ||
| override fun funB(): String { | ||
| return "C.funB body" | ||
| } | ||
| } | ||
|
|
||
| /* GENERATED_FIR_TAGS: classDeclaration, classReference, contractConditionalEffect, contracts, functionDeclaration, | ||
| inline, interfaceDeclaration, nullableType, override, stringLiteral */ |
13 changes: 13 additions & 0 deletions
13
compiler/fir/analysis-tests/testData/resolve/headerMode/functionDeclaration.fir.txt
This file contains hidden or 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,13 @@ | ||
| FILE: functionDeclaration.kt | ||
| public final fun funA(): R|kotlin/String| | ||
| public final inline fun funB(): R|kotlin/String| { | ||
| ^funB String(funB body) | ||
| } | ||
| @R|kotlin/OptIn|(markerClass = vararg(<getClass>(Q|kotlin/contracts/ExperimentalContracts|))) public final fun isNotNull(value: R|kotlin/Any?|): R|kotlin/Boolean| | ||
| [R|Contract description] | ||
| < | ||
| Returns(TRUE) -> value != null | ||
| > | ||
|
|
||
| private final fun funC(): R|kotlin/String| | ||
| public final fun funD(): R|kotlin/Int| |
29 changes: 29 additions & 0 deletions
29
compiler/fir/analysis-tests/testData/resolve/headerMode/functionDeclaration.kt
This file contains hidden or 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,29 @@ | ||
| // RUN_PIPELINE_TILL: BACKEND | ||
| // FIR_DUMP | ||
| import kotlin.contracts.ExperimentalContracts | ||
| import kotlin.contracts.contract | ||
|
|
||
| fun funA(): String { | ||
| return "funA body" | ||
| } | ||
|
|
||
| inline fun funB: String { | ||
| return "funB body" | ||
| } | ||
|
|
||
| @OptIn(ExperimentalContracts::class) | ||
| fun isNotNull(value: Any?): Boolean { | ||
| contract { | ||
| returns(true) implies (value != null) | ||
| } | ||
| return value != null | ||
| } | ||
|
|
||
| private fun funC(): String { | ||
| return "funC body" | ||
| } | ||
|
|
||
| fun funD() = 1 + 2 | ||
|
|
||
| /* GENERATED_FIR_TAGS: classReference, contractConditionalEffect, contracts, functionDeclaration, inline, nullableType, | ||
| stringLiteral */ |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.