Skip to content

Commit 80d8910

Browse files
Merge pull request #5864 from dotty-staging/fix-#5855
Fix #5855: Print `given` for contextual function types
2 parents 56ca9ab + 27de32d commit 80d8910

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/defs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,3 +10,5 @@ scala> def id(x: 4): 4 = x
1010
def id(x: Int(4)): Int(4)
1111
scala> id(4)
1212
val res0: Int = 4
13+
scala> def f given Int = 1
14+
def f given (x$1: Int): Int

0 commit comments

Comments
 (0)