File tree Expand file tree Collapse file tree 8 files changed +29
-8
lines changed
compiler/src/dotty/tools/dotc/printing Expand file tree Collapse file tree 8 files changed +29
-8
lines changed Original file line number Diff line number Diff line change @@ -426,6 +426,8 @@ class PlainPrinter(_ctx: Context) extends Printer {
426426 else if (sym.isType) " type"
427427 else if (sym.isGetter) " getter"
428428 else if (sym.isSetter) " setter"
429+ else if sym.is(Param ) then " parameter"
430+ else if sym.is(Given ) then " given instance"
429431 else if (flags.is(Lazy )) " lazy value"
430432 else if (flags.is(Mutable )) " variable"
431433 else if (sym.isClassConstructor && sym.isPrimaryConstructor) " primary constructor"
Original file line number Diff line number Diff line change 77 |
88 | given_Bar
99 |
10- | But method given_Bar does not match type Bar.
10+ | But given instance given_Bar does not match type Bar.
Original file line number Diff line number Diff line change 55-- Error: tests/neg/abstract-givens.scala:8:8 --------------------------------------------------------------------------
668 | given y(using Int): String = summon[Int].toString * 22 // error
77 | ^
8- | error overriding method y in trait T of type (using x$1: Int): String;
9- | method y of type (using x$1: Int): String cannot override final member method y in trait T
8+ | error overriding given instance y in trait T of type (using x$1: Int): String;
9+ | given instance y of type (using x$1: Int): String cannot override final member given instance y in trait T
1010-- Error: tests/neg/abstract-givens.scala:9:8 --------------------------------------------------------------------------
11119 | given z[T](using T): Seq[T] = List(summon[T]) // error
1212 | ^
13- | error overriding method z in trait T of type [T](using x$1: T): List[T];
14- | method z of type [T](using x$1: T): Seq[T] has incompatible type
13+ | error overriding given instance z in trait T of type [T](using x$1: T): List[T];
14+ | given instance z of type [T](using x$1: T): Seq[T] has incompatible type
Original file line number Diff line number Diff line change 1010-- Error: tests/neg/exports.scala:25:21 --------------------------------------------------------------------------------
111125 | export printUnit.bitmap // error: no eligible member
1212 | ^
13- | non-private method bitmap in class Copier refers to private value printUnit
13+ | non-private given instance bitmap in class Copier refers to private value printUnit
1414 | in its type signature => Copier.this.printUnit.bitmap$
1515-- [E120] Naming Error: tests/neg/exports.scala:23:33 ------------------------------------------------------------------
161623 | export printUnit.{stat => _, _} // error: double definition
Original file line number Diff line number Diff line change 1+ -- Error: tests/neg/i11066.scala:15:37 ---------------------------------------------------------------------------------
2+ 15 |val x = Greeter.greet("Who's there?") // error
3+ | ^
4+ |ambiguous implicit arguments: both given instance joesPrompt in object JoesPrefs and given instance jillsPrompt in object JillsPrefs match type PreferredPrompt of parameter prompt of method greet in object Greeter
Original file line number Diff line number Diff line change 1+ class PreferredPrompt (val preference : String )
2+ object Greeter :
3+ def greet (name : String )(using prompt : PreferredPrompt ) =
4+ println(s " Welcome, $name. The system is ready. " )
5+ println(prompt.preference)
6+ object JillsPrefs :
7+ given jillsPrompt : PreferredPrompt =
8+ PreferredPrompt (" Your wish> " )
9+ object JoesPrefs :
10+ given joesPrompt : PreferredPrompt =
11+ PreferredPrompt (" relax> " )
12+
13+ import JillsPrefs .jillsPrompt
14+ import JoesPrefs .joesPrompt
15+ val x = Greeter .greet(" Who's there?" ) // error
Original file line number Diff line number Diff line change 66 |
77 | Bar.given_Bar
88 |
9- | But method given_Bar in object Bar does not match type Bar.
9+ | But given instance given_Bar in object Bar does not match type Bar.
Original file line number Diff line number Diff line change 11-- Error: tests/neg/missing-implicit2.scala:10:18 ----------------------------------------------------------------------
2210 | f(using xFromY) // error
33 | ^
4- | no implicit argument of type Y was found for parameter y of method xFromY
4+ | no implicit argument of type Y was found for parameter y of given instance xFromY
55 |
66 | The following import might fix the problem:
77 |
You can’t perform that action at this time.
0 commit comments