Skip to content

Commit

Permalink
Use inference.trait_solution_set. (#4613)
Browse files Browse the repository at this point in the history
  • Loading branch information
ilyalesokhin-starkware authored Dec 20, 2023
1 parent 09610a4 commit 65cb4f8
Showing 1 changed file with 6 additions and 9 deletions.
15 changes: 6 additions & 9 deletions crates/cairo-lang-semantic/src/expr/inference/solver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -138,8 +138,8 @@ impl Solver {
};

if let ImplId::Concrete(concrete_impl) = candidate_solver.candidate_impl {
let concrete_impl =
candidate_solver.inference_data.inference(db).rewrite(concrete_impl).no_err();
let mut inference = candidate_solver.inference_data.inference(db);
let concrete_impl = inference.rewrite(concrete_impl).no_err();
let mut rewriter =
SubstitutionRewriter { db, substitution: &concrete_impl.substitution(db)? };

Expand All @@ -148,14 +148,11 @@ impl Solver {
continue;
};

let (canonical_trait, _canonicalizer) = CanonicalTrait::canonicalize(
db,
candidate_solver.inference_data.inference_id,
rewriter.rewrite(neg_impl)?.concrete_trait?,
);

if !matches!(
db.canonic_trait_solutions(canonical_trait, self.lookup_context.clone())?,
inference.trait_solution_set(
rewriter.rewrite(neg_impl)?.concrete_trait?,
self.lookup_context.clone(),
)?,
SolutionSet::None
) {
// If a negative impl has an impl, then we should skip it.
Expand Down

0 comments on commit 65cb4f8

Please sign in to comment.