-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Fix colons in printer #1742
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
felixmulder
merged 4 commits into
scala:master
from
dotty-staging:topic/colon-in-printer
Nov 24, 2016
Merged
Fix colons in printer #1742
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
ccc671b
Add colon after method type, prefix def/val/var in REPL
b33c962
Update tests fixing contributor PR
felixmulder 08e1733
Fix defs not being printed correctly
felixmulder c52ffd7
Make `findTypes` take the `resultType` of `MethodType`
felixmulder 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
scala> def foo = 5 | ||
def foo: Int | ||
scala> def bar: String = "1" | ||
def bar: String | ||
scala> def baz() = 2 | ||
def baz(): Int | ||
scala> def qux(): Int = 2 | ||
def qux(): Int | ||
scala> :quit |
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,11 +1,11 @@ | ||
scala> import collection.mutable._ | ||
import collection.mutable._ | ||
scala> val buf = new ListBuffer[Int] | ||
buf: scala.collection.mutable.ListBuffer[Int] = ListBuffer() | ||
val buf: scala.collection.mutable.ListBuffer[Int] = ListBuffer() | ||
scala> buf += 22 | ||
res0: scala.collection.mutable.ListBuffer[Int] = ListBuffer(22) | ||
val res0: scala.collection.mutable.ListBuffer[Int] = ListBuffer(22) | ||
scala> buf ++= List(1, 2, 3) | ||
res1: scala.collection.mutable.ListBuffer[Int] = ListBuffer(22, 1, 2, 3) | ||
val res1: scala.collection.mutable.ListBuffer[Int] = ListBuffer(22, 1, 2, 3) | ||
scala> buf.toList | ||
res2: scala.collection.immutable.List[Int] = List(22, 1, 2, 3) | ||
val res2: scala.collection.immutable.List[Int] = List(22, 1, 2, 3) | ||
scala> :quit |
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> 1+1 | ||
res0: Int = 2 | ||
val res0: Int = 2 | ||
scala> :quit |
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,10 +1,10 @@ | ||
scala> val Const,x = 0 | ||
Const: Int = 0 | ||
x: Int = 0 | ||
scala> val Const, x = 0 | ||
val Const: Int = 0 | ||
val x: Int = 0 | ||
scala> val (Const, List(`x`, _, a), b) = (0, List(0, 1337, 1), 2) | ||
a: Int = 1 | ||
b: Int = 2 | ||
val a: Int = 1 | ||
val b: Int = 2 | ||
scala> val a@b = 0 | ||
a: Int @unchecked = 0 | ||
b: Int @unchecked = 0 | ||
val a: Int @unchecked = 0 | ||
val b: Int @unchecked = 0 | ||
scala> :quit |
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> try { 0 } catch { _: Throwable => 1 } | ||
res0: Int = 0 | ||
val res0: Int = 0 | ||
scala> :quit |
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,8 +1,8 @@ | ||
scala> var x = 0 | ||
x: Int = 0 | ||
var x: Int = 0 | ||
scala> x = x + 1 | ||
x: Int = 1 | ||
scala> x *= 2 | ||
scala> x | ||
res2: Int = 2 | ||
val res2: Int = 2 | ||
scala> :quit |
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.
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 was hesitant to do this. Looks very odd to me given that we initially created
x
as avar
.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.
Indeed, the REPL currently has semantics that are not well defined. There's no spec for it 😅
But, if you want to have a closer look at its semantics, by all means! We'd be happy to get something that is clearer :)