Skip to content

Commit be93fe0

Browse files
authored
Merge pull request #14698 from rudkx/join
Start stubbing out more parts of Type::join().
2 parents 1d08be5 + 7585709 commit be93fe0

File tree

5 files changed

+268
-119
lines changed

5 files changed

+268
-119
lines changed

include/swift/AST/Type.h

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -368,15 +368,19 @@ class Type {
368368
/// class D { }
369369
/// \endcode
370370
///
371-
/// The join of B and C is A, the join of A and B is A. However, there is no
372-
/// join of D and A (or D and B, or D and C) because there is no common
373-
/// superclass. One would have to jump to an existential (e.g., \c AnyObject)
374-
/// to find a common type.
371+
/// The join of B and C is A, the join of A and B is A.
372+
///
373+
/// The Any type is considered the common supertype by default when no
374+
/// closer common supertype exists.
375+
///
376+
/// In unsupported cases where we cannot yet compute an accurate join,
377+
/// we return None.
375378
///
376379
/// \returns the join of the two types, if there is a concrete type
377380
/// that can express the join, or Any if the only join would be a
378-
/// more-general existential type
379-
static Type join(Type first, Type second);
381+
/// more-general existential type, or None if we cannot yet compute a
382+
/// correct join but one better than Any may exist.
383+
static Optional<Type> join(Type first, Type second);
380384

381385
private:
382386
// Direct comparison is disabled for types, because they may not be canonical.

0 commit comments

Comments
 (0)