Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Instance caching not always working #504

Closed
sgouezel opened this issue Nov 20, 2020 · 1 comment
Closed

Instance caching not always working #504

sgouezel opened this issue Nov 20, 2020 · 1 comment

Comments

@sgouezel
Copy link

Following example based on mathlib (I have not been able to minimise):

import topology.algebra.infinite_sum

set_option trace.class_instances true

lemma blah (α : Type*) [topological_space α] (f : ℝ → α) : continuous f :=
begin
  apply continuous.mul,
end

The line apply continuous.mul fails, as it should, but the instance search gives a lot of caching failure for linear_ordered_ring α, and no cached failure at all. simp [continuous.mul] has the same problem.

@gebner
Copy link
Member

gebner commented Nov 20, 2020

Thanks for minimizing this.

I wouldn't be surprised if the culprit was type_context_old::mk_nested_instance:

// HACK(gabriel): do not reuse type-class cache for nested resolution problems
// For one example that easily breaks, see the default field values in `init/control/lawful.lean`
// TODO(gabriel): allow local caching

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants