-
Notifications
You must be signed in to change notification settings - Fork 6.1k
Re-enable LT2Fir function/method body elidation #5540
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
7
commits into
JetBrains:master
Choose a base branch
from
aviroop-123:header-compilation-lt2fir-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.
+343
−20
Open
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
9a20050
Add more tests for header compilation.
aviroop-123 5e7de6b
Fix header compilation for function / class declarations nested insid…
aviroop-123 010ebc6
Elide function / method bodies in LT2FIR during header compilation.
aviroop-123 a327aff
Disable Psi-based tests in header mode
aviroop-123 8361fa8
Add data class tests for header compilation.
aviroop-123 87278c5
Remove changes to resolve transformer for header compilation since it…
aviroop-123 f9a7533
Add property declaration tests for header compilation.
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
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
41 changes: 41 additions & 0 deletions
41
compiler/fir/analysis-tests/testData/resolve/headerMode/constructorDeclaration.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,41 @@ | ||
| FILE: constructorDeclaration.kt | ||
| public final class A : R|kotlin/Any| { | ||
| public constructor(a: R|kotlin/String|, b: R|kotlin/Int|): R|A| { | ||
| super<R|kotlin/Any|>() | ||
| } | ||
|
|
||
| public final val a: R|kotlin/String| = R|<local>/a| | ||
| public get(): R|kotlin/String| | ||
|
|
||
| public final val b: R|kotlin/Int| = R|<local>/b| | ||
| public get(): R|kotlin/Int| | ||
|
|
||
| public constructor(e: R|kotlin/String|): R|A| { | ||
| this<R|A|>(R|<local>/e|, Int(0)) | ||
| } | ||
|
|
||
| public constructor(): R|A| { | ||
| this<R|A|>(String()) | ||
| } | ||
|
|
||
| } | ||
| public final class B : R|kotlin/Any| { | ||
| private constructor(a: R|kotlin/String|, b: R|kotlin/Int|): R|B| { | ||
| super<R|kotlin/Any|>() | ||
| } | ||
|
|
||
| public final val a: R|kotlin/String| = R|<local>/a| | ||
| public get(): R|kotlin/String| | ||
|
|
||
| public final val b: R|kotlin/Int| = R|<local>/b| | ||
| public get(): R|kotlin/Int| | ||
|
|
||
| public constructor(e: R|kotlin/String|): R|B| { | ||
| this<R|B|>(R|<local>/e|, Int(0)) | ||
| } | ||
|
|
||
| public constructor(): R|B| { | ||
| this<R|B|>(String()) | ||
| } | ||
|
|
||
| } |
22 changes: 22 additions & 0 deletions
22
compiler/fir/analysis-tests/testData/resolve/headerMode/constructorDeclaration.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,22 @@ | ||
| // RUN_PIPELINE_TILL: BACKEND | ||
| // FIR_DUMP | ||
| class A(val a: String, val b: Int) { | ||
| constructor(e: String): this(e, 0) { | ||
| val message = "Secondary constructor body" | ||
| } | ||
| constructor(): this("") { | ||
| val message = "Secondary constructor body with delegated constructor call" | ||
| } | ||
| } | ||
|
|
||
| class B private constructor(val a: String, val b: Int) { | ||
| constructor(e: String): this(e, 0) { | ||
| val message = "Secondary constructor body" | ||
| } | ||
| constructor(): this("") { | ||
| val message = "Secondary constructor body with delegated constructor call" | ||
| } | ||
| } | ||
|
|
||
| /* GENERATED_FIR_TAGS: classDeclaration, functionDeclaration, primaryConstructor, propertyDeclaration, | ||
| secondaryConstructor */ |
19 changes: 19 additions & 0 deletions
19
compiler/fir/analysis-tests/testData/resolve/headerMode/dataClassDeclaration.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,19 @@ | ||
| FILE: dataClassDeclaration.kt | ||
| public final data class User : R|kotlin/Any| { | ||
| public constructor(name: R|kotlin/String|, age: R|kotlin/Int|): R|User| { | ||
| super<R|kotlin/Any|>() | ||
| } | ||
|
|
||
| public final val name: R|kotlin/String| = R|<local>/name| | ||
| public get(): R|kotlin/String| | ||
|
|
||
| public final val age: R|kotlin/Int| = R|<local>/age| | ||
| public get(): R|kotlin/Int| | ||
|
|
||
| public final operator fun component1(): R|kotlin/String| | ||
|
|
||
| public final operator fun component2(): R|kotlin/Int| | ||
|
|
||
| public final fun copy(name: R|kotlin/String| = this@R|/User|.R|/User.name|, age: R|kotlin/Int| = this@R|/User|.R|/User.age|): R|User| | ||
|
|
||
| } |
5 changes: 5 additions & 0 deletions
5
compiler/fir/analysis-tests/testData/resolve/headerMode/dataClassDeclaration.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,5 @@ | ||
| // RUN_PIPELINE_TILL: BACKEND | ||
| // FIR_DUMP | ||
| data class User(val name: String, val age: Int) | ||
|
|
||
| /* GENERATED_FIR_TAGS: classDeclaration, data, primaryConstructor, propertyDeclaration */ |
52 changes: 52 additions & 0 deletions
52
compiler/fir/analysis-tests/testData/resolve/headerMode/enumClassDeclaration.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,52 @@ | ||
| FILE: enumClassDeclaration.kt | ||
| public final enum class A : R|kotlin/Enum<A>| { | ||
| private constructor(): R|A| { | ||
| super<R|kotlin/Enum<A>|>() | ||
| } | ||
|
|
||
| public final static enum entry EAST: R|A| | ||
| public final static enum entry WEST: R|A| | ||
| public final static fun values(): R|kotlin/Array<A>| | ||
|
|
||
| public final static fun valueOf(value: R|kotlin/String|): R|A| | ||
|
|
||
| public final static val entries: R|kotlin/enums/EnumEntries<A>| | ||
| public get(): R|kotlin/enums/EnumEntries<A>| | ||
|
|
||
| } | ||
| public final enum class B : R|kotlin/Enum<B>| { | ||
| private constructor(): R|B| { | ||
| super<R|kotlin/Enum<B>|>() | ||
| } | ||
|
|
||
| public final static enum entry NORTH: R|B| = object : R|B| { | ||
| private constructor(): R|<anonymous>| { | ||
| super<R|B|>() | ||
| } | ||
|
|
||
| public open override fun getString(): R|kotlin/String| { | ||
| ^getString String(north) | ||
| } | ||
|
|
||
| } | ||
|
|
||
| public final static enum entry SOUTH: R|B| = object : R|B| { | ||
| private constructor(): R|<anonymous>| { | ||
| super<R|B|>() | ||
| } | ||
|
|
||
| public open override fun getString(): R|kotlin/String| { | ||
| } | ||
|
|
||
| } | ||
|
|
||
| public abstract fun getString(): R|kotlin/String| | ||
|
|
||
| public final static fun values(): R|kotlin/Array<B>| | ||
|
|
||
| public final static fun valueOf(value: R|kotlin/String|): R|B| | ||
|
|
||
| public final static val entries: R|kotlin/enums/EnumEntries<B>| | ||
| public get(): R|kotlin/enums/EnumEntries<B>| | ||
|
|
||
| } | ||
21 changes: 21 additions & 0 deletions
21
compiler/fir/analysis-tests/testData/resolve/headerMode/enumClassDeclaration.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,21 @@ | ||
| // RUN_PIPELINE_TILL: BACKEND | ||
| // FIR_DUMP | ||
| enum class A { | ||
| EAST, | ||
| WEST | ||
| } | ||
|
|
||
| enum class B { | ||
| NORTH { | ||
| override fun getString() = "north" | ||
| }, | ||
| SOUTH { | ||
| override fun getString(): String { | ||
| return "south" | ||
| } | ||
| }; | ||
|
|
||
| abstract fun getString(): String | ||
| } | ||
|
|
||
| /* GENERATED_FIR_TAGS: enumDeclaration, enumEntry */ |
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
8 changes: 8 additions & 0 deletions
8
compiler/fir/analysis-tests/testData/resolve/headerMode/propertyDeclaration.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,8 @@ | ||
| FILE: propertyDeclaration.kt | ||
| public final val a: R|kotlin/String| = String(A) | ||
| public get(): R|kotlin/String| | ||
| public final val b: R|kotlin/String| = String(B) | ||
| public get(): R|kotlin/String| | ||
| public final fun getC(): R|kotlin/String| | ||
| public final val c: <ERROR TYPE REF: Cannot infer variable type without initializer / getter / delegate> | ||
| public get(): <ERROR TYPE REF: Cannot infer variable type without initializer / getter / delegate> |
11 changes: 11 additions & 0 deletions
11
compiler/fir/analysis-tests/testData/resolve/headerMode/propertyDeclaration.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,11 @@ | ||
| // RUN_PIPELINE_TILL: BACKEND | ||
| // FIR_DUMP | ||
| // Public property with explicit type | ||
| //val a: String = "A" | ||
| // Public property with implicit type | ||
| //val b = "B" | ||
| // Property with overriden getter and implicit type. | ||
| fun getC() = "C" | ||
| val c get() = getC() | ||
|
|
||
| /* GENERATED_FIR_TAGS: propertyDeclaration, 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.