File tree Expand file tree Collapse file tree 3 files changed +22
-14
lines changed Expand file tree Collapse file tree 3 files changed +22
-14
lines changed Original file line number Diff line number Diff line change @@ -614,13 +614,11 @@ impl LowerTypeKind for TraitDefn {
614
614
615
615
impl LowerTypeKind for OpaqueTyDefn {
616
616
fn lower_type_kind ( & self ) -> LowerResult < TypeKind > {
617
+ let binders: Vec < _ > = self . parameter_kinds . iter ( ) . map ( |p| p. lower ( ) ) . collect ( ) ;
617
618
Ok ( TypeKind {
618
619
sort : TypeSort :: Opaque ,
619
620
name : self . identifier . str ,
620
- binders : chalk_ir:: Binders :: new (
621
- vec ! [ ] , //TODO do we need binders here?
622
- ( ) ,
623
- ) ,
621
+ binders : chalk_ir:: Binders :: new ( binders. anonymize ( ) , ( ) ) ,
624
622
} )
625
623
}
626
624
}
Original file line number Diff line number Diff line change @@ -142,8 +142,7 @@ impl<I: Interner> ToProgramClauses<I> for OpaqueTyDatum<I> {
142
142
ApplicationTy {
143
143
name : TypeName :: OpaqueType ( self . opaque_ty_id ) ,
144
144
substitution,
145
- }
146
- . cast ( interner) ,
145
+ } ,
147
146
) ;
148
147
149
148
builder. push_binders ( & self . bound , |builder, opaque_ty_bound| {
Original file line number Diff line number Diff line change @@ -6,31 +6,42 @@ use super::*;
6
6
fn opaque_bounds ( ) {
7
7
test ! {
8
8
program {
9
- trait Direct { }
10
- trait Indirect { }
11
9
struct Ty { }
12
- impl Direct for Ty { }
13
- impl Indirect for Ty { }
14
10
15
- opaque type T : Direct = Ty ;
11
+ trait Clone { }
12
+ opaque type T : Clone = Ty ;
16
13
}
17
14
18
15
goal {
19
- T : Direct
16
+ T : Clone
20
17
} yields {
21
18
"Unique; substitution []"
22
19
}
20
+ }
21
+ }
22
+
23
+ #[ test]
24
+ fn opaque_reveal ( ) {
25
+ test ! {
26
+ program {
27
+ struct Ty { }
28
+ trait Trait { }
29
+ impl Trait for Ty { }
30
+
31
+ trait Clone { }
32
+ opaque type T : Clone = Ty ;
33
+ }
23
34
24
35
goal {
25
36
if ( Reveal ) {
26
- T : Indirect
37
+ T : Trait
27
38
}
28
39
} yields {
29
40
"Unique; substitution []"
30
41
}
31
42
32
43
goal {
33
- T : Indirect
44
+ T : Trait
34
45
} yields {
35
46
"No possible solution"
36
47
}
You can’t perform that action at this time.
0 commit comments