Commit Graph

1595 Commits

Author SHA1 Message Date
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
Slava Pestov
c344d6b0eb Sema: Rename getTypeOf{Member,}ReferenceImpl() to Pre() and factor out Post() versions 2025-09-18 11:31:59 -04:00
Slava Pestov
182c38470b Sema: Remove replacementsPtr parameter from getTypeOfMemberReference() 2025-09-18 11:31:59 -04:00
Slava Pestov
a028eb36b7 Sema: Don't need to return new baseObjTy from getTypeOfMemberReferenceImpl() 2025-09-18 11:31:59 -04:00
Slava Pestov
d8ead6c5cc Sema: Refactor getTypeOf{Member,}Reference() to take the OverloadChoice 2025-09-18 11:31:59 -04:00
Slava Pestov
2fde4a50e7 Sema: Split off getTypeOfMemberReferenceImpl() from getTypeOfMemberReference() 2025-09-18 11:06:32 -04:00
Slava Pestov
35a439de24 Sema: Remove replacements parameter from getMemberReferenceTypeFromOpenedType() 2025-09-18 11:06:31 -04:00
Slava Pestov
1efc9a6d0d Sema: Split off getTypeOfReferenceImpl() from getTypeOfReference() 2025-09-18 11:06:31 -04:00
swift-ci
7b8b46694b Merge remote-tracking branch 'origin/main' into rebranch 2025-09-18 06:36:53 -07:00
Hamish Knight
deab5f7970 Merge pull request #84280 from hamishknight/csapply-cleanup
Reapply: [Sema] Remove some unreachable code from CSApply
2025-09-18 14:25:51 +01:00
swift-ci
9e3d4161b5 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-18 05:03:55 -07:00
Hamish Knight
8102e39f39 [CS] Record fix when encountering decl reference with placeholder type
We allow placeholder types in interface types in certain cases to allow
better recovery since we can suggest the inferred type as a replacement.
When referencing those decls though we need to make sure we record a fix
since we cannot form a valid solution with them.
2025-09-17 20:51:06 +01:00
Hamish Knight
782a5b4332 [CS] Ensure we trap in getOverloadChoice if the overload is missing
Using `*` previously meant we'd invoke undefined behavior.
2025-09-17 16:11:53 +01:00
swift-ci
95736f8e88 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-10 01:39:11 -07:00
Hamish Knight
f8218e3254 Merge pull request #83777 from hamishknight/ext-cleanup
[Sema] Clean up extension binding a little
2025-09-10 09:37:20 +01:00
swift-ci
d71d1eec81 Merge remote-tracking branch 'origin/main' into rebranch 2025-09-09 23:47:19 -07:00
Slava Pestov
60246a2889 Sema: Further split up getTypeOfMemberTypeReference() 2025-09-09 18:58:10 -04:00
Slava Pestov
6dc2e7558d Sema: Don't modify openedType in getMemberReferenceTypeFromOpenedType() 2025-09-09 18:58:09 -04:00
Hamish Knight
d9d0b2e6a3 [Sema] Make extension binding lazy for SourceLoader
This will mainly be useful once extension binding is fully
requestified, but even now it's a good idea to ensure module loading
isn't kicking name lookup.
2025-09-09 23:18:52 +01:00
swift-ci
a4df245f2e Merge remote-tracking branch 'origin/main' into rebranch 2025-09-07 10:57:49 -07:00
Hamish Knight
4d1a04b856 [CS] Remove AllowUnresolvedTypeVariables (#84146)
This has been unused for a while now.
2025-09-07 18:36:01 +01:00
Hamish Knight
23560df5f4 [CS] Remove AllowUnresolvedTypeVariables
This has been unused for a while now.
2025-09-07 12:17:18 +01:00