Hamish Knight
8b42107a4e
[CS] Rename SyntacticElementTarget::forEachStmt -> forEachPreamble
...
This more closely matches what we're actually
type-checking, since we do not currently include
the body.
2024-03-04 11:56:24 +00:00
Zhen Li
e513a7a8e2
Merge branch 'apple:main' into my-branch
2024-02-27 21:56:03 -05:00
li3zhen1
00b0491676
[CSDiagnostics] Update UnableToInferGenericPackElementType to accept overloads and update test cases
2024-02-27 20:35:06 -05:00
Pavel Yaskevich
f13904bddd
Merge pull request #71889 from xedin/static-members-are-always-sendable
...
[ConstraintSystem] Skip sendability check for static members
2024-02-27 09:37:16 -08:00
Pavel Yaskevich
7c0bb41573
[ConstraintSystem] Skip sendability check for static members
...
Such members only capture base metatatypes which are themselves
always sendable.
2024-02-26 11:52:38 -08:00
Ben Barham
f292ec9784
Use the new template deduction guides rather than makeArrayRef
...
LLVM has removed `make*ArrayRef`, migrate all references to their
constructor equivalent.
2024-02-23 20:04:51 -08:00
Pavel Yaskevich
4548b2a861
Merge pull request #71817 from xedin/rdar-122598934
...
[ConstraintSystem] Account for situations when witness for associated…
2024-02-23 09:20:26 -08:00
Pavel Yaskevich
239bfacee3
[ConstraintSystem] Account for situations when witness for associated type is null
...
In some circularity cases `getAssociatedType` would produce a `Type()`,
we need to account for that in `TypeSimplifier` to avoid crashing.
2024-02-22 10:55:33 -08:00
Li, Zhen
b44fbf60c6
[CSDiagnostics] Add diags for holes in generic parameter pack
2024-02-21 23:25:25 -05:00
Ben Barham
ef8825bfe6
Migrate llvm::Optional to std::optional
...
LLVM has removed llvm::Optional, move over to std::optional. Also
clang-format to fix up all the renamed #includes.
2024-02-21 11:20:06 -08:00
Holly Borla
ddf2fc44f4
[Concurrency] Allow #isolation to have a more specific contextual type.
2024-02-16 16:27:54 -08:00
Pavel Yaskevich
0db22316a2
[ConstraintSystem] Record conformances synthesized for ad-hoc distributed requirements
2024-02-12 14:26:30 -08:00
Pavel Yaskevich
95beb6cdd9
Merge pull request #71444 from xedin/remote-duplicate-entry-in-solution-total-memory
...
[ConstraintSystem] NFC: Remove duplicate entry from `Solution::getTot…
2024-02-08 09:30:16 -08:00
Hamish Knight
2c77947000
Merge pull request #71006 from hamishknight/implicit-last-expression
...
Introduce implicit last expression results
2024-02-08 10:15:01 +00:00
Pavel Yaskevich
b761e4f320
[ConstraintSystem] NFC: Remove duplicate entry from Solution::getTotalMemory
2024-02-07 12:33:07 -08:00
Hamish Knight
33cdd33f9e
[CS] Account for implicit returns in closures
...
Avoid defaulting to Void if we have an implicit
return from which we can infer the result type.
2024-02-07 18:14:23 +00:00
Hamish Knight
1003b2f30b
[CS] Remove CTP_ImpliedReturnStmt
...
Unify with `CTP_ReturnStmt`, and have the
SyntacticElementTarget carry the ReturnStmt for
regular type-checking, which we can use to record
implied returns.
2024-02-07 18:14:23 +00:00
John McCall
2f8a33cf0a
Experimental type-checking support for @isolated(any) function types.
2024-02-06 22:54:27 -05:00
Hamish Knight
05615fa0e4
NFC: Rename TypeWalker's SkipChildren to SkipNode
...
For consistency with ASTWalker.
2024-02-05 15:27:25 +00:00
Hamish Knight
16cfca4186
[ASTWalker] NFC: Rename SkipChildren -> SkipNode
...
This better describes what the action currently
does, and allows us to re-introduce `SkipChildren`
with the correct behavior.
2024-02-05 15:27:25 +00:00
Slava Pestov
8092f18772
AST: Generalize GenericSignatureImpl::getUpperBound()
...
Handle inverses, and add a couple of flags (yuck!) to allow its
usage in diagnostics and code completion.
2024-02-01 23:35:33 -05:00
Hamish Knight
d9fd4c75b1
[CS] Remove isInputExpression parameter
...
This wasn't consistently used, and consequently
could result in some expressions getting their
parents invalidated. Instead, replace it with a
query to make sure we don't try and add an
expression we've already computed the parent info
for.
2024-01-31 20:26:20 +00:00
Hamish Knight
9b64990d24
[AST] Remove the "single expression body" bit
...
Remove this bit from function decls and closures.
Instead, for closures, infer it from the presence
of a single return or single expression AST node
in the body, which ought to be equivalent, and
automatically takes result builders into
consideration. We can also completely drop this
query from AbstractFunctionDecl, replacing it
instead with a bit on ReturnStmt.
2024-01-30 14:08:54 +00:00
Sima Nerush
066f253d2e
Merge pull request #70196 from simanerush/nested-pack-iteration
...
[SE-0408] Enable nested iteration
2024-01-27 10:18:12 -08:00
Sima Nerush
0b167b55b1
[ConstraintSystem] Cache pack element generic environments associated withfor-in loops over parameter packs to apply in getPackElementEnvironment.
2024-01-27 00:12:33 -08:00
John McCall
b0fb03d8c7
Create a uniform representation for function type isolation.
...
Not quite NFC because apparently the representation bleeds into what's
accepted in some situations where we're supposed to be warning about
conflicts and then making an arbitrary choice. But what we're doing
is nonsense, so we definitely need to break behavior here.
This is setting up for isolated(any) and isolated(caller). I tried
to keep that out of the patch as much as possible, though.
2024-01-25 22:11:01 -05:00
Pavel Yaskevich
bc86b8db30
Merge pull request #71104 from xedin/rdar-121214563
...
[Sema] Temporary disable l-value stripping while erasing opened exist…
2024-01-24 09:46:38 -08:00
Pavel Yaskevich
3d74a397df
[Sema] Temporary disable l-value stripping while erasing opened existentials
...
Reverts part of https://github.com/apple/swift/pull/69950 because
it causes failure in existing code.
2024-01-23 19:34:54 -08:00
Holly Borla
d60a06760b
Merge pull request #71050 from hborla/global-actor-unsafe
...
[Concurrency] Deprecate `@GlobalActor(unsafe)` in favor of `@preconcurrency @GlobalActor`
2024-01-22 16:52:56 -08:00
Pavel Yaskevich
be39c05df2
Merge pull request #71026 from xedin/rdar-111120803
...
[CSSimplify] Increase impact of requirement failures in special result builder methods
2024-01-22 13:10:59 -08:00
Holly Borla
47afd21d85
[Concurrency] Remove ActorIsolation::GlobalActorUnsafe.
2024-01-21 21:05:33 -08:00
Slava Pestov
fe00f87fc0
AST: Tweak ASTContext::hadError()
2024-01-20 17:44:12 -05:00
Pavel Yaskevich
538892325f
[ConstraintSystem] Extend isResultBuilderMethodReference to include buildIf
2024-01-19 15:11:41 -08:00
Pavel Yaskevich
60c20536ee
[ConstraintSystem] NFC: Extract isResultBuilderMethodReference into a namespace method
2024-01-19 15:11:41 -08:00
Slava Pestov
d7ce5172a0
Sema: Replace a couple of TypeChecker::getProtocol() calls with ASTContext::getProtocol()
2024-01-17 19:59:58 -05:00
Slava Pestov
a7f484b3a4
AST: Clean up isSendableType()
2024-01-16 22:44:43 -05:00
Doug Gregor
a30b623ee6
Implement typed throws support in _openExistential.
2024-01-14 14:32:49 -08:00
Doug Gregor
8912d4aa71
[SE-0413] Adopt typed throws in withoutActuallyEscaping(_:do:)
...
There is a small bug fix here in the identification of the catch node,
where the leading `{` of a closure was considered to be "inside" the
closure for code like
{ ... }()
causing us to assume that the call to the closure would catch the error
within the closure.
Other than that, introduce the thrown error type into the type checker's
modeling of `withoutActuallyEscaping(_:do:)`, and mirror that in the
library declaration.
2024-01-13 21:57:24 -08:00
Kavon Farvardin
bb78171767
[NFC] forEachMissingConformance doesn't use module
2024-01-10 19:39:07 -08:00
Slava Pestov
597fb216cb
Merge pull request #70457 from slavapestov/parameter-pack-open-type
...
Fix openType() handling of parameter packs
2024-01-10 13:41:08 -05:00
Slava Pestov
5d58a634ad
Sema: Clean up openType() and openUnboundGenericType()
...
Fixes:
- rdar://112785081
- https://github.com/apple/swift/issues/67906
- https://github.com/apple/swift/issues/68160
2024-01-09 15:23:42 -05:00
Saleem Abdulrasool
d36ef3fed1
Merge pull request #63915 from AtariDreams/std-math
...
Ensure the correct function is called by prepending std:: to the std math functions
2024-01-04 20:30:51 -08:00
Doug Gregor
baaa8f3e5b
Merge pull request #70677 from DougGregor/se-0413-typed-throws
...
Enable SE-0413 "Typed Throws" by default
2024-01-04 16:11:26 -08:00
Doug Gregor
ea836389f7
Suppress warnings about Never error types in catch clauses
...
Enabling typed throws has introduced some spurious warnings about error
values of `Never` type on top of the custom "unreachable" diagnostics
for catch clauses, so suppress the new warnings---they aren't helpful.
2024-01-04 09:37:35 -08:00
Slava Pestov
8e2aa52f7a
Merge pull request #70667 from slavapestov/assorted-small-cleanups
...
Assorted small cleanups
2024-01-02 19:00:59 -05:00
Doug Gregor
b9c5aca15f
Enable SE-0413 "Typed Throws" by default
2024-01-02 15:34:07 -08:00
Slava Pestov
fb3ad9a950
Sema: Tiny cleanup in ConstraintSystem::getTypeOfReference()
2024-01-02 15:41:13 -05:00
Pavel Yaskevich
e4f9965ff7
[ConstraintSystem] Fail key path capability inference if root is a placeholder
...
If root type of a key path has been determined to be a hole there
is no reason to delay the inference decision which should be a
failure because none of the components would be inferrable from
a placeholder root.
2024-01-01 12:48:31 -08:00
Pavel Yaskevich
a288b1eb76
[CSBindings] Key path cannot be bound to typ erased type even if its existential
...
Extend existing check to handle type erased versions when they
are wrapped in an existential.
2023-12-19 13:36:46 -08:00
Slava Pestov
2b28cb1647
Sema: Implement missing case in existential erasure
...
Fixes https://github.com/apple/swift/issues/61934 .
2023-12-16 12:24:34 -05:00