Skip to content

Fix #9517: Do not print contents of ErrorType on -Xprint-types #9527

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
Aug 31, 2020

Conversation

nicolasstucki
Copy link
Contributor

No description provided.

@nicolasstucki nicolasstucki marked this pull request as ready for review August 10, 2020 17:23
@nicolasstucki nicolasstucki requested a review from smarter August 10, 2020 17:23
@smarter
Copy link
Member

smarter commented Aug 10, 2020

Hmm but seeing which error was assigned where could be useful. Why does it lead to an infinite compilation?

@@ -177,6 +177,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
keywordStr(" match ") ~ "{" ~ casesText ~ "}" ~
(" <: " ~ toText(bound) provided !bound.isAny)
}.close
case tp: PreviousErrorType if ctx.settings.XprintTypes.value =>
"<error>" // do not print previously reported error message because they may try to print this error type again recuresevely
case tp: ErrorType =>
s"<error ${tp.msg.rawMessage}>"
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The infinite recursion happens here. The message may print a tree that contains this error type again.

Copy link
Member

Choose a reason for hiding this comment

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

PlainPrinter already has some logic to avoid infinite loops with limiter and maxToTextRecursions, it'd be good to see if we can extend that to also account for the loops here

@smarter smarter assigned nicolasstucki and unassigned smarter Aug 13, 2020
@nicolasstucki nicolasstucki merged commit 3fb0516 into scala:master Aug 31, 2020
@nicolasstucki nicolasstucki deleted the fix-#9517 branch August 31, 2020 12:39
@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.

endless compilation (more than 500 seconds) for simple program with -Xprint-types
4 participants