1616 Commits

Author SHA1 Message Date
Slava Pestov
56baeac901 Sema: More descriptive comment for determineLiteralCoverage() 2025-12-10 18:48:47 -05:00
Slava Pestov
205d8e6640 Sema: Remove unnecessary operator new overload 2025-12-10 18:48:47 -05:00
Slava Pestov
ba7df4013e Sema: Avoid copying BindingSets
They're stored inside the ConstraintGraphNode now, so returning a
`const BindingSet *` from within determineBestBindings() should
be safe.
2025-12-10 18:48:00 -05:00
Slava Pestov
3c4fef164e Sema: Add some LLVM_DEBUG output to CSBindings.cpp 2025-12-09 09:44:52 -05:00
Slava Pestov
8da3b62d7b Merge pull request #85293 from slavapestov/too-complex-source-loc
Sema: Fix source location bookkeeping for 'reasonable time' diagnostic
2025-12-07 01:26:04 -05:00
Slava Pestov
d8cf185a13 Sema: Fix source location bookkeeping for 'reasonable time' diagnostic
We already had bookkeeping to track which statement in a multi-statement
closure we were looking at, but this was only used for the 'reasonable time'
diagnostic in the case that we hit the expression timer, which was almost
never hit, and is now off by default. The scope, memory, and trial limits
couldn't use this information, so they would always diagnose the entire
target being type checked.

Move it up from ExpressionTimer to ConstraintSystem, so that we get the
right source location there too. Also, factor out some code duplication
in BuilderTransform to ensure we get the same benefit for result builders
applied to function bodies too.
2025-12-06 20:31:08 -05:00
Slava Pestov
a99aebb712 Sema: Fix SolutionResult move constructor 2025-12-06 20:31:08 -05:00
Hamish Knight
3861d58175 [CS] Remove CTP_CannotFail
This is now unused.
2025-11-30 11:12:39 +00:00
Slava Pestov
61e418c3e7 Merge pull request #85513 from slavapestov/refactor-csbindings
Refactor BindingSet a little bit
2025-11-17 17:52:16 -05:00
Slava Pestov
ce3b5eb8ae Sema: Bring back BindingSet::operator bool but call it BindingSet::isViable() 2025-11-17 11:16:37 -05:00
Slava Pestov
c0238dbb4c Sema: Split up BindingSet::inferTransitiveBindings() into three methods 2025-11-17 11:16:37 -05:00
Slava Pestov
ab72c53103 Sema: Split off inferTransitiveKeyPathBindings() from BindingSet::inferTransitiveBindings() 2025-11-17 11:16:36 -05:00
Slava Pestov
45d03e152c Sema: Split up BindingSet::finalize() into finalizeKeyPathBindings() and finalizeUnresolvedMemberChain() 2025-11-17 11:16:33 -05:00
Slava Pestov
02129f2b1f Sema: Pull call to inferTransitiveBindings() out of BindingSet::finalize() 2025-11-17 11:16:32 -05:00
Slava Pestov
5f2db0c96c Sema: Pull call to determineLiteralCoverage() out of BindingSet::finalize() 2025-11-17 11:15:52 -05:00
Hamish Knight
1f32f7f5ac Merge pull request #85525 from hamishknight/yeet
[CS] Remove `getImplicitValueConversionLocator` & `ImplicitConversion`
2025-11-17 14:03:13 +00:00
Hamish Knight
9a31ef029c [CS] NFC: Remove CTP_ComposedPropertyWrapper
This has been unused since we added a custom `AllowWrappedValueMismatch`
fix.
2025-11-16 18:31:55 +00:00
Hamish Knight
6abfea9312 [CS] NFC: Remove CTP_CalleeResult
This has been unused since the removal of CSDiag.
2025-11-16 18:29:37 +00:00
Hamish Knight
6dfff1ce9c [CS] Remove getImplicitValueConversionLocator & ImplicitConversion
These are now unused.
2025-11-15 19:26:46 +00:00
Slava Pestov
23a7ca04bf Sema: Remove BindingSet::operator bool 2025-11-14 10:05:32 -05:00
Slava Pestov
819738c83e AST: Rename mapTypeIntoContext() => mapTypeIntoEnvironment(), mapTypeOutOfContext() => mapTypeOutOfEnvironment() 2025-11-12 14:48:19 -05:00
Hamish Knight
3b57a7cd91 [CS] Clean up some property wrapper logic
These methods can be simplified a bunch since the returned decl is
always the input decl and we can refactor the lambdas to just return
the auxiliary variable and have the type computation in the caller.
2025-11-04 00:56:01 +00:00
Hamish Knight
1781faba1a [CS] Upgrade tuple label mismatch warning to error for future lang mode
I missed upgrading this to an error for Swift 6 mode, let's upgrade it
to an error for a future language mode. It's important we reject these
cases since we're otherwise allowing subtyping to be a weaker constraint
than conversion.
2025-10-29 15:14:23 +00:00
Becca Royal-Gordon
393965090e Merge pull request #34556 from beccadax/mod-squad-2
[SE-0491] Implement lookup and diagnostics for module selectors (MyMod::someName)
2025-10-28 16:00:26 -07:00
Hamish Knight
05e3d15955 [CS] Propagate CSApply failures in a few more places
We had some cases where we weren't propagating failures to apply the
solution, and as such weren't invalidating the resulting AST. Fix up
these cases.
2025-10-26 14:49:17 +00:00
Becca Royal-Gordon
60cc537f70 Improve module selector constraint solver diagnostics 2025-10-24 16:23:49 -07:00
Hamish Knight
f15fae4737 Merge pull request #84822 from hamishknight/just-a-phase
[CS] Remove `ConstraintSystemPhase`
2025-10-24 16:05:08 +01:00
Hamish Knight
bb877ce3c0 [CS] Remove ConstraintSystemPhase 2025-10-19 13:14:00 +01:00
Hamish Knight
77a59383f7 [CS] Penalize implicit pointer conversions to generic parameter types
We ought to consider outright banning these conversions if the
destination is a generic parameter type, but for now let's penalize
them such that we don't end up with ambiguities if you're doing an
implicit pointer conversion through an identity generic function.

rdar://161205293
2025-10-16 14:14:53 +01:00
Slava Pestov
8600cdcc2a Sema: Remove ConstraintSystemPhase::{Diagnostics,Finalization} 2025-10-10 16:06:42 -04:00
Slava Pestov
a8d896ab8f Sema: Don't reuse PreparedOverload from normal type checking in salvage()
We want to re-prepare our overloads, since now they will contain fixes.
2025-10-10 15:44:12 -04:00
Slava Pestov
036db6fb08 Sema: Only use PreparedOverload::Change::AddedBindConstraint if the locator didn't change
For a Bind constraint generated by a same-type requirement, we must
preserve the locator so we need to record it like any other kind of
constraint.

This fixes a diagnostic regression with -solver-enable-prepared-overloads.
2025-10-10 15:33:31 -04:00
Meghana Gupta
5e325632ed Merge pull request #84746 from meg-gupta/mutateaccessorspr
Add support for mutate accessors
2025-10-08 11:08:59 -07:00
Meghana Gupta
b5d15ae3da Update type checking for mutate accessors 2025-10-07 14:12:08 -07:00
Max Desiatov
e7aac5df12 for expressions scaffolding, making constraints work 2025-10-07 11:16:54 +01:00
Hamish Knight
d65f28984a [CS] Improve diagnostics for non-metatype type(of:) contextual type
Emit a custom diagnostic for this case, and handle holes.
2025-10-06 21:45:48 +01:00
Hamish Knight
9e4208b69b [CS] Remove custom logic from simplifyTypeForCodeCompletion
We ought to be able to just use `simplifyType` with an additional
parameter to tell it to produce archetypes.
2025-10-04 12:56:52 +01:00
swift-ci
6b28979fb4 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-25 16:24:58 -07:00
Allan Shortlidge
2467b931a7 ConstraintSystem: Move key path type utilities to AST. 2025-09-25 07:13:17 -07:00
swift-ci
e35756ef85 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-23 15:38:03 -07:00
Doug Gregor
0737723c5c Merge pull request #84465 from DougGregor/has-feature-library-evolution
Add an optional language feature for Library Evolution
2025-09-23 15:18:48 -07:00
swift-ci
06fb7384ce Merge remote-tracking branch 'origin/main' into rebranch 2025-09-23 03:14:56 -07:00
Doug Gregor
c68ef1cf71 Add an optional language feature for Library Evolution
Replace the one-off compiler flag for Library Evolution with an
optional language feature. This makes the
`hasFeature(LibraryEvolution)` check work in an `#if`, and is
otherwise just cleanup.

Tracked by rdar://161125572.
2025-09-22 17:45:34 -07:00
Hamish Knight
3141b5a8cd [AST] NFC: Introduce PrintOptions::forDebugging 2025-09-21 23:19:06 +01:00
swift-ci
9be21897d9 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-19 15:20:12 -07:00
Hamish Knight
0b3747d7c4 Revert "[CS] Record fix when encountering decl reference with placeholder type"
This reverts commit 8102e39f39.
2025-09-19 14:22:39 +01:00
swift-ci
3ac38cb3c4 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-18 21:16:38 -07:00
Slava Pestov
9dea72579a Sema: Record ASTNode type changes in PreparedOverload
Also, move some methods from ConstraintSystem.h to ConstraintSystem.cpp.
2025-09-18 14:54:16 -04:00
Slava Pestov
a12c160d0b Sema: Replace calls to OverloadChoice constructor with two overloads of getDecl() 2025-09-18 14:54:16 -04:00
Slava Pestov
b181fcf0fd Sema: Get prepared overloads working again with the Pre()/Post() split 2025-09-18 14:54:16 -04:00