File tree Expand file tree Collapse file tree 1 file changed +18
-9
lines changed
compiler/src/dotty/tools/dotc/reporting/diagnostic Expand file tree Collapse file tree 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -906,25 +906,34 @@ object messages {
906906 val kind = " Syntax"
907907 val msg = hl """ Expected an additional member selection after the keyword ${" this" }"""
908908
909+ val contextCode =
910+ """ trait Outer {
911+ | val member: Int
912+ | type Member
913+ | trait Inner {
914+ | ...
915+ | }
916+ | }"""
917+
909918 val importCode =
910- """ import MyClass.this.member
911- |// ^^^^^^^
912- """
919+ """ import Outer.this.member
920+ | // ^^^^^^^"""
913921
914922 val typeCode =
915- """ type T = MyClass.this.Member
916- |// ^^^^^^^
917- """
923+ """ type T = Outer.this.Member
924+ | // ^^^^^^^"""
918925
919926 val explanation =
920927 hl """ |Paths of imports and type selections must not end with the keyword ${" this" }.
921928 |
922- |Maybe you forgot to select a member of ${" this" }?
929+ |Maybe you forgot to select a member of ${" this" }? As an example, in the
930+ |following context:
931+ | ${contextCode}
923932 |
924- |- Example for a valid import expression using a path
933+ |- this is a valid import expression using a path
925934 | ${importCode}
926935 |
927- |- Example for a valid type using a path
936+ |- this is a valid type using a path
928937 | ${typeCode}
929938 | """
930939 }
You can’t perform that action at this time.
0 commit comments