Sorry that I missed this before! I answered in this post, but I’ll note something similar here as well in case anyone else runs into this.
My take is that the unreachable code “error” is actually incorrect and just the linter getting confused by the nullability of previousPlayer
and currentPlayer
. If I put the same logic into a Kotlin command-line app, it works just fine, and if you refactor the when
block to skip the subject, that also works fine.