-
Notifications
You must be signed in to change notification settings - Fork 1k
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
-Wunused:locals
gives false positives for structural types in local scopes
#17631
Comments
matil019
added
itype:bug
stat:needs triage
Every issue needs to have an "area" and "itype" label
labels
May 31, 2023
for comparison the following compiles in Scala 2.13.10 with no warnings, as expected: //> using option -Wunused:locals
//> using scala 2.13
package foo {
class Record(elems: (String, Any)*) {
private val fields = elems.toMap
def selectDynamic(name: String): Any = fields(name)
}
object Main {
locally {
def good: Person = ???
def bad1: Record { val name: String; val age: Int } = ???
def bad2 = (good: Record { val name: String; val age: Int })
(bad1, bad2)
}
}
}
package object foo {
type Person = Record { val name: String; val age: Int }
}
|
bishabosha
added
area:linting
Linting warnings enabled with -W or -Xlint
and removed
stat:needs triage
Every issue needs to have an "area" and "itype" label
labels
May 31, 2023
@KacperFKorban feel free to reassign, I saw you have worked on these warnings previously |
KacperFKorban
referenced
this issue
in dotty-staging/dotty
Jun 6, 2023
…type trees closes lampepfl#17631
Kordyjan
referenced
this issue
Nov 23, 2023
…type trees closes lampepfl#17631 [Cherry-picked eb0d6a2]
Kordyjan
referenced
this issue
Nov 29, 2023
…type trees closes lampepfl#17631 [Cherry-picked eb0d6a2]
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Compiler version
3.3.0
Minimized code
Compile it with:
Output
Expectation
No warnings are issued.
Note that removing the
locally
block and putting the definitions directly intoMain
suppresses the warnings, presumably because they are no longer local.The text was updated successfully, but these errors were encountered: