Walker: bind generic functions and member properties (mutableStateOf, MutableState.value) #38
Copy link
Copy link
Closed
Description
Found while landing #18. pythonx-compose's declarative state (state() / .value, thisisthepy/pythonx-compose#11) needs androidx.compose.runtime.mutableStateOf and MutableState.value from Python. Today:
- any declaration mentioning a type parameter is declined (
resolveKotlinBoundary/renderKotlinTypeNameaccept only class classifiers), somutableStateOf<T>cannot bind; - the walker emits only FUNCTION and STATIC_GETTER entries (ArtifactScanner keeps ACC_STATIC methods), so no instance member properties;
- the binding layer's
_attachinstalls methods only, never data descriptors, and looks at the exact declared type only.
Decided (coordinator), Kotlin names only:
- Walker: substitute
Any?for unbounded, non-reified function type parameters; decline bounded or reified ones. - Walker: bind public, non-extension, non-@composable member properties of public classes/interfaces as GETTER/SETTER entries (
Owner.prop/Owner.prop=); setters only when all class type parameters are unbounded. Exclude GETTER/SETTER from the constructor-prefix collision rule and from overload disambiguation. - Binding layer: index GETTER/SETTER by owner type;
_attachinstallsproperty(fget, fset)with supertype lookup. - Stubs: typed properties (coordinate with Stubs: emit proxy classes with typed members instead of int handles #31).
- Fixture: include SnapshotStateKt plus State/MutableState; switch PythonContentRenderTest from the KSP
writeRootstand-in tostate.value = Root.
Risks to check explicitly: new generic bindings joining existing overload sets and changing mangled names tests rely on; table size growth over androidx.compose.ui (report before/after entry counts); the artifact fixture's "every table key is stubbed" invariant.
Completion: Python creates mutableStateOf(None), the host's PythonContent reads it, Python writes .value and the next frame shows the new root; all fixture modules and desktopTest green; entry-count delta reported.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels
Activity
b-re-w commentedon Oct 2, 2026
Scope addition (from #37): material-icons'
Icons.Default.Addis a top-level extension property (AddKt.getAdd(Icons$Filled)).ArtifactScanner.scanClassNodereads onlykmPackage.functions, never properties, so no getter is bound on theIcons.Filledreceiver. #38 therefore also covers extension-property getters: walker binds them with a property-read body, the binding layer serves them as a value on attribute read of the receiver proxy, stubs and the proxy layer handle the kind. Pin testMaterialIconsRenderTest.iconsDefaultAddIsUnreachableBecauseTheWalkerBindsNoExtensionPropertymust flip to a render test drawingIcon(Icons.Default.Add, contentDescription=None)from Python.Fix: Decline receivers with off-classpath supertypes, show reified fu…
Docs: Mark #38/#54 spec entries implemented after verification
b-re-w commentedon Oct 3, 2026
Landed in develop via #65.