Commit Graph

20 Commits

Author SHA1 Message Date
Slava Pestov 507c196d4d AST: Rename ExistentialLayout::getSuperclass()
Give it a longer, more annoying name, because you're not supposed to
use it anymore. It's fundamentally broken. I've added FIXME comments
in the places where the result is known to be wrong.
2026-05-27 23:07:51 -04:00
Slava Pestov 8f99bcd43e AST: Remove ExistentialLayout::getSuperclass() call from resolveCompositionType() 2026-05-27 23:06:48 -04:00
Slava Pestov 59adfcd02b Sema: Detect conflicting subtype bindings imposed on closure type variables
A type variable that represents the type of a closure can only be bound
to a function type, but this fact is not directly encoded in the
constraint system.

Check for the appearance of a non-sensical subtype binding on a closure
type variable in reduceBinding(), and promote the binding to exact as
soon as we detect this, since binding the type will always fail; we want
to fail as quickly as possible, before attempting any more disjunctions.

This is a generally good performance optimization, and it also addresses
a performance regression from "Sema: Filter bindings by considering
conformance constraints".

This also speeds up the expression from rdar://59008707, which also uses
Combine and is slow for similar reasons.
2026-03-10 14:51:19 -04:00
Slava Pestov f5419c0095 Sema: Fix problem in isConformanceTransitiveForSubtype()
This was wrong for classes. Because it was only used from one place
previously, the bug didn't come up, but I'm adding a new caller in
CSBindings shortly.
2026-03-10 10:12:59 -04:00
Slava Pestov 7491ac8240 Sema: Teach Subtyping.cpp about tuples 2026-03-10 10:12:58 -04:00
Slava Pestov aa4c4d15e0 Sema: Skip unnecessary work in canPossiblyConvertTo() 2026-03-10 10:12:57 -04:00
Slava Pestov d665a4c545 Sema: Factor out ConflictReason overload of simple_display() 2026-02-28 14:54:06 -05:00
Slava Pestov ab0efdee20 Sema: Forgot to special-case empty tuple in getConversionBehavior() 2026-02-24 21:34:36 -05:00
Slava Pestov 6f627de8b2 Sema: Fix null pointer dereference in canPossiblyConvertTo()
Not every CoreFoundation class is toll-free-bridged, of course.
2026-02-15 22:09:26 -05:00
Slava Pestov b5823836fe Sema: Implement more missing cases in canPossiblyConvertTo() 2026-02-15 14:00:53 -05:00
Slava Pestov 9bad74379d Sema: Teach Subtyping.cpp about LValueType and InOutType 2026-02-15 14:00:52 -05:00
Slava Pestov 885587af86 Sema: Use checkTransitiveSubtypeConformance() from canPossiblyConvertTo() 2026-02-15 14:00:52 -05:00
Slava Pestov 8cfef1002b Sema: Use checkTransitiveSupertypeConformance() from canPossiblyConvertTo() 2026-02-15 14:00:52 -05:00
Slava Pestov 9e8728e90a Sema: Add hasProperSupertypes() 2026-02-15 14:00:52 -05:00
Slava Pestov aa512046b5 Sema: Add ConstraintSystem::isProtocolTransitiveFor{Super,Sub}type() 2026-02-15 14:00:52 -05:00
Slava Pestov ff2a0f7ead Sema: Add ConversionBehavior::String 2026-02-15 14:00:52 -05:00
Slava Pestov 87550ab409 Sema: Rename hasConversions() to hasProperSubtypes() 2026-02-15 14:00:52 -05:00
Slava Pestov 53c4eee858 Sema: Move some code from canPossiblyConvertTo() to isLikelyExactMatch() 2026-02-15 14:00:51 -05:00
Slava Pestov 3f69cedfa7 Sema: Move some code from CSLookahead.cpp to Subtyping.cpp 2026-02-15 14:00:51 -05:00
Slava Pestov 54789c12c7 Sema: Split off Subtyping.cpp from CSBindings.cpp 2026-02-15 14:00:51 -05:00