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

[Merged by Bors] - perf(library/type_context): enable type class cache in nested resolution problems #505

Closed
wants to merge 1 commit into from

Conversation

gebner
Copy link
Member

@gebner gebner commented Nov 20, 2020

Fixes #504.

Well, not completely. The cache is still reset between different nested resolution problems during unification. But at least it makes diamonds much less of a problem.

@@ -2415,8 +2415,7 @@ bool type_context_old::mk_nested_instance(expr const & m, expr const & m_type) {

// 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
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What about the example that easily break, mentioned above this line?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's when you reuse the cache. We don't do this here. We start with an empty cache (as opposed to no caching at all).

@gebner
Copy link
Member Author

gebner commented Nov 23, 2020

bors merge

bors bot pushed a commit that referenced this pull request Nov 23, 2020
…ion problems (#505)

Fixes #504.

Well, not completely.  The cache is still reset between different nested resolution problems during unification.  But at least it makes diamonds much less of a problem.
@bors
Copy link

bors bot commented Nov 23, 2020

Pull request successfully merged into master.

Build succeeded:

@bors bors bot changed the title perf(library/type_context): enable type class cache in nested resolution problems [Merged by Bors] - perf(library/type_context): enable type class cache in nested resolution problems Nov 23, 2020
@bors bors bot closed this Nov 23, 2020
@bors bors bot deleted the nested-tc-cache branch November 23, 2020 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Instance caching not always working
2 participants