Skip to content

Regression/4.1.0-Beta13: Scope Context changes during lookup of nested definitions #2231

Open
@SIMULATAN

Description

@SIMULATAN

Describe the bug
When attempting to lookup a definition in a certain Scope which depends on another definition declared in another Scope, the resolution context changes to that other Scope rather than staying in the original one.
Consequently, nested Factory declarations cannot access elements from the original scope.

This is because the logic changed between 4.1.0 Beta 11 and 13:
from a simple Scope#getOrNull to a more complex logic
(I linked the diff to 4.1.0 as the logic changed slightly between Beta13 and the final release)

Expected behavior
Dependencies are looked up from other Scopes as a fallback, but the original context prevails throughout the nested lookups.

Koin module and version:
koin-core:4.1.0

Snippet or Sample project to help reproduce
https://github.com/SIMULATAN/koin-scope-context-reproducer

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions