Commit Graph

1088 Commits

Author SHA1 Message Date
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
Allan Shortlidge
1f48c59ff3 NFC: Use forbidden typechecking prefix in lazy typechecking tests.
Enhance the -experimental-lazy-typecheck suite of tests by adopting
-debug-forbid-typecheck-prefix instead of including broken code in the source
file that would cause diagnostics to be emitted if the compiler typechecks too
much during lazy typechecking. The content of .tbds and .swiftinterfaces
emitted with and without lazy typechecking enabled can now be compared since
the source compiles regardless of mode. This new test regime is less tedious to
maintain and should catch regressions more reliably since it doesn't
require new CHECK lines to be added to several tests every time a new
test case is added in the shared input file.
2023-10-30 14:50:42 -07:00
Xi Ge
09d6944497 ModuleInterface: allow blocklist to configure module names from SDKs that we use textual interfaces exclusively 2023-10-28 14:38:11 -07:00
Apollo Zhu
35d5b68722 Disallow expression macro as default argument
Using as a sub expression in default argument still allowed as expression macros behave the same as built-in magic literals
2023-10-27 05:40:57 -07:00
Allan Shortlidge
33edb6642d Serialization: Resolve type of CustomAttr before serializing.
This fixing a crash during serialization when lazy typechecking is enabled.

Resolves rdar://117442955
2023-10-26 22:46:58 -07:00
Harlan Haskins
4a2eefe2fa Strip comments from inlinable text when printing in swiftinterface files (#69358)
* Strip comments from inlinable text

* Simplify implementation, and avoid trimming trailing whitespace after the comment.

* Update test

* Feedback and handle more cases (with added tests)

* Handle #sourceLocation

* Fix #sourceLocation and fix FileCheck tests
2023-10-25 14:57:22 -06:00
Yuta Saito
43eed0cb8f Merge pull request #69350 from kateinoigakukun/pr-cff728253211b9f0b6cac62756def36ae238e93d
[c-interop] Fix @extern attribute printing for module interface
2023-10-23 21:32:15 -07:00
Yuta Saito
37c71ed7f2 [c-interop] Fix @extern attribute printing for module interface
The new `@extern(c)` was printed without r-paren in swiftinterface.
2023-10-24 01:33:32 +00:00
Rintaro Ishizaki
55144fb302 [Macros] Add test for macro expansion printing
* Macro expanded member decls in .swiftinterface (rdar://117374821)
* cursor-info on a decl with peer macro attribute (rdar://117374966)
2023-10-23 15:21:33 -07:00
Harlan Haskins
4ac34a40ea @retroactive conformance syntax and checking (#36068) 2023-10-20 14:27:03 -07:00
Joe Groff
7dbab5e929 Enable MoveOnlyResilientTypes feature. 2023-10-19 11:46:08 -07:00
Alexis Laferrière
64cd96e629 Merge pull request #69210 from xymus/export-as-module-interface-by-default
ModuleInterface: Always ignore export-as for printing references in private swiftinterfaces
2023-10-17 16:41:37 -07:00
Alexis Laferrière
471b228c1e [ModuleInterface] Test that ModuleInterfaceExportAs doesn't raise errors
Passing the flags `-enable-experimental-feature ModuleInterfaceExportAs`
has no effect anymore, test that it's not reported as an error.
2023-10-16 22:05:26 -07:00
Alexis Laferrière
6f1a774e7d [ModuleInterface] Always ignore export-as in private swiftinterfaces
Always print the real module name for references in private
swiftinterfaces, ignoring export-as declarations. Keep using the
export-as name for the public swiftinterface only.

The flag `ModuleInterfaceExportAs` used to enable this behavior and
we're removing it to make it the default.

rdar://115922907
2023-10-16 13:19:55 -07:00
Alexis Laferrière
b9a7034b2f [Tests] Update swiftinterface imports Swift 6 test
Update the test for imports defaulting to internal by adding the
explicit `public` modifier on all imports and the expected warnings.
Modernized a test somehow as it can't use previously shared files.

This revealed an issue with the warning about superfluous imports on
imports of submodules. I've marked one of them as a FIXME as it will
require a fix in the diagnostic.
2023-10-11 17:18:03 -07:00
Alexis Laferrière
8b098ab487 [Tests] Remove the flag AccessLevelOnImport from all tests but one 2023-10-10 09:09:22 -07:00
Alexis Laferrière
322ada60c8 [Sema] Intro flag to default imports to internal, the Swift 6 mode
The feature InternalImportsByDefault makes imports default to internal instead
of public. Applying the Swift 6 behavior of SE-0409 in Swift 5.

Let's use only that flag to track the Swift 6 behavior as well instead
of separately checking for the language version.
2023-10-10 09:09:21 -07:00
Joe Groff
b4f536927a Disable destructuring initializations in struct let stored properties.
This looks like it was never properly implemented, since when we generate the
memberwise initializer for the struct in SILGen, it incorrectly tries to apply
the entire initializer expression to each variable binding in the pattern,
rather than destructuring the result and pattern-matching it to the variables.
Since it never worked it doesn't look like anyone is using this, so let's
put up an error saying it's unsupported until we can implement it properly.
Add `StructLetDestructuring` as an experimental feature flag so that tests around
the feature for things like module interface printing can still work.
2023-10-03 13:24:39 -07:00
Artem Chikin
08533c94ec Always disable requiring Foundation for '@objc' when building/typechecking interfaces 2023-10-02 10:42:00 -07:00
Doug Gregor
51eed19d4b [Typed throws] Type system support for typed throws.
Add the thrown type into the AST representation of function types,
mapping from function type representations and declarations into the
appropriate thrown type. Add tests for serialization, printing, and
basic equivalence of function types that have thrown errors.
2023-09-29 10:51:53 -07:00
swift-ci
ce36ccd794 Merge pull request #68677 from artemcm/FixImportProcessOrderForScan
[Dependency Scanning] Process implicit imports of the source module first, emulating implicit builds
2023-09-22 12:32:49 -07:00
Artem Chikin
c9c689aec1 [Dependency Scanning] Process implicit imports of the source module first, emulating implicit builds
In case import resolution order somehow sometimes matters, it's prudent to process/resolve/locate implicitly-imported modules first.

Resolves rdar://113917657
2023-09-22 09:40:03 -07:00
Kavon Farvardin
a69bcf8a61 Merge pull request #67930 from kavon/copyable-requirement
Copyable as a Requirement Against the Machine
2023-09-21 11:49:23 -07:00
Kavon Farvardin
cc7a41fc2c [stdilb] introduce Copyable protocol
This replaces the old, unavailable `_Copyable`.

rdar://110420673
2023-09-21 00:55:17 -07:00
swift-ci
8b97d43de6 Merge pull request #68598 from artemcm/ExplicitInterfaceTypecheckFix
[Explicit Modules] Fix detection of a type-checking action in `ExplicitModuleInterfaceBuilder`
2023-09-19 14:52:27 -07:00
Artem Chikin
373d49134a [Explicit Modules] Fix detection of a type-checking action in 'ExplicitModuleInterfaceBuilder'
When we run an interface verification tasks with Explicit module builds, we directly invoke a '-explicit-interface-module-build' instance with a '-typecheck-module-from-interface' action. So the builder needs to recognize this as a typechecking invocation. In implicit builds, this gets lowered into a separate compiler sub-instance with a '-typecheck' action, for some reason.

resolves rdar://115565571
2023-09-19 10:38:42 -07:00
Alexis Laferrière
a24d377b68 Merge pull request #68591 from xymus/print-public-fix
[ModuleInterface] Extract the test of the Swift 6 variant from imports.swift
2023-09-19 08:20:34 -07:00
Alexis Laferrière
eaf74b280b [ModuleInterface] Extract the Swift 6 variant from imports.swift
This allows us to limit the test to asserts compiler supporting
-swift-version 6.

rdar://115578753
2023-09-18 10:54:35 -07:00
Allan Shortlidge
497034ef64 AST: Requestify generic signature building for @_specialized attributes.
In order to support lazy typechecking during module emission for modules
containing specialized functions, the computation of generic signatures for
`@_specialized` attributes must be requestified.

Resolves rdar://115569606
2023-09-16 00:02:33 -07:00