File tree 2 files changed +40
-0
lines changed
2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change @@ -1200,6 +1200,12 @@ impl<'a> InferenceContext<'a> {
1200
1200
path : & ModPath ,
1201
1201
) -> ( Ty , Option < VariantId > ) {
1202
1202
let remaining = unresolved. map ( |it| path. segments ( ) [ it..] . len ( ) ) . filter ( |it| it > & 0 ) ;
1203
+ let ty = match ty. kind ( Interner ) {
1204
+ TyKind :: Alias ( AliasTy :: Projection ( proj_ty) ) => {
1205
+ self . db . normalize_projection ( proj_ty. clone ( ) , self . table . trait_env . clone ( ) )
1206
+ }
1207
+ _ => ty,
1208
+ } ;
1203
1209
match remaining {
1204
1210
None => {
1205
1211
let variant = ty. as_adt ( ) . and_then ( |( adt_id, _) | match adt_id {
Original file line number Diff line number Diff line change @@ -1154,6 +1154,40 @@ fn main() {
1154
1154
) ;
1155
1155
}
1156
1156
1157
+ #[ test]
1158
+ fn generic_alias_with_qualified_path ( ) {
1159
+ check_types (
1160
+ r#"
1161
+ type Wrap<T> = T;
1162
+
1163
+ struct S;
1164
+
1165
+ trait Schematic {
1166
+ type Props;
1167
+ }
1168
+
1169
+ impl Schematic for S {
1170
+ type Props = X;
1171
+ }
1172
+
1173
+ enum X {
1174
+ A { cool: u32, stuff: u32 },
1175
+ B,
1176
+ }
1177
+
1178
+ fn main() {
1179
+ let wrapped = Wrap::<<S as Schematic>::Props>::A {
1180
+ cool: 100,
1181
+ stuff: 100,
1182
+ };
1183
+
1184
+ if let Wrap::<<S as Schematic>::Props>::A { cool, ..} = &wrapped {}
1185
+ //^^^^ &u32
1186
+ }
1187
+ "# ,
1188
+ ) ;
1189
+ }
1190
+
1157
1191
#[ test]
1158
1192
fn type_mismatch_pat_const_reference ( ) {
1159
1193
check_no_mismatches (
You can’t perform that action at this time.
0 commit comments