Add documentation on planned inline changes.
^KT-64570
This commit is contained in:
committed by
Space Team
parent
09713bb89e
commit
01c16ed736
@@ -0,0 +1,22 @@
|
||||
# Inline functions can refer unavailable declarations
|
||||
|
||||
```kotlin
|
||||
// libA
|
||||
fun fooA() = 5
|
||||
// libB: implementation depends on libA
|
||||
inline fun fooB() = fooA()
|
||||
// libC: implementation depends on libB, but not libA
|
||||
fun fooC() = fooB()
|
||||
```
|
||||
|
||||
There is a problem, while inlining `fooB` to `fooC`.
|
||||
|
||||
It contains call to `fooA`, but `fooA` doesn't exist for `fooC` compilation.
|
||||
|
||||
For jvm it is not a problem, as it would inline `invokestatic libAKt.foo` as is, without
|
||||
trying to understand what does it mean.
|
||||
|
||||
For current non-jvm it is not a problem, as it has all transitive dependencies at inlining time.
|
||||
|
||||
Unfortunately, if trying to inline on compile time over IR it would be the same problem as in klibs.
|
||||
And even worse, as jvm compilation doesn't (and can't) have IrLinker to fix this symbols later.
|
||||
Reference in New Issue
Block a user