File tree Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Expand file tree Collapse file tree 2 files changed +22
-5
lines changed Original file line number Diff line number Diff line change @@ -943,17 +943,17 @@ fn resolve_hir_path_(
943
943
res. map ( |ty_ns| ( ty_ns, path. segments ( ) . first ( ) ) )
944
944
}
945
945
None => {
946
- let ( ty, remaining ) =
946
+ let ( ty, remaining_idx ) =
947
947
resolver. resolve_path_in_type_ns ( db. upcast ( ) , path. mod_path ( ) ) ?;
948
- match remaining {
949
- Some ( remaining ) if remaining > 1 => {
950
- if remaining + 1 == path. segments ( ) . len ( ) {
948
+ match remaining_idx {
949
+ Some ( remaining_idx ) => {
950
+ if remaining_idx + 1 == path. segments ( ) . len ( ) {
951
951
Some ( ( ty, path. segments ( ) . last ( ) ) )
952
952
} else {
953
953
None
954
954
}
955
955
}
956
- _ => Some ( ( ty, path . segments ( ) . get ( 1 ) ) ) ,
956
+ None => Some ( ( ty, None ) ) ,
957
957
}
958
958
}
959
959
} ?;
Original file line number Diff line number Diff line change @@ -1065,6 +1065,23 @@ fn f() -> impl Sub<Item$0 = u8> {}
1065
1065
) ;
1066
1066
}
1067
1067
1068
+ #[ test]
1069
+ fn goto_def_for_module_declaration_in_path_if_types_and_values_same_name ( ) {
1070
+ check (
1071
+ r#"
1072
+ mod bar {
1073
+ pub struct Foo {}
1074
+ //^^^
1075
+ pub fn Foo() {}
1076
+ }
1077
+
1078
+ fn baz() {
1079
+ let _foo_enum: bar::Foo$0 = bar::Foo {};
1080
+ }
1081
+ "# ,
1082
+ )
1083
+ }
1084
+
1068
1085
#[ test]
1069
1086
fn unknown_assoc_ty ( ) {
1070
1087
check_unresolved (
You can’t perform that action at this time.
0 commit comments