Return correct PSI expression for EmptyLabeledReturn
Fixes diagnostic reporting for appropriate constraint error #kt-32792 fixed
This commit is contained in:
Generated
+5
@@ -17781,6 +17781,11 @@ public class FirOldFrontendDiagnosticsTestGenerated extends AbstractFirOldFronte
|
||||
runTest("compiler/testData/diagnostics/tests/regressions/kt32507.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32792.kt")
|
||||
public void testKt32792() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/regressions/kt32792.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt328.kt")
|
||||
public void testKt328() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/regressions/kt328.kt");
|
||||
|
||||
@@ -60,7 +60,7 @@ val KotlinCallArgument.psiExpression: KtExpression?
|
||||
return when (this) {
|
||||
is ReceiverExpressionKotlinCallArgument -> receiver.receiverValue.safeAs<ExpressionReceiver>()?.expression
|
||||
is QualifierReceiverKotlinCallArgument -> receiver.safeAs<Qualifier>()?.expression
|
||||
is EmptyLabeledReturn -> null // questionable, maybe unit?
|
||||
is EmptyLabeledReturn -> returnExpression
|
||||
else -> psiCallArgument.valueArgument.getArgumentExpression()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,10 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
inline fun <T> tryLambdas(lamb : () -> T) : T{
|
||||
return lamb.invoke()
|
||||
}
|
||||
fun main() {
|
||||
tryLambdas<String> {
|
||||
<!TYPE_MISMATCH!>return@tryLambdas<!>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,10 @@
|
||||
// !LANGUAGE: +NewInference
|
||||
|
||||
inline fun <T> tryLambdas(lamb : () -> T) : T{
|
||||
return lamb.invoke()
|
||||
}
|
||||
fun main() {
|
||||
tryLambdas<String> {
|
||||
<!TYPE_MISMATCH!>return@tryLambdas<!>
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,4 @@
|
||||
package
|
||||
|
||||
public fun main(): kotlin.Unit
|
||||
public inline fun </*0*/ T> tryLambdas(/*0*/ lamb: () -> T): T
|
||||
@@ -17793,6 +17793,11 @@ public class DiagnosticsTestGenerated extends AbstractDiagnosticsTest {
|
||||
runTest("compiler/testData/diagnostics/tests/regressions/kt32507.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32792.kt")
|
||||
public void testKt32792() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/regressions/kt32792.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt328.kt")
|
||||
public void testKt328() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/regressions/kt328.kt");
|
||||
|
||||
Generated
+5
@@ -17783,6 +17783,11 @@ public class DiagnosticsUsingJavacTestGenerated extends AbstractDiagnosticsUsing
|
||||
runTest("compiler/testData/diagnostics/tests/regressions/kt32507.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt32792.kt")
|
||||
public void testKt32792() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/regressions/kt32792.kt");
|
||||
}
|
||||
|
||||
@TestMetadata("kt328.kt")
|
||||
public void testKt328() throws Exception {
|
||||
runTest("compiler/testData/diagnostics/tests/regressions/kt328.kt");
|
||||
|
||||
Reference in New Issue
Block a user