diff options
Diffstat (limited to 'compiler/src/dotty/tools/dotc/reporting')
-rw-r--r-- | compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala | 27 |
1 files changed, 18 insertions, 9 deletions
diff --git a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala index 9ba771be9..89cd2cd8f 100644 --- a/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala +++ b/compiler/src/dotty/tools/dotc/reporting/diagnostic/messages.scala @@ -971,25 +971,34 @@ object messages { val kind = "Syntax" val msg = hl"""Expected an additional member selection after the keyword ${"this"}""" + val contextCode = + """ trait Outer { + | val member: Int + | type Member + | trait Inner { + | ... + | } + | }""" + val importCode = - """import MyClass.this.member - |// ^^^^^^^ - """ + """ import Outer.this.member + | // ^^^^^^^""" val typeCode = - """type T = MyClass.this.Member - |// ^^^^^^^ - """ + """ type T = Outer.this.Member + | // ^^^^^^^""" val explanation = hl"""|Paths of imports and type selections must not end with the keyword ${"this"}. | - |Maybe you forgot to select a member of ${"this"}? + |Maybe you forgot to select a member of ${"this"}? As an example, in the + |following context: + |${contextCode} | - |- Example for a valid import expression using a path + |- this is a valid import expression using a path |${importCode} | - |- Example for a valid type using a path + |- this is a valid type using a path |${typeCode} |""" } |