Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: 'when' expression must be exhaustive. Kotlin 1.7.10 #1195

Conversation

ffedelefrsf
Copy link
Contributor

fix: 'when' expression must be exhaustive, add necessary 'UpiAwaitNotification' branch or 'else' branch instead

When upgrading Kotlin version to 1.7.10, this error show up. So an 'else' condition is added in order to make the library compile again. It could easily be another specific case that contemplates 'UpiAwaitNotification' as well.

Summary

When upgrading Kotlin version to 1.7.10, this error show up. So an 'else' condition is added in order to make the library compile again. It could easily be another specific case that contemplates 'UpiAwaitNotification' as well.

Motivation

I believe this is a needed change for the library compatibility with Kotlin 1.7.10 new version. At least it was necessary for my project to build again.

Testing

  • [ x ] I tested this manually
  • I added automated tests

Documentation

Select one:

  • [ x ] I have added relevant documentation for my changes.
  • This PR does not result in any developer-facing changes.

…ification' branch or 'else' branch instead

When upgrading Kotlin version to 1.7.10, this error show up. So an 'else' condition is added in order to make the library compile again. It could easily be another specific case that contemplates 'UpiAwaitNotification' as well.
@CLAassistant
Copy link

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

Copy link
Collaborator

@charliecruzan-stripe charliecruzan-stripe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

let's add an explicit case for this instead. It makes it easy to catch new NextActionType in the future 🔍

@justinadkins
Copy link

justinadkins commented Nov 11, 2022

Thank you @ffedelefrsf! I'm experiencing this issue as well. Our dirty hack until now:

allprojects { project ->
    // ...
    if (project.name.contains("stripe-react-native")) {
        tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach { t ->
            kotlinOptions {
                freeCompilerArgs += "-XXLanguage:-ProhibitNonExhaustiveWhenOnAlgebraicTypes"
            }
        }
    }
}

@charliecruzan-stripe
Copy link
Collaborator

Tests are failing for an unrelated reason, have it fixed on a feature branch so merging this. thanks @ffedelefrsf !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants