-
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.
K1: Fix regression with callable references as last statements in lambda
^KT-55729 Fixed
- Loading branch information
Showing
7 changed files
with
151 additions
and
2 deletions.
There are no files selected for viewing
6 changes: 6 additions & 0 deletions
6
...vel/api/fir/diagnostic/compiler/based/DiagnosisCompilerTestFE10TestdataTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
...s/tests-gen/org/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
6 changes: 6 additions & 0 deletions
6
...rg/jetbrains/kotlin/test/runners/FirOldFrontendDiagnosticsWithLightTreeTestGenerated.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
34 changes: 34 additions & 0 deletions
34
...ata/diagnostics/tests/inference/callableReferences/conversionLastStatementInLambda.fir.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,34 @@ | ||
// SKIP_TXT | ||
// ISSUE: KT-55729 | ||
|
||
fun main(b: Boolean) { | ||
callWithLambda { | ||
// The only relevant case for KT-55729, Unit conversion should work, but doesn't in K1 1.8.0 | ||
// For K2, it still doesn't work (see KT-55936) | ||
::<!UNRESOLVED_REFERENCE!>test1<!> | ||
} | ||
|
||
callWithLambda { | ||
// Unit conversion should work (for K2 see KT-55936) | ||
<!ARGUMENT_TYPE_MISMATCH!>if (b) ::test1 else ::test2<!> | ||
} | ||
|
||
callWithLambda { | ||
// That hasn't been working ever in K1 nor K2 | ||
<!ARGUMENT_TYPE_MISMATCH!>if (b) { | ||
::test1 | ||
} else { | ||
::test2 | ||
}<!> | ||
} | ||
|
||
callWithLambda { | ||
// That hasn't been working ever in K1 nor K2 | ||
(::<!UNRESOLVED_REFERENCE!>test1<!>) | ||
} | ||
} | ||
|
||
fun test1(): String = "" | ||
fun test2(): String = "" | ||
|
||
fun callWithLambda(action: () -> () -> Unit) {} |
34 changes: 34 additions & 0 deletions
34
...estData/diagnostics/tests/inference/callableReferences/conversionLastStatementInLambda.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,34 @@ | ||
// SKIP_TXT | ||
// ISSUE: KT-55729 | ||
|
||
fun main(b: Boolean) { | ||
callWithLambda { | ||
// The only relevant case for KT-55729, Unit conversion should work, but doesn't in K1 1.8.0 | ||
// For K2, it still doesn't work (see KT-55936) | ||
::test1 | ||
} | ||
|
||
callWithLambda { | ||
// Unit conversion should work (for K2 see KT-55936) | ||
if (b) ::test1 else ::test2 | ||
} | ||
|
||
callWithLambda { | ||
// That hasn't been working ever in K1 nor K2 | ||
if (b) <!TYPE_MISMATCH!>{ | ||
<!TYPE_MISMATCH!>::<!TYPE_MISMATCH!>test1<!><!> | ||
}<!> else <!TYPE_MISMATCH!>{ | ||
<!TYPE_MISMATCH!>::<!TYPE_MISMATCH!>test2<!><!> | ||
}<!> | ||
} | ||
|
||
callWithLambda { | ||
// That hasn't been working ever in K1 nor K2 | ||
(<!TYPE_MISMATCH, TYPE_MISMATCH!>::<!TYPE_MISMATCH!>test1<!><!>) | ||
} | ||
} | ||
|
||
fun test1(): String = "" | ||
fun test2(): String = "" | ||
|
||
fun callWithLambda(action: () -> () -> Unit) {} |
6 changes: 6 additions & 0 deletions
6
...tests-common-new/tests-gen/org/jetbrains/kotlin/test/runners/DiagnosticTestGenerated.java
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.