Skip to content

Commit 657d371

Browse files
nikomatsakisdetrumi
authored andcommitted
also add program clauses for the alias version of opaque type
1 parent fe18393 commit 657d371

File tree

2 files changed

+12
-6
lines changed

2 files changed

+12
-6
lines changed

chalk-solve/src/clauses.rs

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -145,6 +145,8 @@ fn program_clauses_that_could_match<I: Interner>(
145145
let interner = db.interner();
146146
let builder = &mut ClauseBuilder::new(db, clauses);
147147

148+
debug_heading!("program_clauses_that_could_match(goal={:?})", goal);
149+
148150
match goal {
149151
DomainGoal::Holds(WhereClause::Implemented(trait_ref)) => {
150152
let trait_id = trait_ref.trait_id;
@@ -258,12 +260,15 @@ fn program_clauses_that_could_match<I: Interner>(
258260
});
259261
}
260262

261-
if let TyData::Apply(ApplicationTy {
262-
name: TypeName::OpaqueType(opaque_ty_id),
263-
..
264-
}) = self_ty.data(interner)
265-
{
266-
db.opaque_ty_data(*opaque_ty_id).to_program_clauses(builder);
263+
match self_ty.data(interner) {
264+
TyData::Apply(ApplicationTy {
265+
name: TypeName::OpaqueType(opaque_ty_id),
266+
..
267+
})
268+
| TyData::Alias(AliasTy::Opaque(OpaqueTy { opaque_ty_id, .. })) => {
269+
db.opaque_ty_data(*opaque_ty_id).to_program_clauses(builder);
270+
}
271+
_ => {}
267272
}
268273

269274
if let Some(well_known) = trait_datum.well_known {

chalk-solve/src/clauses/program_clauses.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ impl<I: Interner> ToProgramClauses<I> for OpaqueTyDatum<I> {
130130
/// ```
131131
/// where `!T<..>` is the placeholder for the unnormalized type `T<..>`.
132132
fn to_program_clauses(&self, builder: &mut ClauseBuilder<'_, I>) {
133+
debug_heading!("to_program_clauses({:?})", self);
133134
builder.push_binders(&self.bound, |builder, opaque_ty_bound| {
134135
let interner = builder.interner();
135136
let substitution = builder.substitution_in_scope();

0 commit comments

Comments
 (0)