Skip to content

Commit 95e2dc2

Browse files
committed
Fix #2727: Add self type explain to UnboundPlaceholderParameter
1 parent d11e137 commit 95e2dc2

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

compiler/src/dotty/tools/dotc/reporting/messages.scala

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -527,6 +527,17 @@ import ast.tpd
527527
|but an uninitialized var definition.
528528
|Only fields can be left uninitialized in this manner; local variables
529529
|must be initialized.
530+
|
531+
|Another occurrence for this error is defining a val with self type.
532+
|The ${hl("_")} can be replaced with ${hl("this")}.
533+
|
534+
|Example before:
535+
|
536+
|${hl("trait A { _: B => ... ")}
537+
|
538+
|Example after:
539+
|
540+
|${hl("trait A { this: B => ... ")}
530541
|"""
531542
}
532543

0 commit comments

Comments
 (0)