Skip to content

Conversation

@DougGregor
Copy link
Member

The potential archetype graph is being constructed eagerly and minimized eagerly. While the former is fine (albeit not ideal), the latter is a problem: we might encounter information later that would have changed how minimization behaves. To that end, start to:

  • Separate out information that's known about an equivalence class of potential archetypes in a new EquivalenceClass type.
  • Keep track of all same-type-to-concrete constraints, without ever "updating" requirement sources. We'll diagnose redundant sources at the very end, once the equivalence classes are known.

This improves our diagnosis of redundant same-type-to-concrete constraints somewhat, because we don't lose information. It will also allow us to detect/remove "recursive" implied constraints that shouldn't be there. Eventually.

Introduce an equivalence-class abstraction that captures all of the
members of the equivalence class in a separate type that will maintain
the "truth" about the meaning of the equivalence class, rather than
having that information distributed amongst the potential archetypes
within the class.

For now, use it to capture the members of the equivalence classes, so
we have one SmallVector per equivalence class rather than N
SmallVectors.
When we see a second same-type-to-concrete constraint on a particular
potential archetype, record it. Previously, we were checking it and
then updating the requirement source eagerly. That won't work with
proper recursion detection, and meant that we missed out on some
obvious redundant-same-type-constraint diagnostics.

The scheme here is to build up the equivalence classes without losing
any information, and then determine which information is redundant at
the end.
@DougGregor
Copy link
Member Author

@swift-ci please smoke test and merge

@swift-ci swift-ci merged commit 41c6247 into swiftlang:master Feb 25, 2017
@DougGregor DougGregor deleted the all-same-type-to-concrete branch February 25, 2017 04:30
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.

2 participants