-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Lint function arrow intended context function #23847
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
base: main
Are you sure you want to change the base?
Conversation
@@ -168,6 +168,7 @@ private sealed trait WarningSettings: | |||
private val WunstableInlineAccessors = BooleanSetting(WarningSetting, "WunstableInlineAccessors", "Warn an inline methods has references to non-stable binary APIs.") | |||
private val WtoStringInterpolated = BooleanSetting(WarningSetting, "Wtostring-interpolated", "Warn a standard interpolator used toString on a reference type.") | |||
private val WrecurseWithDefault = BooleanSetting(WarningSetting, "Wrecurse-with-default", "Warn when a method calls itself with a default argument.") | |||
private val WdubiousContextual = BooleanSetting(WarningSetting, "Wdubious-contextual", "Warn about T ?=> (t: T) => U.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private val WdubiousContextual = BooleanSetting(WarningSetting, "Wdubious-contextual", "Warn about T ?=> (t: T) => U.") | |
private val WunlikelyContextual = BooleanSetting(WarningSetting, "Wunlikely-contextual", "Warn about T ?=> (t: T) => U. when a normal function literal was used instead of context one."), |
just because the word is prone to typos for non english speakers and a bit more explanation aside from signature?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I rely on -Xlint
or now -Wall
. Though I do like the word "dubious". All warnings are dubious because they begin with -W
or "dubya".
4684bed
to
f1d5ced
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, just two minor nitpicks
@@ -168,6 +168,7 @@ private sealed trait WarningSettings: | |||
private val WunstableInlineAccessors = BooleanSetting(WarningSetting, "WunstableInlineAccessors", "Warn an inline methods has references to non-stable binary APIs.") | |||
private val WtoStringInterpolated = BooleanSetting(WarningSetting, "Wtostring-interpolated", "Warn a standard interpolator used toString on a reference type.") | |||
private val WrecurseWithDefault = BooleanSetting(WarningSetting, "Wrecurse-with-default", "Warn when a method calls itself with a default argument.") | |||
private val WdubiousContextual = BooleanSetting(WarningSetting, "Wwrong-arrow", "Warn if function arrow was used instead of context literal ?=>.") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
private val WdubiousContextual = BooleanSetting(WarningSetting, "Wwrong-arrow", "Warn if function arrow was used instead of context literal ?=>.") | |
private val WwrongArrow = BooleanSetting(WarningSetting, "Wwrong-arrow", "Warn if function arrow was used instead of context literal ?=>.") |
@@ -311,6 +312,7 @@ private sealed trait WarningSettings: | |||
def unstableInlineAccessors(using Context): Boolean = allOr(WunstableInlineAccessors) | |||
def toStringInterpolated(using Context): Boolean = allOr(WtoStringInterpolated) | |||
def recurseWithDefault(using Context): Boolean = allOr(WrecurseWithDefault) | |||
def dubiousContextual(using Context): Boolean = allOr(WdubiousContextual) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
def dubiousContextual(using Context): Boolean = allOr(WdubiousContextual) | |
def wrongArrow(using Context): Boolean = allOr(WdubiousContextual) |
Fixes #21187
If a function literal
x => body
has an expected typeX ?=> ?
then maybe they intended to writex ?=> body
.As shown in the test, maybe types will misalign in other ways to emit warnings.