Skip to content

Conversation

@Atry
Copy link
Contributor

@Atry Atry commented Feb 16, 2022

No description provided.

@Atry Atry force-pushed the print-widecard-star branch from a666eae to 6dc9c0b Compare February 16, 2022 08:27
@romanowski romanowski requested a review from odersky February 16, 2022 14:47
Copy link
Contributor

@romanowski romanowski left a comment

Choose a reason for hiding this comment

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

Looks good to me but @odersky or @nicolasstucki should review as well

@Atry Atry force-pushed the print-widecard-star branch from 2b59e53 to 7b283fc Compare February 17, 2022 05:19
@Atry Atry force-pushed the print-widecard-star branch from 7b283fc to d5cd781 Compare February 17, 2022 05:23
// avoid the double `*` in this case.
toText(expr)
case _ =>
toText(expr) ~ "*"
Copy link
Member

Choose a reason for hiding this comment

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

* instead of _: * is valid syntax in Scala 3.

Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it should be "*", not ": *"

keywordStr("throw ") ~ toText(expr)
}
case SeqLiteral(elems, elemtpt) =>
"[" ~ toTextGlobal(elems, ",") ~ " : " ~ toText(elemtpt) ~ "]"
Copy link
Member

Choose a reason for hiding this comment

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

A SeqLiteral is a specific kind of tree node, when debugging the compiler output with -Xprint, it's useful to be able to distinguish a SeqLiteral produced by the compiler from a Seq tree written by the user. If this doesn't appear in something that the compiler prints to the user then I don't think it should be changed.

Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with @smarter. We should at least retain the old output under -Yprint-debug

@Atry
Copy link
Contributor Author

Atry commented Feb 19, 2022 via email

@smarter
Copy link
Member

smarter commented Feb 19, 2022

OK, I don't know what the intended purpose of codeOf is, but if it's supposed to produce code that compiles, it shouldn't rely on RefinedPrinter only.

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.

Overall, I don't see that this improves things. I believe it would be good to make an effort to get to a printer that only outputs code that can be parsed back.

But there is a natural tension between that and diagnostics that give more information. So rather than fiddling with details I believe we need an overall strategy how we can get to such a printer without duplicating a huge amount of code.

// avoid the double `*` in this case.
toText(expr)
case _ =>
toText(expr) ~ "*"
Copy link
Contributor

Choose a reason for hiding this comment

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

Yes, it should be "*", not ": *"

keywordStr("throw ") ~ toText(expr)
}
case SeqLiteral(elems, elemtpt) =>
"[" ~ toTextGlobal(elems, ",") ~ " : " ~ toText(elemtpt) ~ "]"
Copy link
Contributor

Choose a reason for hiding this comment

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

Agree with @smarter. We should at least retain the old output under -Yprint-debug

@smarter
Copy link
Member

smarter commented Feb 21, 2022

@nicolasstucki
Copy link
Contributor

showDecompiledTree works for this use case, but the formatting would be a bit different. The code shown would be the fully elaborated code. This implies that all prefixes would be fully expanded.

@ckipp01
Copy link
Member

ckipp01 commented May 10, 2023

Hey @Atry do you plan on returning back to this?

@ckipp01
Copy link
Member

ckipp01 commented Jun 7, 2023

Hey @Atry do you plan on returning back to this?

Alright, since it's been a month and I haven't heard back I'm going to go ahead and close this. Please do return back if you're interested! I'll link #14495 so it can be found later on as well.

@ckipp01 ckipp01 closed this Jun 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

6 participants