-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Add -Yprint-trees:diff
to make -Vprint
show diffs between phases
#9987
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
Conversation
bda56c4
to
7fe3dc9
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
TIL -Yprint-trees exists. LGTM.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think much of a test suite is needed, but how about including one smoke test, just to make sure the feature doesn't stop working entirely in the future?
build.sbt
Outdated
@@ -44,7 +44,8 @@ val jlineDep = "org.jline" % "jline" | |||
val jnaDep = "net.java.dev.jna" % "jna" % versionProps("jna.version") | |||
val jlineDeps = Seq(jlineDep, jnaDep) | |||
val testInterfaceDep = "org.scala-sbt" % "test-interface" % "1.0" | |||
val diffUtilsDep = "com.googlecode.java-diff-utils" % "diffutils" % "1.3.0" | |||
//val diffUtilsDep = "com.googlecode.java-diff-utils" % "diffutils" % "1.3.0" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
(remove commented-out line)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK, as usual, was afraid of losing visible info.
project/plugins.sbt
Outdated
@@ -23,6 +23,7 @@ libraryDependencies ++= Seq( | |||
"org.eclipse.jgit" % "org.eclipse.jgit" % "4.11.9.201909030838-r", | |||
"org.slf4j" % "slf4j-nop" % "1.7.36", | |||
"com.googlecode.java-diff-utils" % "diffutils" % "1.3.0", | |||
//"io.github.java-diff-utils" % "java-diff-utils" % "4.11", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
remove?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
oops, I see the comment was for the new jar, and the question was, Is the other jar needed here for some reason?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, it's used in build.sbt by the incredibly fragile scala/runtime
patch for test/instrumented
which should be renamed test/demented
. I couldn't remove an import at some point in the past because of this mechanism. I'll try to understand what to do now. (That's what I meant above by "the build task". I guess there is no urgency in updating that detail of the build.)
Is there anywhere this could/should be documented? At minimum, the PR should have a nice user-facing (meaning, compiler-hacker-facing) PR description, since this is where people'll land if they Google, if there isn't any other documentation. |
Does the underlying library support ANSI color, by any chance? would be cool to have the red/green for old/new above Lukas shows that |
-Yprint-trees:diff
to make -Vprint
show diffs between phases
2 weeks ago I started to say |
I got to ydiff by wanting to ask about colored output, then googling etc. |
When Lukas pulls the curtain away from the man who stands behind it. |
@som-snytt mind improving the PR description before we merge? |
I will follow up the clean up items. |
Also update the diff lib.
7fe3dc9
to
e792225
Compare
I was considering other print features, such as showing when synthetics are added, using Then we could say, Lukas has a sixth sense for synths since. |
When printing compiler ASTs with
-Yprint
, enable printing just thediff
by-Yprint-trees:diff
.That is useful when you don't need to see the whole tree, but you want to see when some feature is introduced into the tree, or observe only the changes at a phase.
Now
-Yprint-trees:help
reportsWhat do those words mean?
compact
isTree
DSL style.format
is less compact.text
means sourcelike.text+format
just outputs both styles.diff
is just a text-based diff of thetext
style.This PR also upgrades to the
difflib
the seems to have usurped the version from 2011.We ought to embrace our differences. Vive la différence.