-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14602 from griggt/fix-14576
Fix #14576: Ensure unreported warning summaries are also emitted via sbt-bridge
- Loading branch information
Showing
18 changed files
with
113 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
// lampepfl/dotty#14576, Writer is in a separate file and not declared `open` | ||
// under -source:future this requires -language:adhocExtensions | ||
class ExtWriter extends Writer | ||
|
||
class Text(val str: String) | ||
|
||
object Test: | ||
// lampepfl/dotty#14500, requires implicitConversions feature | ||
given Conversion[String, Text] = Text(_) | ||
def f(x: Text) = println(x.str) | ||
f("abc") | ||
|
||
// private[this] and = _ are deprecated under -source:future | ||
private[this] var x: AnyRef = _ | ||
|
||
// under -source:future, `_` is deprecated for wildcard arguments of types: use `?` instead | ||
val xs: List[_] = Nil |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
class Writer |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
import sbt.internal.util.ConsoleAppender | ||
|
||
scalaVersion := sys.props("plugin.scalaVersion") | ||
|
||
lazy val assertFeatureSummary = taskKey[Unit]("checks that feature warning summary is emitted") | ||
lazy val assertNoFeatureSummary = taskKey[Unit]("checks that no feature warning summary is emitted") | ||
lazy val assertDeprecationSummary = taskKey[Unit]("checks that deprecation warning summary is emitted") | ||
lazy val assertNoDeprecationSummary = taskKey[Unit]("checks that no deprecation warning summary is emitted") | ||
lazy val resetMessages = taskKey[Unit]("empties the messages list") | ||
|
||
lazy val root = (project in file(".")) | ||
.settings( | ||
scalacOptions += "-source:future", | ||
extraAppenders := { s => Seq(ConsoleAppender(FakePrintWriter)) }, | ||
assertFeatureSummary := { | ||
assert { | ||
FakePrintWriter.messages.exists(_.contains("there were 2 feature warnings; re-run with -feature for details")) | ||
} | ||
}, | ||
assertNoFeatureSummary := { | ||
assert { | ||
FakePrintWriter.messages.forall(!_.contains("; re-run with -feature for details")) | ||
} | ||
}, | ||
assertDeprecationSummary := { | ||
assert { | ||
FakePrintWriter.messages.exists(_.contains("there were 3 deprecation warnings; re-run with -deprecation for details")) | ||
} | ||
}, | ||
assertNoDeprecationSummary := { | ||
assert { | ||
FakePrintWriter.messages.forall(!_.contains("; re-run with -deprecation for details")) | ||
} | ||
}, | ||
resetMessages := { | ||
FakePrintWriter.resetMessages | ||
}, | ||
) |
6 changes: 6 additions & 0 deletions
6
sbt-test/compilerReporter/i14576/project/FakePrintWriter.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
object FakePrintWriter extends java.io.PrintWriter("fake-print-writer") { | ||
@volatile var messages = List.empty[String] | ||
def resetMessages = messages = List.empty[String] | ||
override def println(x: String): Unit = messages = x :: messages | ||
override def print(x: String): Unit = messages = x :: messages | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
> compile | ||
> assertFeatureSummary | ||
> assertDeprecationSummary | ||
|
||
> resetMessages | ||
|
||
> set scalacOptions += "-feature" | ||
> compile | ||
> assertNoFeatureSummary | ||
> assertDeprecationSummary | ||
|
||
> resetMessages | ||
|
||
> set scalacOptions += "-deprecation" | ||
> compile | ||
> assertNoFeatureSummary | ||
> assertNoDeprecationSummary | ||
|
||
> resetMessages |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
import scala.language.implicitConversions | ||
|
||
class LazyList[A] | ||
|
||
object LazyList { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
there was 1 deprecation warning; re-run with -deprecation for details |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -25,4 +25,4 @@ object MacroUtils: | |
|
||
end Extractors | ||
end MacroUtils | ||
|
||
// nopos-error |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters