Skip to content

Commit 72a0e40

Browse files
committed
Fix #5855: Print given for contextual function types
1 parent b44adf7 commit 72a0e40

File tree

2 files changed

+3
-1
lines changed

2 files changed

+3
-1
lines changed

compiler/src/dotty/tools/dotc/printing/PlainPrinter.scala

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -183,7 +183,7 @@ class PlainPrinter(_ctx: Context) extends Printer {
183183
"<noprefix>"
184184
case tp: MethodType =>
185185
changePrec(GlobalPrec) {
186-
(if (tp.isContextual) " with " else "") ~
186+
(if (tp.isContextual) " given " else "") ~
187187
("(" + (if (tp.isErasedMethod) "erased " else "")
188188
+ (if (tp.isImplicitMethod && !tp.isContextual) "implicit " else "")
189189
) ~ paramsText(tp) ~

compiler/test-resources/repl/i5855

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
scala> def f given Int = 1
2+
def f given (x$1: Int): Int

0 commit comments

Comments
 (0)