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.
this change fix issue with inlining lambda in inline function which(function) inlined from other library.
E.g.
class __helper(val v:Int)
inline fun foo(h: __helper): Int {
val sum = h.op {
_special_class(it.v)
}.v
return sum
}
inline fun __helper.op(block:(_special_class1) -> _special_class) = block(_special_class1(v))
Here how the incorrect parent affects debug information:
(lldb) target create "program.kexe"
Current executable set to '/Users/minamoto/ws/kotlin-native/program.kexe' (x86_64).
(lldb) command source -s 0 'i-test.lldb'
Executing commands in '/Users/minamoto/ws/kotlin-native/i-test.lldb'.
(lldb) b i-lib.kt:8
Breakpoint 1: where = program.kexe`kfun:#main(){} + 435 [inlined] foo + 98 at i-main.kt:3, address = 0x00000001000540e3
(lldb) r
Process 70550 stopped
frame #0: 0x00000001000540e3 program.kexe`kfun:#main(){} [inlined] foo at i-lib.kt:9:7
6 inline fun foo(h: __helper): Int {
7 val sum = h.op {
8 _special_class(it.v)
-> 9 }.v
^
10 return sum
11 }
12
Target 0: (program.kexe) stopped.
the parent of lambda is i-main.kt instead of i-lib.kt, and offsets calculated against wrong file.
Here is behaviour with fix:
(lldb) target create "program.kexe"
Current executable set to '/Users/minamoto/ws/.git-trees/minamoto/debug-info/subprograms-with-missed-scopes/program.kexe' (x86_64).
(lldb) command source -s 0 '/Users/minamoto/ws/kotlin-native/i-test.lldb'
Executing commands in '/Users/minamoto/ws/kotlin-native/i-test.lldb'.
(lldb) b i-lib.kt:8
Breakpoint 1: where = program.kexe`kfun:#main(){} + 337 [inlined] _2 at i-lib.kt:14, address = 0x0000000100054bb1
(lldb) r
Process 70560 stopped
frame #0: 0x0000000100054bb1 program.kexe`kfun:#main(){} [inlined] _2 at i-lib.kt:8:24
5
6 inline fun foo(h: __helper): Int {
7 val sum = h.op {
-> 8 _special_class(it.v)
^
9 }.v
10 return sum
11 }
Target 0: (program.kexe) stopped.