https://kotlinlang.org logo
Title
t

TheMrCodes

03/09/2021, 9:22 PM
I encountered an very very strange bug were Compose or maybe the Kotlin Compiler ignores if conditions 😬 This happend the second time now and the first time I thought it's just a visual bug but in the second case it's definitly a problem. Has enyone encountered something simular? I'll post a video of the debugger flow in the Thread 🧵
Theres the video and I will try to create a minimal repo in the next days
j

jim

03/09/2021, 11:54 PM
Can you elaborate on the symptoms of the bug? Do you only see the issue in the debugger (ie. potential debugger bug) or does it impact the non-debugger code flow? If the later, what is the expected behavior in your minimal repro and what is the actual behavior?
t

TheMrCodes

03/10/2021, 8:03 AM
The sympom is unwanted behaviour. A part of code gets executed that should logically never been reched.
exitScreens[currentScreen]
always returns null so die condition should always be false and the statement to change screen should never been executed... but it does. It also shows visually but i choose the debugger because you can see the wrong execution easier. And the min Repo is just a copy of a few file from my project containing this bug. Excect file https://www.github.com/TheMrCodes/ComposeIfStatementBug/tree/master/src%2Fmain%2Fkotlin%2Fsystem%2Fnav%2FNavigator.kt
y

Yan Pujante

03/10/2021, 2:06 PM
Have you tried to run the clean target and then run? I know that sometimes I bump into issues when I am adding/removing code... like the compiler doesn't see all the changes and running clean/run fixes it.
t

TheMrCodes

03/10/2021, 2:11 PM
it happened on first build one the new project as well so I guess thats not the problem. But let me try it out later
Just had time to try it out cleaned and rebuild the whole gradle project.... but nothing it behaived just the same as before