Commit Graph

3290 Commits

Author SHA1 Message Date
Slava Pestov
aa81ce3f6c AST: Use new form of getOpenedExistentialSignature() in getMinimalCanonicalType() 2024-09-01 18:03:47 -04:00
Doug Gregor
a73711ef4b Implement extractInlinableText with swift-syntax
Replace the existing C++ implementation of extractInlinableText with
a new implementation based on swift-syntax. It uses SwiftIfConfig to
remove inactive regions (with a special mode), and a new compiler-only
entrypoint in the library to remove comments and `#sourceLocation`.
2024-08-30 16:43:41 -07:00
Mykola Pokhylets
e0ad7bde82 Merge branch 'main' into mpokhylets/isolated-deinit
# Conflicts:
#	include/swift/Basic/Features.def
#	lib/AST/ASTPrinter.cpp
#	lib/AST/FeatureSet.cpp
2024-08-29 11:28:43 +02:00
Hamish Knight
1cb0f8fdd5 [AST] Rename isPrivateStdlibDecl -> isPrivateSystemDecl
This better reflects what we're actually checking
here.
2024-08-28 18:31:51 +01:00
Hamish Knight
05954eaa90 [AST] Account for non-user modules in isPrivateStdlibDecl
Consider both non-user and system modules when
checking whether an underscored decl should be
considered private.

rdar://131854240
2024-08-28 18:31:51 +01:00
Konrad `ktoso` Malawski
1861375f88 [Concurrency] Suggest adding a method, when mutating actor property cross isolation (#75922) 2024-08-22 20:24:39 +09:00
Doug Gregor
cccf6c1114 Introduce @unsafe and the ability to prohibit use of unsafe declarations
Allow any declaration to be marked with `@unsafe`, meaning that it
involves unsafe code. This also extends to C declarations marked with
the `swift_attr("unsafe")` attribute.

Under a separate experimental flag (`DisallowUnsafe`), diagnose any
attempt to use an `@unsafe` declaration or any unsafe language feature
(such as `unowned(unsafe)`, `@unchecked Sendable`). This begins to
define a "safe" mode in Swift that prohibits memory-unsafe constructs.
2024-08-19 14:33:07 -07:00
Slava Pestov
0e853a358e Merge pull request #75935 from slavapestov/remove-transform
AST: Replace remaining uses of Type::transform() with transformRec()
2024-08-17 09:11:52 -04:00
iMostfa
80a8a0746b Replace uses of the word "accessor" in diagnostics with user-facing terminology (#74462)
In this PR i worked on replacing the word accessor in diagnostics with more user-facing terminologies like setter, getter, didSet Observer, and members based on the context of the message.

in some messages i didn't need to pass DescriptiveDeclKind instead i just changed the text copy itself.

i also updated tests, so you might find it easier to check my changes this way.

Please let me know if there's something i should've done in a better way, and request changes if needed. !

i can squash my commits after reviewing getting the PR Reviewed, just to make it easier to be checked commit by commit

Resolves #55887
2024-08-16 16:29:30 -07:00
Mykola Pokhylets
50b1313175 Merge branch 'main' into mpokhylets/isolated-deinit
# Conflicts:
#	lib/SILGen/SILGenDistributed.cpp
#	lib/Sema/TypeCheckConcurrency.cpp
2024-08-15 16:58:43 +02:00
Ellie Shin
93f9a17c33 Merge pull request #75872 from swiftlang/elsh/pkg-switch-enum 2024-08-15 05:48:09 -07:00
elsh
4f0f774856 Rename -> isInterfacePackageEffectivelyPublic 2024-08-14 01:35:24 -07:00
Ellie Shin
fadf6ec96c [Sema] Remove @unknown default requirement for package enums.
`@unknown default` in switch statements are required for resilient enums since they
might be modified with new fields in the future and modules defining the enums are
generally not built together with the consuming modules.

However, if the modules are in the same package, they are required to be built together,
thus the requirement for `@unknown default` can be skipped. This PR removes the need for
that, enabling less boilerplate. Note this change only impacts typecheck and not SIL gen.

Resolves rdar://130015149.
2024-08-13 17:06:51 -07:00
Ellie Shin
dc1c34dfa1 [Sema] Treat @usableFromInline package decls from interface as public and skip access checks
Resolves rdar://133319906
2024-08-13 17:01:19 -07:00
Slava Pestov
b601c294ac AST: Replace remaining uses of Type::transform() with transformRec() 2024-08-12 16:05:43 -04:00
Slava Pestov
375363a473 AST: Move global conformance lookup entry points to ConformanceLookup.h 2024-08-08 23:35:58 -04:00
Holly Borla
5fa35b5c3e [Concurrency] Compute the source of actor isolation in ActorIsolationRequest. 2024-08-04 18:48:57 -07:00
Allan Shortlidge
f7ff3f0001 SILGen: Introduce macCatalyst support for @backDeployed.
Upstreams the necessary changes to compile references to `@backDeployed`
declarations correctly when a `macabi` target triple or a `-target-variant` is
specified.
2024-07-23 17:00:10 -07:00
Ellie Shin
cb776089cb Merge pull request #75154 from swiftlang/elsh/drop-exp-prefix
Drop experimental prefixes from PackageCMO flags.
2024-07-11 12:12:29 -07:00
Mykola Pokhylets
816d62c972 Merge remote-tracking branch 'upstream/main' into mpokhylets/isolated-deinit
# Conflicts:
#	include/swift/Basic/Features.def
#	lib/SILGen/SILGenDestructor.cpp
#	test/Concurrency/flow_isolation.swift
#	test/abi/macOS/arm64/concurrency.swift
#	test/abi/macOS/x86_64/concurrency.swift
2024-07-11 13:11:59 +02:00
Mykola Pokhylets
2cb7e8d7b8 Implemented suppressing isolated deinit for compatibility with older compiler versions 2024-07-11 13:09:08 +02:00
Mykola Pokhylets
95079aff06 Don't generate isolating destructor if dealloc was explicitly isolated in ObjC 2024-07-11 13:09:06 +02:00
Mykola Pokhylets
10ee94885e Generating errors when isolation of the subclass deinit is not compatible with superclass deinit 2024-07-11 13:09:05 +02:00
Ellie Shin
18681c43fb Drop experimental prefixes from PackageCMO flags.
Deprecate experimental- flags with prompts to use the proper flags.

rdar://131498517
2024-07-10 16:19:16 -07:00
Meghana Gupta
154989463b Add support for lifetime dependence in parameter position 2024-07-10 14:20:03 -07:00
Meghana Gupta
8137aed238 Rename LifetimeDependentReturnTypeRepr -> LifetimeDependentTypeRepr 2024-07-10 14:20:03 -07:00
Slava Pestov
ec28d62d61 Convert AttachedPropertyWrappersRequest to use split caching 2024-07-06 23:36:00 -04:00
Slava Pestov
80ddc3275f Convert PropertyWrapperAuxiliaryVariablesRequest to use split caching 2024-07-06 23:35:59 -04:00
Slava Pestov
86d567f95a AST: ModuleDecl::lookupConformance() is a static method 2024-07-06 12:05:47 -04:00
Slava Pestov
3fcda140bb AST: ModuleDecl::checkConformance() is a static method 2024-07-06 12:05:46 -04:00
Michael Gottesman
34195ff213 Merge pull request #74610 from gottesmm/pr-324fd70c13e87a329334341aae4667f2d1be152c
[sending] Remove transferring.
2024-07-02 14:02:18 -07:00
Kavon Farvardin
4b98498bf2 Merge pull request #74672 from kavon/post-vacation-misc-cleanups
Handful of small NoncopyableGenerics fixes / cleanups.
2024-06-25 18:35:40 -07:00
Slava Pestov
17a6a80204 AST: Use separate caching for ProtocolDecl::getAllInheritedProtocols() 2024-06-25 15:20:42 -04:00
Kavon Farvardin
80c99973d7 NFC: introduce isAddingConformanceToInvertible
Removes duplicated code between Sema and the ASTPrinter.
2024-06-24 15:34:58 -07:00
Michael Gottesman
112071e57d [sending] Remove transferring.
Out of an abundance of caution, we:

1. Left in parsing support for transferring but internally made it rely on the
internals of sending.

2. Added a warning to tell people that transferring was going to
be removed very soon.

Now that we have given people some time, remove support for parsing
transferring.

rdar://130253724
2024-06-21 16:03:21 -07:00
Ellie Shin
4207dcea17 Merge pull request #74584 from apple/elsh/pcmo-missing-change
[PackageCMO] Add back missing change for package scope in table entry…
2024-06-20 16:15:33 -07:00
Ellie Shin
45cf9ac2c6 [PackageCMO] Add back missing change for package scope in table entry visibility check
rdar://130222362
2024-06-20 12:08:54 -07:00
Tim Kientzle
1098054291 Merge branch 'main' into tbkka-assertions2 2024-06-18 17:52:00 -07:00
Slava Pestov
8582828e7a Merge pull request #74445 from slavapestov/fix-failure-type-witness
Concurrency: Fix default type witness for AsyncSequence.Failure
2024-06-17 17:09:06 -04:00
Slava Pestov
b3a8ae814b AST: Clean up ExtensionDecl::isWrittenWithConstraints() 2024-06-14 19:47:47 -04:00
Ellie Shin
32a24f9264 Merge pull request #74416 from apple/elsh/pcmo-global
[PackageCMO] Global var and accessor linkage should be kept private/hidden in SILGen.
2024-06-14 12:21:01 -07:00
Ellie Shin
0a734c2a62 [PackageCMO] Global var and accessor linkage should be kept private/hidden in SILGen.
This PR contains changes that ensure the following:
* Global accessor linkage is kept hidden if its decl is resilient.
  - LinkageLimit::Never is returned for Global Accessor if its decl is resilient.
  - Since it's kept hidden, the use site should not expect a call to a global accessor
    if the static var decl being accessed is resilient. The bypassing resilience logic
    in AbstractStorageDecl::isResilient(accessingModule, decl) has been removed; to be
    addressed in Package CMO optimization pass.
* sil_global linkage is kept private if its decl is resilient.

Resolves rdar://129829925
2024-06-14 01:34:34 -07:00
Kavon Farvardin
e4ed330077 NFC: simplify test and add assertion
This is a follow-up to clean-up https://github.com/apple/swift/pull/74372
2024-06-13 11:58:21 -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
Xi Ge
6f5b40543d Revert "Handle package exportability."
This reverts commit d182d01c28.
2024-06-11 11:54:00 -07:00
Meghana Gupta
af1d6017f9 Merge pull request #74132 from meg-gupta/deleteresultdependson
Remove resultDependsOn/resultDependsOnSelf
2024-06-06 10:23:31 -07:00
Tim Kientzle
1d961ba22d Add #include "swift/Basic/Assertions.h" to a lot of source files
Although I don't plan to bring over new assertions wholesale
into the current qualification branch, it's entirely possible
that various minor changes in main will use the new assertions;
having this basic support in the release branch will simplify that.
(This is why I'm adding the includes as a separate pass from
rewriting the individual assertions)
2024-06-05 19:37:30 -07:00
Meghana Gupta
470fa2f365 Remove resultDependsOn/resultDependsOnSelf 2024-06-05 11:36:16 -07:00
Doug Gregor
62558b00b8 Treat 'var's with init accessors as mutable in initializers 2024-06-04 22:46:50 -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