Skip to content

Fix #9801: Make sure the errors are reported #9813

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

Merged
merged 1 commit into from
Sep 17, 2020

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

@@ -0,0 +1 @@
def test: Unit = loop(4) // error
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Now, this reports correctly the NPE

-- Error: tests/pos-macros/i9801/Test_2.scala:1:21 ---------------------------------------------------------------------
1 |def test: Unit = loop(4)
  |                 ^^^^^^^
  |       Exception occurred while executing macro expansion.
  |       java.lang.NullPointerException
  |             at dotty.tools.dotc.reporting.Message.dropNonSensical(Message.scala:65)
  |             at dotty.tools.dotc.reporting.Message.message(Message.scala:78)
  |             at dotty.tools.dotc.reporting.Message.isNonSensical(Message.scala:90)
  |             at dotty.tools.dotc.reporting.HideNonSensicalMessages.isHidden(HideNonSensicalMessages.scala:16)
  |             at dotty.tools.dotc.reporting.HideNonSensicalMessages.isHidden$(HideNonSensicalMessages.scala:10)
  |             at dotty.tools.dotc.reporting.TestReporter.isHidden(TestReporter.scala:18)
  |             at dotty.tools.dotc.reporting.Reporter.report(Reporter.scala:148)
  |             at dotty.tools.dotc.report$.error(report.scala:71)
  |             at dotty.tools.dotc.quoted.reflect.ReflectionCompilerInterface.error(ReflectionCompilerInterface.scala:90)
  |             at dotty.tools.dotc.quoted.QuoteContextImpl$$anon$1.error(QuoteContextImpl.scala:42)
  |             at Macro_1$package$.impl(Macro_1.scala:18)
  |
  | This location contains code that was inlined from Test_2.scala:2

inlined at Test_2.scala:1:

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Notice that in this particular case the user passed a null into the reporting which made the reporting itself fail.

Copy link
Contributor

Choose a reason for hiding this comment

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

You mean e.getMessage returns null?

Copy link
Contributor

@liufengyun liufengyun left a comment

Choose a reason for hiding this comment

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

LGTM

@@ -0,0 +1 @@
def test: Unit = loop(4) // error
Copy link
Contributor

Choose a reason for hiding this comment

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

You mean e.getMessage returns null?

@nicolasstucki nicolasstucki merged commit 6766ebd into scala:master Sep 17, 2020
@nicolasstucki nicolasstucki deleted the fix-#9801 branch September 17, 2020 13:18
@Kordyjan Kordyjan added this to the 3.0.0 milestone Aug 2, 2023
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.

Stackoverflow in Macrocode interacts with Pickler
3 participants