Fix for KT-11478: "Couldn't inline method call" error
#KT-11478 Fixed
This commit is contained in:
@@ -239,7 +239,9 @@ class SMAP(val fileMappings: List<FileMapping>) {
|
|||||||
|
|
||||||
val sourceInfo: SourceInfo
|
val sourceInfo: SourceInfo
|
||||||
init {
|
init {
|
||||||
val defaultMapping = default.lineMappings.single()
|
//val defaultMapping = default.lineMappings.single()
|
||||||
|
//temporary workaround for KT-11478 ("Couldn't inline method call" error)
|
||||||
|
val defaultMapping = default.lineMappings.first()
|
||||||
sourceInfo = SourceInfo(default.name, default.path, defaultMapping.source + defaultMapping.range - 1)
|
sourceInfo = SourceInfo(default.name, default.path, defaultMapping.source + defaultMapping.range - 1)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+76
@@ -0,0 +1,76 @@
|
|||||||
|
//FILE: 1.kt
|
||||||
|
package test
|
||||||
|
|
||||||
|
inline fun annotatedWith2(crossinline predicate: () -> Boolean) =
|
||||||
|
{ any { predicate() } }()
|
||||||
|
|
||||||
|
|
||||||
|
inline fun annotatedWith(crossinline predicate: () -> Boolean) =
|
||||||
|
annotatedWith2 { predicate() }
|
||||||
|
|
||||||
|
|
||||||
|
inline fun any(s: () -> Boolean) {
|
||||||
|
s()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
//FILE: 2.kt
|
||||||
|
import test.*
|
||||||
|
|
||||||
|
fun box(): String {
|
||||||
|
var result = "fail"
|
||||||
|
|
||||||
|
annotatedWith { result = "OK"; true }
|
||||||
|
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
inline fun test(z: () -> Unit) {
|
||||||
|
z()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// FILE: 2.smap
|
||||||
|
//PROBLEM of KT-11478 in additional line mapping for default source (so 'single' was replaces with 'first' in SMAP class init):
|
||||||
|
//*L
|
||||||
|
//1#1,15:1
|
||||||
|
//17#1:19
|
||||||
|
|
||||||
|
|
||||||
|
SMAP
|
||||||
|
2.kt
|
||||||
|
Kotlin
|
||||||
|
*S Kotlin
|
||||||
|
*F
|
||||||
|
+ 1 2.kt
|
||||||
|
_2Kt
|
||||||
|
+ 2 1.kt
|
||||||
|
test/_1Kt
|
||||||
|
*L
|
||||||
|
1#1,18:1
|
||||||
|
9#2:19
|
||||||
|
5#2:20
|
||||||
|
*E
|
||||||
|
|
||||||
|
SMAP
|
||||||
|
1.kt
|
||||||
|
Kotlin
|
||||||
|
*S Kotlin
|
||||||
|
*F
|
||||||
|
+ 1 1.kt
|
||||||
|
test/_1Kt$annotatedWith2$1
|
||||||
|
+ 2 1.kt
|
||||||
|
test/_1Kt
|
||||||
|
+ 3 2.kt
|
||||||
|
_2Kt
|
||||||
|
*L
|
||||||
|
1#1,17:1
|
||||||
|
21#1:23
|
||||||
|
13#2,2:18
|
||||||
|
5#2:18
|
||||||
|
18#2:19
|
||||||
|
9#2:20
|
||||||
|
19#2,2:20
|
||||||
|
7#3:22
|
||||||
|
*E
|
||||||
@@ -1865,6 +1865,12 @@ public class BlackBoxInlineCodegenTestGenerated extends AbstractBlackBoxInlineCo
|
|||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/smap/anonymous/objectOnInlineCallSiteWithCapture.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/smap/anonymous/objectOnInlineCallSiteWithCapture.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("severalMappingsForDefaultFile.kt")
|
||||||
|
public void testSeveralMappingsForDefaultFile() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/smap/anonymous/severalMappingsForDefaultFile.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/boxInline/smap/inlineOnly")
|
@TestMetadata("compiler/testData/codegen/boxInline/smap/inlineOnly")
|
||||||
|
|||||||
+6
@@ -1865,6 +1865,12 @@ public class CompileKotlinAgainstInlineKotlinTestGenerated extends AbstractCompi
|
|||||||
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/smap/anonymous/objectOnInlineCallSiteWithCapture.kt");
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/smap/anonymous/objectOnInlineCallSiteWithCapture.kt");
|
||||||
doTest(fileName);
|
doTest(fileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@TestMetadata("severalMappingsForDefaultFile.kt")
|
||||||
|
public void testSeveralMappingsForDefaultFile() throws Exception {
|
||||||
|
String fileName = KotlinTestUtils.navigationMetadata("compiler/testData/codegen/boxInline/smap/anonymous/severalMappingsForDefaultFile.kt");
|
||||||
|
doTest(fileName);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@TestMetadata("compiler/testData/codegen/boxInline/smap/inlineOnly")
|
@TestMetadata("compiler/testData/codegen/boxInline/smap/inlineOnly")
|
||||||
|
|||||||
Reference in New Issue
Block a user