Slava Pestov
885d221417
Merge pull request #76585 from slavapestov/small-subst-cleanups-2
...
More type substitution cleanups
2024-09-20 15:59:04 -04:00
Pavel Yaskevich
ebc4e8d2d7
Merge pull request #76584 from xedin/remove-outdated-comment
...
[CSBindings] NFC: Remove outdated comment
2024-09-19 20:33:52 -07:00
Slava Pestov
4bb8f46d6d
Merge pull request #76536 from slavapestov/small-subst-cleanups
...
Tiny optimization and cleanups
2024-09-19 21:36:51 -04:00
Sima Nerush
952ae45b3c
Merge pull request #76395 from simanerush/global-actor-cut-off-119628202
...
[Concurrency] Allow `nonisolated` to prevent global actor inference.
2024-09-19 14:58:15 -07:00
Doug Gregor
6039df3a34
Merge pull request #76565 from DougGregor/remove-if-config
...
Remove IfConfigDecl from the AST
2024-09-19 13:49:03 -07:00
Slava Pestov
cfc3012289
Sema: Use transformRec() in replaceArchetypesWithTypeVariables()
2024-09-19 16:23:39 -04:00
Pavel Yaskevich
b712b501c0
[CSBindings] NFC: Remove outdated comment
...
The closure literal check has been removed but the comment
was left behind.
2024-09-19 13:21:35 -07:00
Slava Pestov
86f9266fa7
Sema: Fix invalid usage of SubstitutionMap::getProtocolSubstitutions()
2024-09-19 14:18:34 -04:00
Slava Pestov
afbd81a599
AST/Sema: Use ProtocolConformanceRef::getTypeWitness()
2024-09-19 14:18:33 -04:00
Slava Pestov
663dc855be
Sema: More LLVM_DEBUGs for associated type inference
2024-09-19 14:18:32 -04:00
Sima Nerush
7e5a57a07a
Guard the changes behind an experimental feature flag.
2024-09-19 10:09:56 -07:00
Sima Nerush
6ff022d132
[Concurrency] Allow nonisolated on stored properties of non-'Sendable' type.
2024-09-19 10:09:11 -07:00
Slava Pestov
834574d1c0
Sema: Replace a couple of getTypeOfMember() calls
2024-09-19 12:54:27 -04:00
Slava Pestov
f8b667a18c
Sema: Remove some usages of TypeSubstitutionMap
2024-09-19 12:54:26 -04:00
Michael Gottesman
fb281331b3
Merge pull request #76558 from gottesmm/pr-39b63781333d46b16f086a7c192efc67b26255db
...
[concurrency] Behind the flag UnspecifiedMeansMainActorIsolated, try inferring by default main actor isolation instead of nonisolated for unspecified.
2024-09-19 09:18:33 -07:00
Doug Gregor
5b2520e379
Remove IfConfigDecl from the AST
...
The swift-syntax tree retains information about the parsed #if
regions. Drop it from the semantic AST.
2024-09-18 20:51:54 -07:00
Michael Gottesman
3843899c19
[concurrency] Behind the flag UnspecifiedMeansMainActorIsolated, try inferring by default main actor isolation instead of nonisolated for unspecified.
...
Just to play with.
2024-09-18 13:23:23 -07:00
Michael Gottesman
576dfca4df
Merge pull request #76490 from gottesmm/pr-748475502347e63ae244ea1d5aef83208ae87b8f
...
[typechecker] Convert a std::string -> SmallString.
2024-09-18 11:18:59 -07:00
Doug Gregor
da0c70f301
Merge pull request #76512 from DougGregor/sourcefile-nonopt-buffer
...
Ensure that SourceFiles always have a backing buffer in the SourceManager
2024-09-18 10:54:52 -07:00
Pavel Yaskevich
43e19358d7
Merge pull request #76458 from xedin/rdar-131347583
...
[Concurrency] Allow global actor mismatches while overriding `@precon…
2024-09-18 09:16:57 -07:00
Slava Pestov
ad68d22041
Merge pull request #76518 from slavapestov/fix-issue-76513
...
Concurrency: Reject nonisolated lazy properties
2024-09-17 15:11:39 -04:00
Hamish Knight
4e32b60e9e
Merge pull request #76485 from hamishknight/apply-a-cleanup
...
[CS] A couple of CSApply cleanups
2024-09-17 18:36:35 +01:00
Pavel Yaskevich
afcf38e76d
Merge pull request #76487 from xedin/fix-invalid-binding-elision
...
[CSBindings] Prevent `BindingSet::isViable` from dropping viable bindings
2024-09-17 08:44:20 -07:00
Slava Pestov
46b4983baf
Concurrency: Reject nonisolated lazy properties
...
We already banned nonisolated property wrappers, and 'lazy' is
conceptually similar, so it makes sense to disallow it also.
Fixes https://github.com/swiftlang/swift/issues/76513 .
2024-09-17 11:30:44 -04:00
Hamish Knight
e8ef77d307
[Sema] NFC: Elaborate on a comment
2024-09-17 12:35:11 +01:00
Hamish Knight
1cc00e3676
[CS] NFC: Remove SolutionApplicationToFunctionResult
...
This is now no longer needed.
2024-09-17 12:35:11 +01:00
Hamish Knight
1f79cbdca1
[CS] Sink closure attribute/param checking into applySolution
...
The cases where CSApply fails should be fairly
limited these days, and there doesn't seem to be
any reason we shouldn't run these on failure anyway.
2024-09-17 12:35:11 +01:00
Hamish Knight
930dc18eb7
[CS] Avoid delaying application for multi-statement closures
...
We ought to be able to apply the solution to them
immediately now.
2024-09-17 12:35:11 +01:00
Hamish Knight
f0151c1d21
[CS] Delay type-checking of local decls
...
Delay `typeCheckDecl` for local decls until the
end of CSApply. This replaces the existing logic
for delaying type-checking for local functions.
2024-09-17 12:35:10 +01:00
Hamish Knight
d99d881af5
[CS] NFC: Factor out base class SyntacticElementTargetRewriter
...
Pass this instead of a function for rewriting
targets.
2024-09-17 12:35:10 +01:00
Hamish Knight
002c6d169b
[CS] Remove some calls to setExprTypes
...
`rewriteTarget` already calls `setExprTypes` for
expressions, so these are redundant.
2024-09-17 12:35:10 +01:00
Doug Gregor
49aa0e966f
Ensure that SourceFiles always have a backing buffer in the SourceManager
...
The "buffer ID" in a SourceFile, which is used to find the source file's
contents in the SourceManager, has always been optional. However, the
effectively every SourceFile actually does have a buffer ID, and the
vast majority of accesses to this information dereference the optional
without checking.
Update the handful of call sites that provided `nullopt` as the buffer
ID to provide a proper buffer instead. These were mostly unit tests
and testing programs, with a few places that passed a never-empty
optional through to the SourceFile constructor.
Then, remove optionality from the representation and accessors. It is
now the case that every SourceFile has a buffer ID, simplying a bunch
of code.
2024-09-16 21:46:42 -07:00
Doug Gregor
05e8140c6d
Provide macro module name in MacroExpansionExpr creation
...
This properly passes the module name through from attached macros to
the freestanding macro that are used under-the-hood for type checking.
2024-09-16 16:44:17 -07:00
Pavel Yaskevich
6eeb6f9c74
Merge pull request #76470 from xedin/rdar-135974645
...
[CSSimplify] Forego any contextual score increases while checking era…
2024-09-16 13:40:30 -07:00
Michael Gottesman
e9c74702d7
[typechecker] Convert a std::string -> SmallString.
...
Just noticed this as I was reading the code.
2024-09-16 10:47:45 -07:00
Pavel Yaskevich
2c9d05991f
[CSBindings] Prevent BindingSet::isViable from dropping viable bindings
...
I think the original idea was to elide `Array<$T>` if there is
a binding a resolved generic arguments i.e. `Array<Float>`, but
the check doesn't account for the fact that bindings could be
of different kinds and there are some implicit conversions that
could be missed if we remove the bindings.
For example, given the following constraints:
`Array<$T0> conv $T1`
`$T1 conv Array<(String, Int)>`
`$T0` can be a supertype of `Array<$T0>` and subtype of `Array<(String, Int)>`.
The solver should accept both types as viable bindings because the
`$T0` could be bound to `(key: String, value: Int)` and that would
match `Array<(String, Int)>` conversion.
2024-09-16 09:54:12 -07:00
Hamish Knight
c9c962bbd1
Merge pull request #76473 from hamishknight/attrick
...
[CS] Call `checkParameterList` for single-expr closures
2024-09-16 17:16:12 +01:00
Hamish Knight
b1c90feb52
[CS] Sink closure property wrapper application into applySolution
...
We need to make sure property wrappers are
applied before `checkParameterList`.
2024-09-14 15:37:21 +01:00
Hamish Knight
2d6a38b2cd
[CS] Call checkParameterList for single-expr closures
...
Previously we would only call this in the delayed
application logic, which is currently run for
multi-statement closures. I'm planning on
removing that code path, which uncovered this
issue.
2024-09-14 15:37:21 +01:00
Slava Pestov
c997778e0f
Merge pull request #76467 from slavapestov/fix-rdar135607071
...
SIL: Fix lowering of local functions with explicit isolated parameter
2024-09-14 08:45:30 -04:00
Slava Pestov
f35c90a6b7
Merge pull request #76445 from slavapestov/maptypeintocontext
...
Overhaul mapTypeIntoContext()
2024-09-14 08:45:20 -04:00
Slava Pestov
6fb66db6da
Merge pull request #76318 from slavapestov/favored-over-disjunction-heuristic
...
Sema: Generalize heuristic in favoredOverDisjunction()
2024-09-14 08:45:09 -04:00
Pavel Yaskevich
0276a33de5
[CSSimplify] Forego any contextual score increases while checking erased member type
...
`resolveOverload` introduces a conversion if there were any adjustments
to a member type on existential base. This conversion exists only to
check adjustments in the member type, so the fact that adjustments also
cause a function conversion is unrelated.
Resolves: rdar://135974645
2024-09-13 16:30:09 -07:00
Slava Pestov
e0377fb9c4
SIL: Fix lowering of local functions with explicit isolated parameter
...
When the isolated parameter is the function's own parameter, it is
not a capture.
Fixes rdar://135607071.
2024-09-13 19:26:42 -04:00
Allan Shortlidge
02dbb96b94
AST: Rename AvailabilityContext to AvailabilityRange.
...
The generality of the `AvailabilityContext` name made it seem like it
encapsulates more than it does. Really it just augments `VersionRange` with
additional set algebra operations that are useful for availability
computations. The `AvailabilityContext` name should be reserved for something
pulls together more than just a single version.
2024-09-13 16:25:18 -07:00
Slava Pestov
4923521227
AST: Re-implement GenericEnvironment::mapTypeIntoContext() using TypeTransform
2024-09-13 15:19:48 -04:00
Pavel Yaskevich
22b9dd7f7b
[Concurrency] Allow global actor mismatches while overriding @preconcurrency members in Swift 5 mode
...
Downgrade a mismatch on global actor attributes to a warning until
Swift 6 to enable class authors to introduce concurrency annotations
to overridable members.
Resolves: rdar://131347583
2024-09-13 11:28:47 -07:00
Pavel Yaskevich
16244b327d
Merge pull request #76439 from xedin/delay-implicit-pointer-conversions-for-unknown-inout
...
[CSSimplify] Delay `inout` type to pointer conversion until `inout` is sufficiently resolved
2024-09-13 11:06:28 -07:00
Slava Pestov
eaf06eae0e
Sema: Fix call to mapTypeIntoContext() with wrong environment
2024-09-13 08:12:51 -04:00
Slava Pestov
40641f5e91
Sema: Fix dodgy logic in findMissingGenericRequirementForSolutionFix()
...
'type' and 'missingType' are contextual types in the generic environment
of the witness thunk. We cannot simply map them into the environment of
the conformance, because if the conforming type is a class, the witness
thunk has an extra generic parameter at depth=0, index=0 and all other
generic parameters are shifted down by one depth.
2024-09-13 08:12:51 -04:00