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

Defer infer bool param #10761

Open
wants to merge 1 commit into
base: 2.13.x
Choose a base branch
from
Open

Conversation

som-snytt
Copy link
Contributor

The previous tweak to take if (_) as if (_: Boolean) is too strict.

That disallowed

BooleanSetting().("-nowarn").withPostSetHook(if(_) maxwarns.value=0)

Follow-up to #7707

Noticed previously

This might be perfectly normal, but I wanted to do this, then remembered the param is a setting not a boolean, but I noticed the message is suboptimal:

[error] .../nsc/settings/StandardScalaSettings.scala:54:127: type mismatch;
[error]  found   : Boolean => Unit
[error]  required: stabilizer$1.type => Unit
[error]   val nowarn =         BooleanSetting ("-nowarn", "Generate no warnings.") withAbbreviation "--no-warnings" withPostSetHook { if (_) maxwarns.value = 0 }
[error]  

The previous tweak to take `if (_)` as `if (_: Boolean)` is too strict.

That disallowed

BooleanSetting().("-nowarn").withPostSetHook(if(_) maxwarns.value=0)
@scala-jenkins scala-jenkins added this to the 2.13.15 milestone Apr 19, 2024
@som-snytt som-snytt marked this pull request as ready for review April 23, 2024 00:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants