Commit Graph

19431 Commits

Author SHA1 Message Date
swift-ci
eec81cb15e Merge remote-tracking branch 'origin/main' into rebranch 2024-06-13 06:34:21 -07:00
Kavon Farvardin
4517333b8e Merge pull request #74372 from kavon/rdar125659789 2024-06-13 06:27:58 -07:00
swift-ci
c7002b524a Merge remote-tracking branch 'origin/main' into rebranch 2024-06-12 22:14:25 -07:00
Kavon Farvardin
9eba052ab2 Merge pull request #74322 from kavon/se427-noimplicit-for-invertible
SE-427: Make conditional conformances to Copyable more explicit.
2024-06-12 22:03:49 -07:00
Kavon Farvardin
273549239b AST: fix isWrittenWithConstraints
Surprisingly, there are some situations where an extension can end up
with _fewer_ constraints than the extended type. That was baked-in as an
assertion in this new-ish method.

I haven't figured out why that can happen in the reproducer only when
using `-interpret` mode. It didn't trigger the assertion for me when
compiling normally.

The fix is simple: check all the requirements, rather than using a
short-cut.

resolves rdar://125659789 / https://github.com/apple/swift/issues/72719
2024-06-12 17:20:49 -07:00
Kavon Farvardin
a1e14ae0c7 Sema: ext's must add solo invertible conformances
This helps prevent confusion after not inferring requirements if the
extension adds a Copyable conformance.
2024-06-12 14:44:22 -07:00
Kavon Farvardin
ec4a125f3e NCGenerics: ext's might not infer invertible req's
If the extension adds conformance to an invertible protocol, it's
confusing for people to also infer conditional requirements on the
generic parameters for those invertible protocols. This came up in the
review of SE-427.
2024-06-12 14:44:22 -07:00
swift-ci
71d08ed74f Merge remote-tracking branch 'origin/main' into rebranch 2024-06-12 07:34:44 -07:00
Artem Chikin
3dfeb5f876 Merge pull request #74307 from artemcm/CacheVisibleClangModulesInModules
Cache visible Clang modules for interface printing in `ModuleDecl`
2024-06-12 07:33:13 -07:00
swift-ci
86259518bf Merge remote-tracking branch 'origin/main' into rebranch 2024-06-12 01:59:24 -07:00
Hamish Knight
85c0555c89 Merge pull request #74288 from hamishknight/invalid-enum-mangle
[Mangler] Mangle function type for invalid enum element
2024-06-12 09:44:13 +01:00
swift-ci
0199ac49ba Merge remote-tracking branch 'origin/main' into rebranch 2024-06-11 17:15:34 -07:00
Xi Ge
bcdcdf19f6 Merge pull request #74302 from nkcsgexi/revert-pkg-export
Revert recent changes for exportability for package declarations
2024-06-11 17:13:21 -07:00
swift-ci
37bf57ef27 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-11 15:53:47 -07:00
Meghana Gupta
f1a887515b Merge pull request #74195 from meg-gupta/immortal
Add dependsOn(immortal)
2024-06-11 15:51:34 -07:00
Hamish Knight
d98cb9e2b3 [Mangler] Mangle function type for invalid enum element
Previously we would mangle a single ErrorType as
the type for the element, but that would fail to
demangle since we expect a function type. Use the
same logic as AbstractFunctionDecl, mangling a
function type of ErrorType. While here, also
handle SubscriptDecls and check for error types
rather than `isInvalid()`.

rdar://129065620
2024-06-11 21:24:11 +01:00
Artem Chikin
71ec06e656 Cache visible Clang modules for interface printing in 'ModuleDecl'
Instead of caching the collection of visible Clang modules in the 'TypePrinter', compute and cache them in the 'ModuleDecl'. When printing a textual interface, the compiler will instantiate many new instances of 'TypePrinter', which means caching them there is not useful.
2024-06-11 13:04:16 -07:00
Xi Ge
6f5b40543d Revert "Handle package exportability."
This reverts commit d182d01c28.
2024-06-11 11:54:00 -07:00
Meghana Gupta
c14559173d Add dependsOn(immortal) 2024-06-11 11:18:10 -07:00
swift-ci
19d9da59d3 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-11 10:54:37 -07:00
Slava Pestov
0211fd7025 AST: Make absence of discriminator into a fatal error
... even in noassert builds. This is always a miscompile and should
be prevented.
2024-06-11 09:01:39 -04:00
swift-ci
5f3b1c4929 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-11 03:14:01 -07:00
Hamish Knight
fe272e6cdd [Sema] Restore 5.10 implicit self behavior prior to Swift 6 mode
Unfortunately we've encountered another source
breaking case here:

```
class C {
  func method() {}

  func foo() {
    Task { [weak self] in
      Task {
        method()
      }
    }
  }
}
```

In 5.10 we'd only do the unqualified lookup for
`self` when directly in a `weak self` closure,
but with the implicit self rework, we'd start
using the `weak self` here, leading to a
type-checker error.

At this point, adding more edge cases to the
existing logic is going to make things much more
complicated. Instead, reinstate the 5.10 implicit
self lookup behavior and diagnostic logic,
switching over to the new logic only under Swift 6
mode.

rdar://129475277
2024-06-10 20:29:16 +01:00
swift-ci
f53c33f21f Merge remote-tracking branch 'origin/main' into rebranch 2024-06-10 01:55:54 -07:00
Doug Gregor
25830d6bc3 Merge pull request #74225 from DougGregor/flow-sensitive-actor-init-isolation
Teach `#isolation` to respect the flow-sensitive nature of actor initializers
2024-06-10 01:52:38 -07:00
Doug Gregor
d1ae73f436 Handle flow-sensitive #isolation in distributed actor initializers.
Distributed actors can be treated as actors by accessing the `asLocalActor`
property. When lowering `#isolation` in a distributed actor initializer,
use a separate builtin `flowSensitiveDistributedSelfIsolation` to
capture the conformance to `DistributedActor`, and have Definite
Initialization introduce the call to the `asLocalActor` getter when
needed.
2024-06-09 22:48:43 -07:00
Doug Gregor
956243cd7e Teach #isolation to respect the flow-sensitive nature of actor initializers
Actor initializers have a flow-sensitive property where they are isolated
to the actor being initialized only after the actor instance itself is
fully-initialized. However, this behavior was not being reflected in
the expansion of `#isolation`, which was always expanding to `self`,
even before `self` is fully formed.

This led to a source compatibility issue with code that used the async
for..in loop within an actor initializer *prior* to the point where the
actor was fully initialized, because the type checker is introducing
the `#isolation` (SE-0421) but Definite Initialization properly rejects
the use of `self` before it is initialized.

Address this issue by delaying the expansion of `#isolation` until
after the actor is fully initialized. In SILGen, we introduce a new
builtin for this case (and *just* this case) called
`flowSensitiveSelfIsolation`, which takes in `self` as its argument
and produces an `(any Actor)?`. Definite initialization does not treat
this as a use of `self`. Rather, it tracks these builtins and
replaces them either with `self` (if it is fully-initialized at this
point) or `nil` (if it is not fully-initialized at this point),
mirroring the flow-sensitive isolation semantics described in SE-0327.

Fixes rdar://127080037.
2024-06-07 14:54:20 -07:00
swift-ci
a294bf228e Merge remote-tracking branch 'origin/main' into rebranch 2024-06-06 13:57:43 -07:00
Becca Royal-Gordon
91afad2fb0 Merge pull request #74135 from beccadax/objcimpl-the-final-countdown
Fix two objcImpl resyntaxing bugs
2024-06-06 13:42:28 -07:00
swift-ci
be87ad7bcb Merge remote-tracking branch 'origin/main' into rebranch 2024-06-06 10:35:38 -07:00
Meghana Gupta
af1d6017f9 Merge pull request #74132 from meg-gupta/deleteresultdependson
Remove resultDependsOn/resultDependsOnSelf
2024-06-06 10:23:31 -07:00
swift-ci
27774053d4 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-06 04:55:03 -07:00
Slava Pestov
11208ee121 Merge pull request #74164 from slavapestov/fix-rdar129255769
AST: Fix request cycle with local lazy properties
2024-06-06 07:48:44 -04:00
swift-ci
8e1f8e5668 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-05 21:14:30 -07:00
Joe Groff
efc193ffa3 Merge pull request #74154 from jckarter/treat-reinit-attempts-in-multi-block-defers-as-errors
Turn mishandled reinitialize-in-`defer`-after-`consume` cases into errors.
2024-06-05 21:04:34 -07:00
Slava Pestov
dd7f1fdcfe AST: Fix request cycle with local lazy properties
This fixes a regression from https://github.com/apple/swift/pull/73482.

Fixes rdar://problem/129255769.
2024-06-05 23:28:16 -04:00
swift-ci
aed40bd421 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-05 19:34:38 -07:00
Artem Chikin
d2ed753d52 Merge pull request #73907 from artemcm/ExplicitAutoLinkScanner
[Dependency Scanning] Collect and report each module dependency's Link Libraries
2024-06-05 19:26:34 -07:00
Joe Groff
74aaf88697 Turn mishandled reinitialize-in-defer-after-consume cases into errors.
The handling of multi-basic-block control flow in `defer` blocks looks like it
was left incomplete and completely untested; I fixed a few obvious problems but
it still completely lacks any analysis of conditional reinitializations. For now,
change it to treat attempted reinitializations as uses-after-consumes so we raise
reliable errors now instead of emitting code that causes memory corruption at
runtime. Fixes rdar://129303198.
2024-06-05 14:12:00 -07:00
Meghana Gupta
470fa2f365 Remove resultDependsOn/resultDependsOnSelf 2024-06-05 11:36:16 -07:00
artemcm
d70863501e [Dependency Scanning] Collect and report each module dependency's Link Libraries 2024-06-05 10:59:41 -07:00
swift-ci
904eccdd21 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-05 08:36:31 -07:00
Anthony Latsis
f02d300de2 Merge pull request #72659 from AnthonyLatsis/many-any-bugs
TypeCheckType: Fix some bugs in the `any` syntax checker
2024-06-05 18:19:52 +03:00
swift-ci
de68d4dea5 Merge remote-tracking branch 'origin/main' into rebranch 2024-06-05 02:34:06 -07:00
Doug Gregor
62558b00b8 Treat 'var's with init accessors as mutable in initializers 2024-06-04 22:46:50 -07:00
Becca Royal-Gordon
b3e7a23e70 Fix @objc use in module interfaces for objcImpl
objcImpl extensions with final public members need to be printed into module interfaces, but with the @implementation attribute suppressed. That worked fine…but when we switched to the new syntax, we should also have suppressed the @objc attribute, and we mistakenly did not. Correct this oversight.

Fixes rdar://129178360.
2024-06-04 17:47:05 -07:00
Doug Gregor
6a8eabf676 Tweak "initializable values" logic slightly to address source incompatibilities
Back of slightly on when we treat a "let" instance property as immutable
within an initializer, to deal with two newly-introduced source
incompatibilities.

Fixes rdar://129253556.
2024-06-04 17:33:26 -07:00
Anthony Latsis
5a2316ce4b [NFC] AST: Define TypeRepr::isParenType() 2024-06-04 02:12:39 +03:00
swift-ci
563c233c0e Merge remote-tracking branch 'origin/main' into rebranch 2024-06-03 11:15:43 -07:00
Steven Wu
0aa0687fe0 Merge pull request #73853 from cachemeifyoucan/eng/PR-128067152
[ScanDependency][canImport] Improve canImport handling in explicit build
2024-06-03 11:07:02 -07:00