File tree 1 file changed +18
-9
lines changed
compiler/src/dotty/tools/dotc/reporting/diagnostic 1 file changed +18
-9
lines changed Original file line number Diff line number Diff line change @@ -971,25 +971,34 @@ object messages {
971
971
val kind = " Syntax"
972
972
val msg = hl """ Expected an additional member selection after the keyword ${" this" }"""
973
973
974
+ val contextCode =
975
+ """ trait Outer {
976
+ | val member: Int
977
+ | type Member
978
+ | trait Inner {
979
+ | ...
980
+ | }
981
+ | }"""
982
+
974
983
val importCode =
975
- """ import MyClass.this.member
976
- |// ^^^^^^^
977
- """
984
+ """ import Outer.this.member
985
+ | // ^^^^^^^"""
978
986
979
987
val typeCode =
980
- """ type T = MyClass.this.Member
981
- |// ^^^^^^^
982
- """
988
+ """ type T = Outer.this.Member
989
+ | // ^^^^^^^"""
983
990
984
991
val explanation =
985
992
hl """ |Paths of imports and type selections must not end with the keyword ${" this" }.
986
993
|
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}
988
997
|
989
- |- Example for a valid import expression using a path
998
+ |- this is a valid import expression using a path
990
999
| ${importCode}
991
1000
|
992
- |- Example for a valid type using a path
1001
+ |- this is a valid type using a path
993
1002
| ${typeCode}
994
1003
| """
995
1004
}
You can’t perform that action at this time.
0 commit comments