Skip to content

Fix #4674: Do not emit waring if types are the same #4684

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

Merged
merged 2 commits into from
Jun 19, 2018

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

@allanrenucci
Copy link
Contributor

Well, I would say the warning is legitimate

@nicolasstucki
Copy link
Contributor Author

Maybe I should improve the warning message instead.

val msg = s"The highlighted type test will always succeed since the scrutinee type ($foundCls) is a subtype of ${testCls}"
val msg =
if (foundCls != testCls) s"The highlighted type test will always succeed since the scrutinee type ($foundCls) is a subtype of $testCls"
else s"The highlighted type test has the same type ($foundCls) as the scrutinee"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't understand the message. Did you mean something like

The highlighted type test will always succeed since the scrutinee type ($foundCls) is the same as the tested type

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, I will change it to make it clearer.

val msg = s"The highlighted type test will always succeed since the scrutinee type ($foundCls) is a subtype of ${testCls}"
val msg =
if (foundCls != testCls) s"The highlighted type test will always succeed since the scrutinee type ($foundCls) is a subtype of $testCls"
else s"The highlighted type test will always succeed since the scrutinee type ($foundCls) is the same as the tested type"
Copy link
Contributor

Choose a reason for hiding this comment

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

nitpick:

val msg = {
  val addendum =
    if (foundCls != testCls) s" is a subtype of $testCls"
    else " is the same as the tested type"
  s"The highlighted type test will always succeed since the scrutinee type ($foundCls)" + addendum
}

@nicolasstucki nicolasstucki self-assigned this Jun 19, 2018
@nicolasstucki nicolasstucki merged commit 3f69a4e into scala:master Jun 19, 2018
@allanrenucci allanrenucci deleted the fix-#4674 branch June 21, 2018 07:45
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.

2 participants