-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed
Labels
area:lintingLinting warnings enabled with -W or -XlintLinting warnings enabled with -W or -Xlintitype:bug
Milestone
Description
Compiler version
3.3.1
Minimized code
//> using scala "3.3.1"
//> using options -Wnonunit-statement -Werror
class Context
object Foo {
def run(program: Context ?=> String): Unit = ???
}
def bar(using Context): String = ???
@main def run = Foo.run:
bar
bar
Output - givens not available, no linting warn:
Compiling project (Scala 3.3.1, JVM)
[error] ./Foo.scala:13:6
[error] No given instance of type Context was found for parameter x$1 of method bar
[error] bar
[error] ^
[error] ./Foo.scala:14:6
[error] No given instance of type Context was found for parameter x$1 of method bar
[error] bar
[error] ^
Error compiling project (Scala 3.3.1, JVM)
Removing -Werror
causes the givens to be available again, and unused warn is reported:
Compiling project (Scala 3.3.1, JVM)
[warn] ./Foo.scala:13:3
[warn] unused value of type String
[warn] bar
[warn] ^^^
Compiled project (Scala 3.3.1, JVM)
Reported in VirtusLab/besom#200
Expectation
Givens should be available, and linting error should be reported.
Metadata
Metadata
Assignees
Labels
area:lintingLinting warnings enabled with -W or -XlintLinting warnings enabled with -W or -Xlintitype:bug
Type
Projects
Relationships
Development
Select code repository
Activity
[-]Adding -Werror to -Wnonunit-statement can cause givens to not be available anymre[/-][+]Adding -Werror to -Wnonunit-statement can cause givens to not be available anymore[/+][-]Adding -Werror to -Wnonunit-statement can cause givens to not be available anymore[/-][+]Adding -Werror to -Wnonunit-statement can cause givens not to be available anymore[/+]Add regression test for issue 18632 (#20308)