Commit Graph

1116 Commits

Author SHA1 Message Date
Pavel Yaskevich
233d279a5c [AST] Support @preconcurrency attribute on test/extension inheritance entries 2024-01-16 10:30:58 -08:00
Allan Shortlidge
ba1f50fddb [c-interop] Make Extern a suppressible language feature.
Fixes building the standard library's .swiftinterface with older Swift
compilers.
2024-01-11 13:54:24 -08:00
Kavon Farvardin
64d43f9638 [NCGenerics] handle ReferenceStorageType queries 2024-01-10 19:37:21 -08:00
Kavon Farvardin
a2defd5367 [NCGenerics] fix AnyObject and inverses
resolves rdar://120512544
2024-01-10 19:37:21 -08:00
Kavon Farvardin
af7ff43d0d [NCGenerics] printing class-constrained generics
In cases where the generic parameter is class-constrained,
`GenericSignature::requiresProtocol` will not contain `Copyable` or
`Escapable` because GenericSignature minimization will recognize that
the class already requires them.

Thus, because classes always require those protocols, we can
simply ask if the generic parameter is required to be a class to
determine if it had any inverses.
2024-01-10 19:37:21 -08:00
Kavon Farvardin
b6b27eb3b5 [NCGenerics] add coverage for any Error 2024-01-10 19:37:21 -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
Alexis Laferrière
39aa516f0d Merge pull request #70701 from xymus/no-verify-test
ModuleInterface: enable test for the no-verify flag in swiftinterfaces
2024-01-04 15:00:10 -08:00
Alexis Laferrière
e32c05da9e Merge pull request #70700 from xymus/fix-submodule-import-warnings
Sema: Don't report public imports of submodules as being unused in API
2024-01-04 14:59:55 -08:00
Allan Shortlidge
548df6917a Merge pull request #70718 from tshortli/module-interface-test-submodule-types
ModuleInterface: Test printing of qualified types from submodules
2024-01-04 14:00:39 -08:00
Alexis Laferrière
ab769e57c5 [Tests] Update test showing a superfluous warning that was just fixed 2024-01-04 10:47:06 -08:00
Allan Shortlidge
3087454b05 ModuleInterface: Test printing of qualified types from submodules. 2024-01-04 10:39:39 -08:00
Doug Gregor
b7fd43949a Remove the TypedThrows experimental feature from the remaining tests 2024-01-03 22:08:56 -08:00
Allan Shortlidge
6c1fe8137a Sema: Allow some references to declarations that are unavailable-in-Swift.
Swift generates implicit constructors for inherited designated initializers in
case some implicit initialization (such as running property initializer
expressions) needs to run after calling the initializer on the superclass.
These implicit initializers are printed in .swiftinterfaces and previously they
could cause the interface to fail to typecheck when one of the parameters is
declared to be unavailable-in-Swift. These initializers need to be generated
because they may be called from Objective-C where the unavailable-in-Swift
designation is irrelevant. To account for this possibility, relax availability
checking to allow this narrow exception only in .swiftinterfaces.

Another possible but more complicated solution would be to print the
initializers with an attribute that indicates that the initializer is inherited
and implicit. This would allow the typechecking exception to be more precise
but seems unnecessarily complicated given that the exception is only needed in
.swiftinterfaces, which are already compiler generated.

Resolves rdar://77221357
2024-01-03 19:36:16 -08:00
Alexis Laferrière
71fcd82685 ModuleInterface: enable test for the no-verify flag in swiftinterfaces 2024-01-03 15:33:33 -08:00
Alexis Laferrière
e431716e93 Merge pull request #70678 from xymus/write-no-verify
ModuleInterface: write down the -no-verify-emitted-module-interface flag in swiftinterfaces
2024-01-03 09:08:56 -08:00
Alexis Laferrière
1533894fed ModuleInterface: write down the -no-verify flag in the swiftinterface
The flag -no-verify-emitted-module-interface tells the driver to skip
verifying the swiftinterfaces emitted by the compiler. It used to be
passed only to the driver.

Let's pass it down to the frontend as well and write it in the
swiftinterfaces. This will help understand them from the reader side.
2024-01-02 16:40:19 -08:00
Allan Shortlidge
61111ed4fe AST: Fix macCatalyst availability for synthesized declarations.
The macCatalyst platform availability of a declaration may be inferred from the
iOS platform availability of that declaration in the absence of an explicit
macCatalyst availability attribute. This means that when inheriting macCatalyst
platform availability, the explict iOS availability of an inner ancestor should
take precedence over explicit macCatalyst availability of an outer ancestor.
The algorithm that computes inferred availability attributes for synthesized
declarations was treating macCatalyst and iOS as independent platforms, though,
sometimes yielding inapproparite macCatalyst availability.

Resolves rdar://107766644
2023-12-18 23:49:26 -08:00
Andrew Trick
979334e723 Merge pull request #70459 from atrick/rename-nonescapable
Rename NonesapableTypes feature
2023-12-14 16:00:46 -08:00
Andrew Trick
ace9937e95 Rename NonesapableTypes feature
Follow the feature flag convention for capitalization and be
consistent with the related NoncopyableGenerics feature.

This is a new feature that no wild Swift code has used it yet:

commit e99ce1cc5d
Author: Kavon Farvardin <kfarvardin@apple.com>
Date:   Tue Dec 5 23:25:09 2023

    [NCGenerics] add `~Escapable`

    Basic implementation of `~Escapable` in the type system.
2023-12-14 11:32:03 -08:00
Kavon Farvardin
040e95cd7d [NCGenerics] extra coverage for interface emission 2023-12-14 08:45:27 -08:00
Kavon Farvardin
5988608c89 Merge pull request #70180 from kavon/noncopyable-serialization
[NCGenerics] Serialization for noncopyable generic types.
2023-12-13 00:36:53 -08:00
Konrad `ktoso` Malawski
55c932c568 [Distributed] Bring back module interface test for DA (#70199) 2023-12-13 10:53:42 +09:00
Kavon Farvardin
bd1330715c [NCGenerics] only print ~Copyable in interface
We can't simply emit the desugared, expanded version of the requirements
because there's no way to pretty-print the type `some ~Copyable` when
the `~Copyable`'s get replaced with the absence of `Copyable`. We'd be
left with just `some _` or need to invent a new top type so we can write
`some Top`. Thus, it's best to simply reverse the expansion of default
requirements when emitting a swiftinterface file.
2023-12-12 16:40:26 -08:00
Kavon Farvardin
ffc06f9d31 [NCGenerics] add tests for modules/interface files 2023-12-12 16:40:26 -08:00
Ian Anderson
35eb5cb7f4 Merge pull request #69707 from ian-twilightcoder/builtin-flag
[ClangImporter] Swift needs to pass `-Xclang -fbuiltin-headers-in-system-modules` for its module maps that group cstd headers
2023-12-12 11:35:17 -08:00
Allan Shortlidge
2730c19891 Macros: Stop explicitly enabling accepted ExtensionMacros feature in tests.
NFC.
2023-12-10 10:10:15 -08:00
Ian Anderson
94e860e795 [ClangImporter] Swift needs to pass -Xclang -fbuiltin-headers-in-system-modules for its module maps that group cstd headers
Swift has some module maps it overlays on Linux and Windows that groups all of the C standard library headers into a single module. This doesn’t allow clang and C++ headers to layer properly with the OS/SDK modules. clang will set -fbuiltin-headers-in-system-modules as necessary for Apple SDKs, but Swift will need to pass that flag itself when required by its module maps.
2023-12-08 22:33:12 -08:00
Ellie Shin
3f71ebb5a6 Update Driver to generate package interface only if package-name is passed
Resolves rdar://119275771
2023-12-06 14:27:33 -08:00
Becca Royal-Gordon
1e6cafb9e7 Fix ModuleInterface/noncopyable_generics.swift
Experimental features are disabled in no-asserts compilers.
2023-12-02 10:01:48 -08:00
Kavon Farvardin
81ea9981c8 Merge pull request #69842 from kavon/ncgenerics-stdlib-building
[NCGenerics] more work towards getting the stdlib building
2023-11-29 17:31:45 -08:00
Allan Shortlidge
5e5578aa0b Frontend: Ignore -experimental-lazy-typecheck when verifying module interfaces. 2023-11-29 10:51:24 -08:00
Meghana Gupta
b3617a4ba1 Update -enable-ossa-modules to be a module interface ignoreable option
This lets the flag be emitted in the swiftinterface file of the stdlib
(or other modules with -enable-ossa-modules specified),
so that whenever stdlib is recompiled, -enable-ossa-modules will be on.
2023-11-28 13:16:32 -08:00
Kavon Farvardin
eff3255fbf [NCGenerics] add coverage for rdar://118697289 2023-11-24 14:59:56 -07:00
Ellie Shin
38cb4ae2d5 Temporarily disable test due to ASAN bot failure on CI
Ref: rdar://118461385
2023-11-15 09:46:56 -08:00
Ellie Shin
e8d43434db Merge pull request #69733 from apple/es-pkg-intf
Introduce a package interface
2023-11-15 03:53:49 -08:00
Ellie Shin
82eef756ee Guard with env var SWIFT_ENABLE_PACKAGE_INTERFACE_LOAD
Update tests and formatting
2023-11-15 01:16:23 -08:00
Ellie Shin
0f3625bf54 Remove @objc CHECK as it only applies to Darwin 2023-11-14 10:59:44 -08:00
Kavon Farvardin
63b3054a1e [NoncopyableGenerics] fix parallel assignments 2023-11-13 13:29:41 -08:00
Kavon Farvardin
d432b8eb46 [Noncopyable] fix subscripts 2023-11-13 13:29:41 -08:00
Ellie Shin
e5ca8e5c0b Allow loading package interface if in same package.
Add a new flag to enable package interface loading.
Use the last value of package-name in case of dupes.
Rename PrintInterfaceContentMode as InterfaceMode.
Update diagnostics.
Test package interface loading with various scenarios.
Test duplicate package-name.
2023-11-09 18:44:06 -08:00
Ellie Shin
aba3b6c24e Introduce a package interface.
It has an extension .package.swiftinterface and contains package decls
as well as SPIs and public/inlinable decls. When a module is loaded
from interface, it now looks up the package-name in the interface
and checks if the importer is in the same package. If so, it uses
that package interface found to load the module. If not, uses the existing
logic to load modules.

Resolves rdar://104617854
2023-11-08 14:56:20 -08:00
Yuta Saito
79b3d2d626 Add underscore prefix to extern attribute
It's already guarded by a feature flag, but it would be nice to signal
users that it's not stable yet by adding an underscore prefix.
2023-11-07 02:01:02 +00:00
Allan Shortlidge
844b46fae5 Merge pull request #69640 from tshortli/module-interface-lazy-typecheck-dynamic-attr
AST: Trigger IsDynamicRequest when retrieving semantic attributes
2023-11-03 14:41:01 -07:00
Zhiyu Zhu/朱智语
6b88070bbe Merge pull request #68782 from ApolloZhu/ApolloZhu/macro/diagnose-default-argument
[Macros] Disallow expression macro as default argument
2023-11-03 13:39:05 -07:00
Allan Shortlidge
c6e966157a AST: Trigger IsDynamicRequest when retrieving semantic attributes. 2023-11-03 09:37:24 -07:00
Allan Shortlidge
dea6dfd6dd AST: Expand @_transparent in SemanticDeclAttrsRequest.
Resolves rdar://117780430
2023-11-01 15:55:19 -07:00
Allan Shortlidge
30a3927385 ModuleInterface: Resolve types of CustomAttrs when printing.
When printing the CustomAttrs attached to a decl, those attrs may not have been
type checked yet if lazy typechecking is enabled. We need to make sure that
printing invokes a request that will resolve the type.

Resolves rdar://117443319
2023-10-31 16:48:04 -07:00
Ellie Shin
662e2cf054 Merge branch 'main' into es-pkg-in-public 2023-10-30 22:28:50 -07:00
Ellie Shin
2f9c605238 Update test 2023-10-30 17:54:19 -07:00