Commit Graph

1116 Commits

Author SHA1 Message Date
Allan Shortlidge
670f395b90 Frontend: Enable $GlobalActors feature by default.
Global actors have been an accepted language feature for a couple of compiler releases now, but the feature definition was associated with the `--enable-experimental-concurrency` flag. This caused some `.swiftinterface`s containing global actor declarations to be unparsable because the logic for surrounding declarations with the `$GlobalActors` feature guard was incomplete (for example, classes with a global actor attribute were not guarded even though the declarations of global actor types were).

Rather than trying to fix the logic of `usesFeatureGlobalActors()`, enable it by default.

Adds a test that demonstrates that modules defining and using public global actors produce module interfaces that can be parsed successfully.

Resolves rdar://100150703
2022-10-03 14:49:11 -07:00
Allan Shortlidge
863b088696 NFC: Move global-actor.swift test case to SILGen directory. 2022-10-03 14:15:27 -07:00
Anthony Latsis
f547826276 Merge pull request #60894 from AnthonyLatsis/migrate-test-suite-to-gh-issues-16
Gardening: Migrate test suite to GH issues p. 16
2022-09-08 12:45:17 +03:00
Allan Shortlidge
145609248c ModuleInterface: Avoid attempting to print protocols inherited from superclasses.
"Extra" protocols from a superclass are already handled when printing the superclass, so we should not accumulate them when recording protocols for a subclass.

Resolves rdar://98523784
2022-08-31 23:55:29 -07:00
Anthony Latsis
6da51d2b2f Gardening: Migrate test suite to GH issues: ModuleInterface 2022-09-01 06:41:44 +03:00
Artem Chikin
256c0ff04a [Explicit Modules] On an explicit interface build, early exit if the expected output is up-to-date. 2022-08-16 18:31:13 -07:00
Artem Chikin
aee45799b8 Invoke Explicit Interface Build when '-explicit-interface-module-build' is specified on a '-compile-module-from-interface' frontend action, using the CompilerInstance instantiated directly from the command-line in order to build the module. 2022-08-16 08:36:58 -07:00
Allan Shortlidge
fb411c85d9 NFC: Add tests verifying that @_weakLinked import is not transitive. 2022-08-11 11:02:57 -07:00
Artem Chikin
4e2c1d16f6 Add '@_alwaysEmitConformanceMetadata' protocol attribute
This attribute will, in the near future, be used to inform IRGen that a nominal type that conforms to such protocol must have its type metadata always emitted into the binary, regardless of whether it is used/public.
2022-08-04 14:19:33 -07:00
Artem Chikin
7bdec998b1 Add flag that allows ignoring compiler flags specified in an interface file when running a '-compile-module-from-interface' frontend action. 2022-08-02 10:54:52 -07:00
Allan Shortlidge
1b9d53941d Sema: Diagnose when typealiases used in public declarations would desugar to types from non-public imports.
Resolves rdar://91447971
2022-07-31 11:59:02 -07:00
Allan Shortlidge
1a7b23cd98 Disable availability checking in cross-module-typealias.swift to avoid errors about using some types when they might be unavailable. 2022-07-21 13:43:49 -07:00
Allan Shortlidge
7655b48d0a NFC: Test printing swiftinterfaces that include declarations that were written using typealiases from another module.
This test establishes a baseline for the behavior of swiftinterface emission when public declarations of all kinds reference typealiases from another module. It seems that for many types of declarations, the printer is looking through the typealias definition and printing the original type instead of a fully qualified reference to the typealias. This behavior can cause swiftinterfaces to be unparsable since the original type may not be declared in the module declaring the typealias.

Every CHECK line in this test that includes a reference to fully qualified type from the `Original` module represents an instance of this bug.

Once this behavior is corrected, it should be possible to succesfully parse `UsesAliases.swiftinterface` and the `RUN:` line for doing so should be uncommented.
2022-07-21 11:30:46 -07:00
Xi Ge
cfb5fcda0f ModuleInterface: avoid remarking missing prebuilt module for stdlib by default
Prebuilt modules are only available for certain toolchain and SDK combinations. Therefore,
building modules from interface, even for the stdlib, is expected to happen.

related: rdar://96701615
2022-07-14 15:04:27 -07:00
Doug Gregor
77757c4a4c Merge pull request #59941 from DougGregor/nonsendable-available-nested 2022-07-07 07:30:26 -07:00
Doug Gregor
8ff7e0b3ab Look to enclosing declarations for @available attributes on @_nonSendable types
`@_nonSendable` types get a synthesized, unavailable extension that
declares the Sendable conformance. This extension also needs to have
appropriate platform availability for the type that is being marked
non-Sendable, so the platform-specific attributes are copied from the
nominal type declaration. However, for nested types, we might need to
copy those attributes from an enclosing declarations. Do so when
appropriate.

Fixes rdar://90330588.
2022-07-06 22:16:16 -07:00
Holly Borla
609733bb88 [SE-0361] Update tests for bound generic extensions. 2022-06-30 17:25:17 -07:00
Richard Wei
94e8f5393e Enable string processing by default.
Make frontend flag `-enable-experimental-string-processing` default to true.
2022-06-12 20:25:16 -07:00
Slava Pestov
beec309c9d AST: Fix debug info mangling of opaque result types with @_originallyDefinedIn
If a function's parameter or return types involve nominal types that
have been moved across modules using @_originallyDefinedIn, we must
take care to always mangle the opaque result type's name using the
original module names and not the current module names.

This was a problem with DWARF mangling, which normally disables
@_originallyDefinedIn for other purposes. Make sure to always
temporarily re-enable it when mangling an opaque result type.

Fixes rdar://problem/93822207.
2022-06-02 18:15:31 -04:00
Allan Shortlidge
7b1d4df8bc ModuleInterface: Fix decl attribute corruption in private swiftinterfaces
Erroneous declaration attributes were sometimes being printed in the private swiftinterfaces of modules because the changes from https://github.com/apple/swift/pull/42276 were effectively corrupting the attribute list for any decl with sythesized conformances (e.g. `Equatable`, `Hashable`). It is necessary to clone the attributes before adding them to the synthesized conformance extension decls.

Resolves rdar://94009296
2022-05-31 08:24:49 -07:00
Allan Shortlidge
5326cb031f Tests: Adjust the swift-module-flags of the SilencePreconcurrency.swiftinterface test case to avoid over-specifying a target with a specific arch. This test currently fails when the locally built compiler lacks x86_64 support. 2022-05-27 10:43:55 -07:00
Ben Barham
efc9469444 Merge pull request #58975 from bnbarham/make-features-consistent
[Tests] Make OS features consistent
2022-05-25 16:02:43 -07:00
Holly Borla
e9c14cd88b [ASTPrinter] Print the desugared constraint type following the 'any'
keyword.
2022-05-23 19:43:51 -07:00
Ben Barham
c163e0fe5e [Tests] Make OS features consistent
lit.py currently allows any substring of `target_triple` to be used as a
feature in REQUIRES/UNSUPPORTED/XFAIL. This results in various forms of
the OS spread across the tests and is also somewhat confusing since they
aren't actually listed in the available features.

Modify all OS-related features to use the `OS=` version that Swift adds
instead. We can later remove `config.target_triple` so that these don't
the non-OS versions don't work in the first place.
2022-05-20 19:51:23 -07:00
Allan Shortlidge
7c9a626171 Merge pull request #58801 from tshortli/accept-existential-without-any-in-swiftinterfaces 2022-05-11 00:24:46 -07:00
Arnold Schwaighofer
e3b715bc2a Merge pull request #58760 from aschwaighofer/swiftinterface_print_specialize_with_targetFunction
swiftinterface: print _specialize functions with targetFunction parameter in .swiftinterface
2022-05-10 19:45:30 -07:00
Allan Shortlidge
60146b32b4 Sema: Accept existentials without any in swiftinterfaces.
Resolves rdar://93052306
2022-05-10 17:43:05 -07:00
Slava Pestov
dac8d666ee Stop passing -requirement-machine-{abstract,inferred,protocol}-signatures flags in tests
These flags are now no-ops.
2022-05-10 12:56:17 -04:00
Allan Shortlidge
e0e748c35a ModuleInterface: Print existential any in swiftinterfaces since any is required for protocols with associated types in 5.7.
Resolves rdar://92976269
2022-05-09 14:10:07 -07:00
Arnold Schwaighofer
7bfa01a817 swiftinterface: print _specialize functions with targetFunction parameter in .swiftinterface
If we have an internal function with a `_specialize` attribute that has
a `targetFunction:` parameter we want the function to appear in the
.swiftinterface file such that the exported specialization can be picked up by
the compiler.
2022-05-09 10:08:52 -07:00
Josh Soref
760343f478 Spelling test moduleinterface (#58579)
* spelling: because

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: flaky

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: the

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-05-05 16:58:25 -07:00
Alexis Laferrière
c93a4a466b Merge pull request #42486 from xymus/ignore-adjacent-public-swiftmodule
[ModuleInterface] Ignore adjacent swiftmodules under the Frameworks folder
2022-04-25 09:17:42 -07:00
Alexis Laferrière
3aebf2850d [ModuleInterface] Ignore adjacent swiftmodules from the Frameworks folder
Always use the swiftinterfaces of modules under the public Frameworks
folder in the SDK. Distributed swiftmodules are unreliable, they should
only be used as a local cache. Let's avoid them when possible.

rdar://92037292
2022-04-20 10:44:21 -07:00
Allan Shortlidge
a074d1e938 NFC: Add a test that exercises subclassing an Obj-C subclass of NSObject and verifies the printed members of the Swift subclass when emitting a module interface for a module containing the Swift subclass. Also verifies that NS_SWIFT_UNAVAILABLE initializers are omitted from the emitted interface. 2022-04-19 21:32:33 -07:00
Allan Shortlidge
826cc9d0c1 Sema: Avoid requiring properties to have initializers in @requires_stored_property_inits classes when type checking module interfaces. Most initializers are not printed in interfaces so enforcing this requirement in that context doesn't make sense.
Resolves rdar://91505142
2022-04-18 09:12:35 -07:00
Allan Shortlidge
1a600f4a79 Merge pull request #42351 from tshortli/adopt-interface-verification-in-more-tests
ModuleInterface: Enable interface verification in more tests
2022-04-18 09:12:03 -07:00
Allan Shortlidge
747f286b8d ModuleInterface: Adopt new swiftinterface verification lit substitutions pervasively in tests where they can be adopted by simply updating or adding a few RUN: lines. 2022-04-15 20:13:00 -07:00
Allan Shortlidge
922af42afd ModuleInterface: Adopt swiftinterface verification lit substitutions in synthesized.swift. Update the test to expect output for a resilient framework by removing @inlinable attributes from a few decls. 2022-04-15 20:12:59 -07:00
Allan Shortlidge
fa94c20abb ModuleInterface: Adopt swiftinterface verification lit substitutions in preserve-type-repr.swift. The test was originally written assuming that CHECK: lines are always matched by FileCheck even when alternate prefixes are specified via --check-prefix, so it contained some incorrect expectations that needed to be updated. 2022-04-15 20:12:59 -07:00
Allan Shortlidge
f40f0b029b ModuleInterface: Adopt swiftinterface verification lit substitutions in access-filter.swift. Fix an error caused by conforming to a @usableFromInline protocol using a non-UFI member (this was diagnosed as a warning in Swift 4 and became an error in Swift 5). Also, remove @_hasInitialValue from the expted swiftinterface contents since that attribute isn't emitted for types in resilient modules. 2022-04-15 20:12:59 -07:00
Allan Shortlidge
e10ebcab08 ModuleInterface: Adopt swiftinterface verification lit substitutions in emit-interface-macos-canonical-version.swift. Move the test to the ModuleInterface directory to colocate it with other swiftinterface generation tests and rename it to availability-macos-canonical-version.swift. Remove an extraneous -experimental-skip-non-inlinable-function-bodies flag that seemed like it was copypasta. 2022-04-15 20:12:59 -07:00
Allan Shortlidge
aeafcf8b0f ModuleInterface: Adopt swiftinterface verification lit substitutions in available-attr-no-collapse.swift. Also, put the input file contents directly in the test file instead of RUN: echo lines to make the test a bit easier to understand. 2022-04-15 20:12:59 -07:00
Allan Shortlidge
ab9bff389b ModuleInterface: Adopt swiftinterface verification lit substitutions in escape-Type-and-Protocol.swift. Update the test to no longer expect @_hasInitialValue to be emitted since that attribute is intentionally dropped from interfaces when -enable-library-evolution is specified. 2022-04-15 20:12:59 -07:00
Allan Shortlidge
bdd08ac654 ModuleInterface: Adopt swiftinterface verification lit substitutions in inherited-generic-parameters.swift. This revealed that function decls without explicit parameter names can be printed into swiftinterfaces with duplicate synthesized names so update the test to avoid that bug. 2022-04-15 20:12:59 -07:00
Allan Shortlidge
83ed2dc5d1 ModuleInterface: Adopt swiftinterface verification lit substitutions in skip-override-keyword.swift and skip-override-spi.swift. Add CHECK lines to these tests to make their expectations a bit more explicit. 2022-04-15 20:12:59 -07:00
Allan Shortlidge
454689a399 ModuleInterface: Adopt swiftinterface verification lit substitutions in back-deploy-attr.swift. Simplify the test now that another test exercises deserialization of the attribute from a module. 2022-04-15 15:50:59 -07:00
Doug Gregor
9de1a79511 Merge pull request #42362 from DougGregor/preconcurrency-silence-swiftinterface 2022-04-14 21:14:00 -07:00
Doug Gregor
aad67a828b Only run this new test on macOS 2022-04-14 17:25:48 -07:00
Allan Shortlidge
d3dbe75419 ModuleInterface: Introduce the %target-swift-emit-module-interface and %target-swift-typecheck-module-from-interface lit substitutions and adopt them in some tests that involve emitting a swiftinterface. The substitutions specify the additional flags -swift-version 5 -enable-library-evolution. There are a few motivations for adding these substitutions:
- Tests that depend on emitted interfaces should generally use flags that are typical for modules that have textual interfaces (e.g. `-enable-library-evolution`).
- If a test is intended to produce a valid `swiftinterface` then it should verify that interface. This will help prevent interface printing regressions caused by compiler changes.
- Having commonly used substitutions for tests that emit interfaces makes it easy to experiment with compiler flags that might effect interface printing.

Resolves rdar://91634358
2022-04-14 15:09:36 -07:00
Allan Shortlidge
cc0627a8cb Merge pull request #42276 from tshortli/global-actor-broken-swift-interface
ModuleInterface: Wrap synthesized extensions in swiftinterfaces with feature guards
2022-04-14 15:08:11 -07:00