Skip to content

Start stubbing out more parts of Type::join(). #14698

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
merged 1 commit into from
Mar 1, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions include/swift/AST/Type.h
Original file line number Diff line number Diff line change
Expand Up @@ -368,15 +368,19 @@ class Type {
/// class D { }
/// \endcode
///
/// The join of B and C is A, the join of A and B is A. However, there is no
/// join of D and A (or D and B, or D and C) because there is no common
/// superclass. One would have to jump to an existential (e.g., \c AnyObject)
/// to find a common type.
/// The join of B and C is A, the join of A and B is A.
///
/// The Any type is considered the common supertype by default when no
/// closer common supertype exists.
///
/// In unsupported cases where we cannot yet compute an accurate join,
/// we return None.
///
/// \returns the join of the two types, if there is a concrete type
/// that can express the join, or Any if the only join would be a
/// more-general existential type
static Type join(Type first, Type second);
/// more-general existential type, or None if we cannot yet compute a
/// correct join but one better than Any may exist.
static Optional<Type> join(Type first, Type second);

private:
// Direct comparison is disabled for types, because they may not be canonical.
Expand Down
Loading