Skip to content

Commit

Permalink
Generate opaque type program clauses for alias equality goals
Browse files Browse the repository at this point in the history
  • Loading branch information
nathanwhit committed May 20, 2020
1 parent dcba44d commit 24163d9
Showing 1 changed file with 16 additions and 3 deletions.
19 changes: 16 additions & 3 deletions chalk-solve/src/clauses.rs
Original file line number Diff line number Diff line change
Expand Up @@ -235,9 +235,22 @@ fn program_clauses_that_could_match<I: Interner>(
}
}
DomainGoal::Holds(WhereClause::AliasEq(alias_eq)) => match &alias_eq.alias {
AliasTy::Projection(proj) => db
.associated_ty_data(proj.associated_ty_id)
.to_program_clauses(builder),
AliasTy::Projection(proj) => {
let trait_self_ty = db
.trait_ref_from_projection(proj)
.self_type_parameter(interner);

if let TyData::Apply(ApplicationTy {
name: TypeName::OpaqueType(opaque_ty_id),
..
}) = trait_self_ty.data(interner)
{
db.opaque_ty_data(*opaque_ty_id).to_program_clauses(builder)
}

db.associated_ty_data(proj.associated_ty_id)
.to_program_clauses(builder)
}
AliasTy::Opaque(opaque_ty) => db
.opaque_ty_data(opaque_ty.opaque_ty_id)
.to_program_clauses(builder),
Expand Down

0 comments on commit 24163d9

Please sign in to comment.