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

add else to when #869

Merged
merged 3 commits into from
Mar 15, 2022
Merged

add else to when #869

merged 3 commits into from
Mar 15, 2022

Conversation

sangyongchoi
Copy link
Contributor

Hello.
I know this will be updated in Kotlin 1.6.

We will soon prohibit non-exhaustive when statements to make the behavior consistent with when expressions. To ensure smooth migration, Kotlin 1.6.0 reports warnings about non-exhaustive when statements with an enum, sealed, or Boolean subject. These warnings will become errors in future releases.

It seems to be a violation of this, so I will correct it and PR.
thank you.

@google-cla
Copy link

google-cla bot commented Feb 23, 2022

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

For more information, open the CLA check for this pull request.

@ting-yuan
Copy link
Collaborator

Thanks! Could you sign the CLA so that we can merge it?

@@ -235,41 +235,41 @@ internal fun ModuleClassResolver.resolveContainingClass(psiMethod: PsiMethod): C
}

internal fun getInstanceForCurrentRound(node: KSNode): KSNode? {
when (node.origin) {
return when (node.origin) {
Origin.KOTLIN_LIB, Origin.JAVA_LIB -> return null
Copy link
Collaborator

Choose a reason for hiding this comment

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

Could you remove the return in return null?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

done.

thank you for telling me

Copy link
Collaborator

@ting-yuan ting-yuan left a comment

Choose a reason for hiding this comment

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

Thanks!

@neetopia
Copy link
Contributor

can you fix the ktlint error?

@sangyongchoi
Copy link
Contributor Author

can you fix the ktlint error?

@neetopia done.

@neetopia
Copy link
Contributor

Thanks! I will merge once CI is finished.

@neetopia neetopia merged commit 504e184 into google:main Mar 15, 2022
@neetopia
Copy link
Contributor

Merged, thanks for your PR!

github-actions bot pushed a commit that referenced this pull request Mar 15, 2022
* add else to when
* remove the return in return null

(cherry picked from commit 504e184)
ting-yuan pushed a commit to ting-yuan/ksp that referenced this pull request Apr 8, 2022
* add else to when
* remove the return in return null

(cherry picked from commit 504e184)
ting-yuan pushed a commit that referenced this pull request Apr 8, 2022
* add else to when
* remove the return in return null

(cherry picked from commit 504e184)
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.

3 participants