Amritpan Kaur
86d456e4eb
[Sema] Block inout method arguments.
2025-03-19 08:56:03 -07:00
Amritpan Kaur
a96b780a28
[Sema] Diagnose method arg captures that are not Hashable/Equatable.
2025-03-19 08:56:03 -07:00
Amritpan Kaur
970159c09d
[CSDiagnostics] Block async, throws and mutating methods.
2025-03-19 08:56:03 -07:00
Amritpan Kaur
7ff563eb0c
[CSDiagnostics] Remove checks preventing method/initializer keypaths.
2025-03-19 08:56:03 -07:00
Amritpan Kaur
0e895c6a2b
[CSApply] Solve keypath methods and initializers.
2025-03-19 08:56:03 -07:00
Amritpan Kaur
724e3f9910
[Constraint System] Evaluable hashability during constraint generation.
2025-03-19 08:56:03 -07:00
Amritpan Kaur
c059d1521d
[ConstraintSystem] Evaluate capabilities for keypath type.
2025-03-19 08:56:03 -07:00
Amritpan Kaur
6af6374e39
[CSGen] Generate constraints for keypaths to methods.
2025-03-19 08:56:03 -07:00
Amritpan Kaur
0c614e09d1
[Expr/AST] Add unresolvedApply component to handle method arguments.
2025-03-19 08:56:03 -07:00
Amritpan Kaur
2583da94b2
[NFC] Generalize subscript index handling.
2025-03-19 08:53:18 -07:00
Amritpan Kaur
811d54901b
[NFC] Rename unresolvedProperty to unresolvedMember
...
to generalize for both properties and method members.
2025-03-19 08:53:18 -07:00
Amritpan Kaur
8f71f5c780
[NFC] Rename property to member to generalize
...
for both properties and method members.
2025-03-19 08:53:18 -07:00
Artem Chikin
88dec5199e
[Dependency Scanning] Add support for placing explicitly-built SDK modules into a separate module cache
...
With '-sdk-module-cache-path', Swift textual interfaces found in the SDK will be built into a separate SDK-specific module cache.
Clang modules are not yet affected by this change, pending addition of the required API.
2025-03-19 09:17:04 -06:00
Slava Pestov
c598ec3f5c
Sema: Add LLVM_DEBUG to WitnessChecker::findBestWitness()
2025-03-19 09:30:46 -04:00
Gábor Horváth
e5c5ec57d2
Update lib/Sema/TypeCheckType.cpp
...
Co-authored-by: Anthony Latsis <alatsis@apple.com >
2025-03-19 12:56:56 +00:00
Gabor Horvath
b632534528
[cxx-interop] Interpret Self as a static shorthand for FRTs
...
We do not have dynamic self metadata for foreign reference types.
rdar://145066864
2025-03-19 12:56:56 +00:00
Slava Pestov
6a3ead3a44
Merge pull request #80107 from slavapestov/for-abstract-conformance
...
Fix a few more callers of ProtocolConformanceRef::forAbstract() to pass in a subject type
2025-03-19 07:15:27 -04:00
Holly Borla
8ec70e2559
[Macros] Gate closure body macros behind an experimental feature flag.
2025-03-18 20:50:47 -07:00
Pavel Yaskevich
9cd3c8de86
[TypeCheckMacros] Never associate MacroExpansionExpr with a closure
...
The closures are type-checked after macros are expanded
which means that macro cannot reference any declarations
from inner or outer closures as its arguments.
For example:
`_: (Int) -> Void = { x in { @Macro(x) in ... }() }`
`x` is not going to be type-checked at macro expansion
time and cannot be referenced by `@Macro`.
Let's walk up declaration contexts until we find first
non-closure one. This means that we can support a local
declaration that is defined inside of a closure because
they are separately checked after outer ones are already
processed.
2025-03-18 20:50:47 -07:00
Pavel Yaskevich
42ccd182f6
[PreCheckTarget] Move closure body expansion into PreCheckTarget::walkToClosureExprPre
...
If closure body is expanded in expression context we need to do
some special handling to make sure that source ranges are not
completely broken.
2025-03-18 20:50:47 -07:00
Pavel Yaskevich
b7e4b4370e
[Macros] A macro attached to a closure body covers a range after in and up to }
...
The macro is not allowed to write explicit type or `in` keyword.
2025-03-18 20:50:47 -07:00
Holly Borla
31d4f661fc
[Macros] Support function body macros on closures.
2025-03-18 20:50:47 -07:00
Doug Gregor
a02633ad47
Merge pull request #80103 from DougGregor/strict-safety-more-minor-cleanups
2025-03-18 20:29:25 -07:00
Slava Pestov
f7b0b72766
Sema: Refactor TypeChecker::containsProtocol() a bit
2025-03-18 19:38:21 -04:00
Pavel Yaskevich
cfad698202
[CSDiagnostics] Tailor diagnostic for Escapable conformance mismatch in key path context
2025-03-18 14:38:40 -07:00
Doug Gregor
9570e1e3a7
[SE-0458] Add fix-it for removing unnecessary "unsafe" keywords
2025-03-18 13:57:16 -07:00
Pavel Yaskevich
6c2b12547b
[CSDiagnostics] Tailor diagnostic for Copyable conformance mismatch in key path context
2025-03-18 13:46:56 -07:00
Doug Gregor
4742d2c5db
[SE-0458] withoutActuallyEscaping is unsafe for @convention(block)
...
The implementation of `withoutActuallyEscaping` for `@convention(block)`
functions cannot verify at runtime that the function did not actually
escape. Diagnose this as unsafe code under strict memory safety checking.
Fixes rdar://139994149.
2025-03-18 13:26:47 -07:00
Pavel Yaskevich
9a8f8277f9
Merge pull request #80085 from xedin/fix-assignFixedType-use
...
[CSSimplify] NFC: `assignFixedType` no longer accepts a locator
2025-03-18 08:49:30 -07:00
Anthony Latsis
ad3a5adc6d
Merge pull request #80008 from AnthonyLatsis/danaus-plexippus-4
2025-03-18 13:24:17 +00:00
Pavel Yaskevich
e0f9e65976
[CSSimplify] NFC: assignFixedType no longer accepts a locator
...
`assignFixedType` now accepts `bool` as a third parameter but
not all call sites were updated to reflect that, some of them
are still passing `ConstraintLocator *` which implicitly gets
converted to a `bool`.
2025-03-18 00:16:22 -07:00
Anthony Latsis
c49947579a
Sema: Implement adoption mode for AsyncCallerExecution
2025-03-18 01:58:31 +00:00
Slava Pestov
145a7c5fe2
Merge pull request #80057 from slavapestov/fix-rdar146780049
...
Sema: Fix non-determinism with ConstraintSystem::ConstraintRestrictions
2025-03-17 21:28:01 -04:00
Pavel Yaskevich
a8baec6c41
[CSSimplify] Open key path type before assignment to its record requirements
...
`Root` and `Value` generic parameters now have conformance requirements
which we need to account for post-binding inference.
2025-03-17 17:03:09 -07:00
Allan Shortlidge
dd68e98002
Merge pull request #80051 from tshortli/refactor-semantic-decl-availability-request
...
AST: Introduce `DeclRuntimeAvailability`
2025-03-17 14:35:48 -07:00
Pavel Yaskevich
6c22036931
[CSSimplify] NFC: Perform assignments to a key path in a separate method
...
Previously key path type didn't have any requirements on their
root and value types but now that they do, we need a dedicated
place to perform an assignment and open/record all of the requirements.
2025-03-17 14:06:45 -07:00
Anthony Latsis
2c7fb6a463
[NFC] Sema: Move determineClosureIsolation definition to the top level
...
Also combine the computed isolation and preconcurrency once at the end
rather than at every return.
2025-03-17 19:46:25 +00:00
Anthony Latsis
de36c3ff2c
[NFC] Sema: Remove some redundant getASTContext calls in the isolation checker
2025-03-17 19:46:25 +00:00
Slava Pestov
34e7e824e9
Sema: Fix non-determinism with ConstraintSystem::ConstraintRestrictions
...
We iterate over the DenseMap and simplify both types appearing
in the key. If multiple keys simplify to the same type, later
keys overwrite earlier keys, so the outcome depends on hash
table order.
Fix this by introducing an arbitrary tie break: we prefer the
highest-numbered restriction.
Fixes rdar://146780049.
2025-03-17 14:35:10 -04:00
Pavel Yaskevich
b32a1caf53
Merge pull request #80032 from xedin/expand-scope-of-execution-attr
...
[AST/Sema] Allow `@execution(...)` attribute to be used on initializers and accessors
2025-03-17 09:01:41 -07:00
Allan Shortlidge
fc2b5bebdc
AST: Remove Decl::isSemanticallyUnavailable().
...
It can be replaced by querying the `AvailabilityContext` for a declaration
directly.
2025-03-16 23:33:56 -07:00
Allan Shortlidge
1945c37af5
Sema: Retire some ExportContext availability conveniences.
...
Just use the `AvailabilityContext` directly.
2025-03-16 09:38:54 -07:00
Allan Shortlidge
44ab0074ad
Sema: Retire TypeChecker::overApproximateAvailabilityAtLocation().
...
It has been superseded by `AvailabilityContext::forLocation()`.
2025-03-16 09:38:54 -07:00
Allan Shortlidge
2dd544a73c
AST/Sema: Sink AvailabilityContext for location queries from Sema to AST.
2025-03-15 23:47:29 -07:00
Allan Shortlidge
151c9dee39
AST: Consolidate abstract/contrete syntax decl lookup functions.
2025-03-15 23:47:29 -07:00
Allan Shortlidge
02dcd5d8cf
AST/Sema: Sink AvailabilityScopeBuilder from Sema to AST.
2025-03-15 23:47:29 -07:00
Allan Shortlidge
ff9b541c57
AST/Sema: Sink isExported() queries from Sema to AST.
2025-03-15 23:47:29 -07:00
Doug Gregor
bf387c56e2
Merge pull request #80030 from DougGregor/import-macro-in-cpp-class-and-namespace
...
[Clang importer] Report auxiliary decls from C++ class and namespace lookup
2025-03-14 19:23:00 -07:00
Pavel Yaskevich
eeabaaee6c
[AST/Sema] Allow @execution(...) attribute to be used on initializers and accessors
2025-03-14 17:28:53 -07:00
Doug Gregor
84a4a8bedb
[Importer] Ensure that we can see macro-expanded declarations in C++ namespaces
...
Lookup into C++ namespaces uses a different path from C++ record declarations.
Augment the C++ namespace lookup path to also account for the auxiliary
declarations introduced by peer macro expansions.
2025-03-14 14:10:44 -07:00