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 {
426
426
else if (sym.isType) " type"
427
427
else if (sym.isGetter) " getter"
428
428
else if (sym.isSetter) " setter"
429
+ else if sym.is(Param ) then " parameter"
430
+ else if sym.is(Given ) then " given instance"
429
431
else if (flags.is(Lazy )) " lazy value"
430
432
else if (flags.is(Mutable )) " variable"
431
433
else if (sym.isClassConstructor && sym.isPrimaryConstructor) " primary constructor"
Original file line number Diff line number Diff line change 7
7
|
8
8
| given_Bar
9
9
|
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 5
5
-- Error: tests/neg/abstract-givens.scala:8:8 --------------------------------------------------------------------------
6
6
8 | given y(using Int): String = summon[Int].toString * 22 // error
7
7
| ^
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
10
10
-- Error: tests/neg/abstract-givens.scala:9:8 --------------------------------------------------------------------------
11
11
9 | given z[T](using T): Seq[T] = List(summon[T]) // error
12
12
| ^
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 10
10
-- Error: tests/neg/exports.scala:25:21 --------------------------------------------------------------------------------
11
11
25 | export printUnit.bitmap // error: no eligible member
12
12
| ^
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
14
14
| in its type signature => Copier.this.printUnit.bitmap$
15
15
-- [E120] Naming Error: tests/neg/exports.scala:23:33 ------------------------------------------------------------------
16
16
23 | 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 6
6
|
7
7
| Bar.given_Bar
8
8
|
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 1
1
-- Error: tests/neg/missing-implicit2.scala:10:18 ----------------------------------------------------------------------
2
2
10 | f(using xFromY) // error
3
3
| ^
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
5
5
|
6
6
| The following import might fix the problem:
7
7
|
You can’t perform that action at this time.
0 commit comments