-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix(#19266): better warning for impure synthetic lambda in stmt position #19540
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?
Changes from 1 commit
c942f1f
a953135
8684632
ea306da
7330791
4b3e82b
62c569a
19e8865
f969d1a
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
object i19266: | ||
def fn1(x: Int, y: String = "y")(z: Double) = Some(s"$x$y$z") | ||
def fn2(x: Int)(y: String) = Some(s"$x$y") | ||
|
||
def checkCompile = | ||
fn1(1) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Scala 2.13.12 with Scala 2.13.12 without
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Do the following to unapplied methods used as value What characteristic allows us to assume unapplied methods are actually used as value?
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. https://github.com/lampepfl/dotty/blob/main/docs/_spec/06-expressions.md
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
(The emphasis is added by me) There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
// This should compile with warning | ||
fn2(2) | ||
val _ = fn2(3) |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
object i19266: | ||
def fn1(x: Int, y: String = "y")(z: Double) = Some(s"$x$y$z") | ||
def fn2(x: Int)(y: String) = Some(s"$x$y") | ||
|
||
def checkWarning = | ||
fn1(1) // warn | ||
fn2(2) // warn | ||
val a = fn2(3) // warn |
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.
note:
Uh oh!
There was an error while loading. Please reload this page.
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.
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.
f1(1)
is regarded as Block withValDef
statement andBlock
expr whereasf2(2)
is regarded asBlock
withDefDef
statement andClosure
.