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 @@ -971,25 +971,34 @@ object messages {
971971 val kind = " Syntax"
972972 val msg = hl """ Expected an additional member selection after the keyword ${" this" }"""
973973
974+ val contextCode =
975+ """ trait Outer {
976+ | val member: Int
977+ | type Member
978+ | trait Inner {
979+ | ...
980+ | }
981+ | }"""
982+
974983 val importCode =
975- """ import MyClass.this.member
976- |// ^^^^^^^
977- """
984+ """ import Outer.this.member
985+ | // ^^^^^^^"""
978986
979987 val typeCode =
980- """ type T = MyClass.this.Member
981- |// ^^^^^^^
982- """
988+ """ type T = Outer.this.Member
989+ | // ^^^^^^^"""
983990
984991 val explanation =
985992 hl """ |Paths of imports and type selections must not end with the keyword ${" this" }.
986993 |
987- |Maybe you forgot to select a member of ${" this" }?
994+ |Maybe you forgot to select a member of ${" this" }? As an example, in the
995+ |following context:
996+ | ${contextCode}
988997 |
989- |- Example for a valid import expression using a path
998+ |- this is a valid import expression using a path
990999 | ${importCode}
9911000 |
992- |- Example for a valid type using a path
1001+ |- this is a valid type using a path
9931002 | ${typeCode}
9941003 | """
9951004 }
You can’t perform that action at this time.
0 commit comments