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 @@ -906,25 +906,34 @@ object messages {
906
906
val kind = " Syntax"
907
907
val msg = hl """ Expected an additional member selection after the keyword ${" this" }"""
908
908
909
+ val contextCode =
910
+ """ trait Outer {
911
+ | val member: Int
912
+ | type Member
913
+ | trait Inner {
914
+ | ...
915
+ | }
916
+ | }"""
917
+
909
918
val importCode =
910
- """ import MyClass.this.member
911
- |// ^^^^^^^
912
- """
919
+ """ import Outer.this.member
920
+ | // ^^^^^^^"""
913
921
914
922
val typeCode =
915
- """ type T = MyClass.this.Member
916
- |// ^^^^^^^
917
- """
923
+ """ type T = Outer.this.Member
924
+ | // ^^^^^^^"""
918
925
919
926
val explanation =
920
927
hl """ |Paths of imports and type selections must not end with the keyword ${" this" }.
921
928
|
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}
923
932
|
924
- |- Example for a valid import expression using a path
933
+ |- this is a valid import expression using a path
925
934
| ${importCode}
926
935
|
927
- |- Example for a valid type using a path
936
+ |- this is a valid type using a path
928
937
| ${typeCode}
929
938
| """
930
939
}
You can’t perform that action at this time.
0 commit comments