Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 43ea3197 authored by Ale Nijamkin's avatar Ale Nijamkin
Browse files

[flexiglass] Fix type inference issue in SysUiViewModelTest

In SysUiViewModelTest, not explicitly specifying the expected type runs
into a limitation where the Kotlin compiler appears to be unable to correctly infer
the return type of the rememberViewModel factory. It thinks it's Unit instead of FakeSysUiViewModel.

This change explicitly declares the type of the view model variable
to work around this issue, allowing the test to compile and run
correctly.

Bug: 434169789
Bug: 432549544
Flag: com.android.systemui.scene_container
Test: ran SysUiViewModelTest which was failing on head before this change, verifying that it now passes.
Change-Id: I58fb143088434fe9fc72438a0b8a7026305851c5
parent 388f0cd6
Loading
Loading
Loading
Loading
+11 −6
Original line number Diff line number Diff line
@@ -52,6 +52,11 @@ class SysUiViewModelTest : SysuiTestCase() {
        composeRule.setContent {
            val keepAlive by keepAliveMutable
            if (keepAlive) {
                // Need to explicitly state the type to avoid a weird issue where the factory seems
                // to
                // return Unit instead of FakeSysUiViewModel. It might be an issue with the compose
                // compiler.
                val unused: FakeSysUiViewModel =
                    rememberViewModel("test") {
                        FakeSysUiViewModel(
                            onActivation = { isActive = true },