Remove assertion on sorted ranges: it could be empty if lambda doesn't contain any linenumber
#KT-35101 Fixed
This commit is contained in:
@@ -133,12 +133,6 @@ open class InlineLambdaSourceMapper(
|
|||||||
parent: SourceMapper, smap: SMAPAndMethodNode
|
parent: SourceMapper, smap: SMAPAndMethodNode
|
||||||
) : NestedSourceMapper(parent, smap.sortedRanges, smap.classSMAP.sourceInfo) {
|
) : NestedSourceMapper(parent, smap.sortedRanges, smap.classSMAP.sourceInfo) {
|
||||||
|
|
||||||
init {
|
|
||||||
assert(ranges.isNotEmpty()) {
|
|
||||||
"Mapping ranges should be presented in inline lambda: ${smap.node}"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
override fun mapLineNumber(lineNumber: Int): Int {
|
override fun mapLineNumber(lineNumber: Int): Int {
|
||||||
if (ranges.firstOrNull()?.contains(lineNumber) == true) {
|
if (ranges.firstOrNull()?.contains(lineNumber) == true) {
|
||||||
//don't remap origin lambda line numbers
|
//don't remap origin lambda line numbers
|
||||||
|
|||||||
@@ -0,0 +1,14 @@
|
|||||||
|
// FILE: 1.kt
|
||||||
|
package test
|
||||||
|
|
||||||
|
inline fun <T, R> T.let2(block: (T) -> R): R {
|
||||||
|
return block(this)
|
||||||
|
}
|
||||||
|
|
||||||
|
// FILE: 2.kt
|
||||||
|
import test.*
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
val result = true.let2(Boolean::not)
|
||||||
|
return if (!result) "OK" else "fail"
|
||||||
|
}
|
||||||
+5
@@ -799,6 +799,11 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
|||||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35101.kt")
|
||||||
|
public void testKt35101() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/callableReference/kt35101.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("propertyIntrinsic.kt")
|
@TestMetadata("propertyIntrinsic.kt")
|
||||||
public void testPropertyIntrinsic() throws Exception {
|
public void testPropertyIntrinsic() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/callableReference/propertyIntrinsic.kt");
|
runTest("compiler/testData/codegen/boxInline/callableReference/propertyIntrinsic.kt");
|
||||||
|
|||||||
Generated
+5
@@ -799,6 +799,11 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
|||||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35101.kt")
|
||||||
|
public void testKt35101() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/callableReference/kt35101.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("propertyIntrinsic.kt")
|
@TestMetadata("propertyIntrinsic.kt")
|
||||||
public void testPropertyIntrinsic() throws Exception {
|
public void testPropertyIntrinsic() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/callableReference/propertyIntrinsic.kt");
|
runTest("compiler/testData/codegen/boxInline/callableReference/propertyIntrinsic.kt");
|
||||||
|
|||||||
+5
@@ -799,6 +799,11 @@ public class IrBlackBoxInlineCodegenTestGenerated extends AbstractIrBlackBoxInli
|
|||||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35101.kt")
|
||||||
|
public void testKt35101() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/callableReference/kt35101.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("propertyIntrinsic.kt")
|
@TestMetadata("propertyIntrinsic.kt")
|
||||||
public void testPropertyIntrinsic() throws Exception {
|
public void testPropertyIntrinsic() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/callableReference/propertyIntrinsic.kt");
|
runTest("compiler/testData/codegen/boxInline/callableReference/propertyIntrinsic.kt");
|
||||||
|
|||||||
Generated
+5
@@ -799,6 +799,11 @@ public class IrCompileKotlinAgainstInlineKotlinTestGenerated extends AbstractIrC
|
|||||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35101.kt")
|
||||||
|
public void testKt35101() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/callableReference/kt35101.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("propertyIntrinsic.kt")
|
@TestMetadata("propertyIntrinsic.kt")
|
||||||
public void testPropertyIntrinsic() throws Exception {
|
public void testPropertyIntrinsic() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/callableReference/propertyIntrinsic.kt");
|
runTest("compiler/testData/codegen/boxInline/callableReference/propertyIntrinsic.kt");
|
||||||
|
|||||||
+5
@@ -69,6 +69,11 @@ public class IrCallableReferenceInlineTestsGenerated extends AbstractIrCallableR
|
|||||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35101.kt")
|
||||||
|
public void testKt35101() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/callableReference/kt35101.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("propertyIntrinsic.kt")
|
@TestMetadata("propertyIntrinsic.kt")
|
||||||
public void testPropertyIntrinsic() throws Exception {
|
public void testPropertyIntrinsic() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/callableReference/propertyIntrinsic.kt");
|
runTest("compiler/testData/codegen/boxInline/callableReference/propertyIntrinsic.kt");
|
||||||
|
|||||||
Generated
+5
@@ -69,6 +69,11 @@ public class CallableReferenceInlineTestsGenerated extends AbstractCallableRefer
|
|||||||
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
runTest("compiler/testData/codegen/boxInline/callableReference/kt16411.kt");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("kt35101.kt")
|
||||||
|
public void testKt35101() throws Exception {
|
||||||
|
runTest("compiler/testData/codegen/boxInline/callableReference/kt35101.kt");
|
||||||
|
}
|
||||||
|
|
||||||
@TestMetadata("propertyIntrinsic.kt")
|
@TestMetadata("propertyIntrinsic.kt")
|
||||||
public void testPropertyIntrinsic() throws Exception {
|
public void testPropertyIntrinsic() throws Exception {
|
||||||
runTest("compiler/testData/codegen/boxInline/callableReference/propertyIntrinsic.kt");
|
runTest("compiler/testData/codegen/boxInline/callableReference/propertyIntrinsic.kt");
|
||||||
|
|||||||
Reference in New Issue
Block a user