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

Make -Xprompt work as desired under -Werror #19765

Merged
merged 1 commit into from
Feb 26, 2024

Conversation

dwijnand
Copy link
Member

Fixes #19713

@dwijnand
Copy link
Member Author

Tested manually with bin/scalac -Werror -Xprompt tests/warn/i15661.scala.

@dwijnand dwijnand marked this pull request as ready for review February 22, 2024 19:58
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I tried the same fix but it did not work. The problem is that the warning is emitted (sent to ConsoleReporter) only at the end of the compilation run.

Did you do an -Xprompt with abort and then check whether the stacktrace makes sense?

Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think I tried the same fix but it did not work. The problem is that the warning is emitted (sent to ConsoleReporter) only at the end of the compilation run.

Did you do an -Xprompt with abort and then check whether the stacktrace makes sense?

@odersky odersky assigned dwijnand and unassigned odersky Feb 24, 2024
@dwijnand
Copy link
Member Author

I don't think I looked closely. I'll check again, sorry.

@dwijnand
Copy link
Member Author

dwijnand commented Feb 25, 2024

Yes, using the example, it makes sense:

-- [E092] Pattern Match Unchecked Warning: tests/warn/i15661.scala:5:19 --------
5 |    case Composite(l: List[Int], v: Int) => println(v) // warn: type test for List[Int] cannot be checked at runtime
  |                   ^
  |the type test for List[Int] cannot be checked at runtime because its type arguments can't be determined from List[T$1]
  |
  | longer explanation available when compiling with `-explain`

a)bort, s)tack, r)esume: s
java.lang.Throwable
	at dotty.tools.dotc.reporting.Reporter$.loop$1(Reporter.scala:48)
	at dotty.tools.dotc.reporting.Reporter$.displayPrompt(Reporter.scala:56)
	at dotty.tools.dotc.reporting.ConsoleReporter.doReport(ConsoleReporter.scala:24)
	at dotty.tools.dotc.reporting.Reporter.issueUnconfigured(Reporter.scala:171)
	at dotty.tools.dotc.reporting.Reporter.go$1(Reporter.scala:181)
	at dotty.tools.dotc.reporting.Reporter.issueIfNotSuppressed(Reporter.scala:195)
	at dotty.tools.dotc.reporting.Reporter.report(Reporter.scala:207)
	at dotty.tools.dotc.report$.issueWarning(report.scala:24)
	at dotty.tools.dotc.report$.uncheckedWarning(report.scala:33)
	at dotty.tools.dotc.transform.TypeTestsCasts$.checkTypePattern(TypeTestsCasts.scala:397)
	at dotty.tools.dotc.transform.TypeTestsCasts$.interceptWith$1(TypeTestsCasts.scala:367)
	at dotty.tools.dotc.transform.TypeTestsCasts$.interceptTypeApply(TypeTestsCasts.scala:383)
	at dotty.tools.dotc.transform.Erasure$Typer.typedTypeApply(Erasure.scala:811)
	at dotty.tools.dotc.typer.Typer.typedUnnamed$1(Typer.scala:3137)

@dwijnand dwijnand assigned odersky and unassigned dwijnand Feb 25, 2024
Copy link
Contributor

@odersky odersky left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, not sure why I thought this did not work before. Let's try this!

@odersky odersky assigned dwijnand and unassigned odersky Feb 26, 2024
@dwijnand dwijnand merged commit 2664204 into scala:main Feb 26, 2024
19 checks passed
@dwijnand dwijnand deleted the Xprompt-under-Werror branch February 26, 2024 10:47
@Kordyjan Kordyjan added this to the 3.4.2 milestone Mar 28, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bring back behavior of -Xfatal-warnings
3 participants