- Notifications
You must be signed in to change notification settings - Fork 1.1k
Use PPrint to handle printing of REPL output values #23849
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
Changes from 28 commits
Commits
Show all changes
36 commits Select commit Hold shift + click to select a range
d03ac8f
.
lihaoyi 690ba71
.
lihaoyi e143442
.
lihaoyi cf81680
build libraries from source
lihaoyi 1be063a
build libraries from source
lihaoyi 2562be1
.
lihaoyi 96b6d03
.
lihaoyi 8351dbe
.
lihaoyi 4bcb2c5
.
lihaoyi 85f73ce
.
lihaoyi 8074f15
.
lihaoyi ce4e81d
.
lihaoyi f48a8d8
.
lihaoyi 5ac49a6
.
lihaoyi 10bb601
.
lihaoyi b79e803
.
lihaoyi f4b89d7
.
lihaoyi 2a4a1c1
.
lihaoyi cb90ed2
fix
lihaoyi a4cc58d
.
lihaoyi c7d109b
.
lihaoyi 8082a5d
.
lihaoyi 19fdaa1
fix
lihaoyi d098ca8
fix
lihaoyi 236abf2
.
lihaoyi 0e78df2
.
lihaoyi 7118ce2
.
lihaoyi 94e599a
.
lihaoyi 22aa06c
.
lihaoyi f526951
.
lihaoyi 2e7fef6
.
lihaoyi 49f5726
.
lihaoyi 2fda5e1
.
lihaoyi 4d1139c
.
lihaoyi 38831b7
.
lihaoyi 347bdd9
.
lihaoyi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
scala> def o(s: String) = "o"; def oo(s: String) = "oo"; val o = "o"; val oo = "oo" | ||
def o(s: String): String | ||
def oo(s: String): String | ||
val o: String = o | ||
val oo: String = oo | ||
val o: String = "o" | ||
val oo: String = "oo" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
scala> val d: Long = (new java.sql.Date(100L)).getTime | ||
val d: Long = 100 | ||
val d: Long = 100L |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,2 @@ | ||
scala> scala.compiletime.codeOf(1+2) | ||
val res0: String = 1 + 2 | ||
val res0: String = "1 + 2" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
scala> print("foo") | ||
foo | ||
scala> "Hello" | ||
val res0: String = Hello | ||
val res0: String = "Hello" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
scala> val foo = "1"; foo.toInt | ||
val foo: String = 1 | ||
val foo: String = "1" | ||
val res0: Int = 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions 4 compiler/test-resources/repl/settings-repl-max-print-characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
scala> 1.to(10).mkString | ||
val res0: String = 12345678910 | ||
val res0: String = "12345678910" | ||
| ||
scala>:settings -Vrepl-max-print-characters:10 | ||
| ||
scala> 1.to(10).mkString | ||
val res1: String = 123456789 ... large output truncated, print value to show all | ||
val res1: String = "12345678910" | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. The old |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit. This suggestion is invalid because no changes were made to the code. Suggestions cannot be applied while the pull request is closed. Suggestions cannot be applied while viewing a subset of changes. Only one suggestion per line can be applied in a batch. Add this suggestion to a batch that can be applied as a single commit. Applying suggestions on deleted lines is not supported. You must change the existing code in this line in order to create a valid suggestion. Outdated suggestions cannot be applied. This suggestion has been applied or marked resolved. Suggestions cannot be applied from pending reviews. Suggestions cannot be applied on multi-line comments. Suggestions cannot be applied while the pull request is queued to merge. Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.
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.
Not sure what's happening here before this PR, but there must be some super sketchy stdout-regexing happening to mangle the
.toString
so it looks different whenreturn
ed orprintln
-ed.The new behavior is probably better: we special case
return
ing because it usespprint
,println
is justprintln
, and if someone wantspprint
themselves they can usedotty.shaded.pprint.log
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 guess it's because https://github.com/scala/scala3/blob/main/compiler/src/dotty/tools/dotc/core/StdNames.scala#L30
Looks fine