Skip to content

Fix #5855: Print given for contextual function types #5864

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 2 commits into from
Feb 6, 2019
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala
Original file line number Diff line number Diff line change
Expand Up @@ -183,7 +183,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
"<noprefix>"
case tp: MethodType =>
changePrec(GlobalPrec) {
(if (tp.isContextual) " with " else "") ~
(if (tp.isContextual) " given " else "") ~
("(" + (if (tp.isErasedMethod) "erased " else "")
+ (if (tp.isImplicitMethod && !tp.isContextual) "implicit " else "")
) ~ paramsText(tp) ~
Expand Down
2 changes: 2 additions & 0 deletions compiler/test-resources/repl/i5855
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
scala> def f given Int = 1
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest having all the definition tests in dotty/compiler/test-resources/repl/defs

def f given (x$1: Int): Int