Commit dcd3e56
committed
Fix @single(createdAtStart=true) silently dropped on definition functions
@module(createdAtStart) and @singleton classes were fixed in RC3.13, but
buildFunctionDefinitionCall — the path for @Single/@singleton definition FUNCTIONS
inside a @module — never propagated the per-definition createdAtStart flag. The
generated buildSingle(...) fell back to the Kotlin default-arg trampoline (false),
so eager init was silently lost (koin#2425/#2415).
Propagate createdAtStart to buildSingle for SINGLE function definitions, mirroring
the class- and top-level-function builders.
Adds box regression test single_fun_created_at_start with a NON-eager @module (so
the module-level flag can't mask the per-definition one): asserts the eager fun is
constructed at createEagerInstances() and the lazy fun is not. Behaviorally proven
(pre-fix: eagerCtor=0 / fails; post-fix: passes). Full box suite green.
Fixes #2425, #24151 parent 238743a commit dcd3e56
5 files changed
Lines changed: 467 additions & 0 deletions
File tree
- koin-compiler-plugin
- src/org/koin/compiler/plugin/ir
- test-gen/org/jetbrains/kotlin/compiler/plugin/template/runners
- testData/box/annotations
Lines changed: 12 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
211 | 211 | | |
212 | 212 | | |
213 | 213 | | |
| 214 | + | |
| 215 | + | |
| 216 | + | |
| 217 | + | |
| 218 | + | |
| 219 | + | |
| 220 | + | |
| 221 | + | |
| 222 | + | |
| 223 | + | |
| 224 | + | |
| 225 | + | |
214 | 226 | | |
215 | 227 | | |
216 | 228 | | |
| |||
Lines changed: 6 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
42 | 42 | | |
43 | 43 | | |
44 | 44 | | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
45 | 51 | | |
46 | 52 | | |
47 | 53 | | |
| |||
0 commit comments