Commit Graph

106 Commits

Author SHA1 Message Date
Kavon Farvardin
eff3255fbf [NCGenerics] add coverage for rdar://118697289 2023-11-24 14:59:56 -07: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
fushijian
4b7b598128 should inherit -strict-implicit-module-context when build sub swiftinterface 2023-06-29 12:50:56 +08:00
Tristan Labelle
d0ba4ced4b tests: Fix module loading prefer-serialized test failure on Windows
Fixes three tests failing on Windows:

```
  Swift(windows-x86_64) :: ModuleInterface/ModuleCache/force-module-loading-mode-archs.swift
  Swift(windows-x86_64) :: ModuleInterface/ModuleCache/force-module-loading-mode-framework.swift
  Swift(windows-x86_64) :: ModuleInterface/ModuleCache/force-module-loading-mode.swift
```

These test cases remove read access to the `.swiftmodule` . The expected
behavior is that the compiler checks `fs.exists("path-to.swiftmodule")`
, determines that the file exists and chooses to use it instead of the
`.swiftinterface`. Compilation then fails because the file cannot be
read.

e22cf2e993/lib/Frontend/ModuleInterfaceLoader.cpp (L752)

On Windows, we were denying `R` access, which is broader than only read
access to file contents but also includes file attributes and
permissions. This caused `fs.exists` to fail since it relies on
`fs.status`, which could not open the file with `CreateFileW`. The fix
is is to only deny `RD - read data/list directory` access.
2023-05-16 14:56:40 -07:00
Becca Royal-Gordon
04a27b822c Omit @objcImpl from module interfaces
Module interfaces should not include the @objcImplementation attribute, member implementations that are redundant with the ObjC header, or anything that would be invalid in an ordinary extension (e.g. overridden initializers, stored Swift-only properties).
2023-03-25 14:53:29 -07:00
Kavon Farvardin
410673c51f add a bunch of hopeful tests 2023-03-02 15:14:24 -08:00
Artem Chikin
d1cbf9c8d4 Inherit parent's extra Clang arguments when creating an interface build sub-invocation.
We would like to make sure they get propagated to downstream transitive Clang module dependencies also.

Resolves rdar://101923680
2022-11-08 09:32:30 -08:00
Artem Chikin
625048a43f Merge pull request #61545 from artemcm/PropagateApplicationExtensionStatus
Propagate '-application-extension' to module interface loader sub-invocations.
2022-10-13 08:51:23 -07:00
Artem Chikin
0c470f238b Propagate '-application-extension' to module interface loader sub-invocations.
This flag restricts availability of certain symbols to ensure the code cannot use declarations that are explicitly unavalable to extensions. This restriction should be passed down to dependency modules also.
2022-10-11 11:24:48 -07:00
Allan Shortlidge
863b088696 NFC: Move global-actor.swift test case to SILGen directory. 2022-10-03 14:15:27 -07:00
Allan Shortlidge
60146b32b4 Sema: Accept existentials without any in swiftinterfaces.
Resolves rdar://93052306
2022-05-10 17:43:05 -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
Doug Gregor
1b21f13654 Add missing test file 2022-02-11 19:18:47 -08:00
Allan Shortlidge
646a3a545f [Sema] Avoid computing raw values for enum cases in swiftinterface files
Raw values of enum cases from another module are not specified in the declaration of the enum unless that enum is `@objc`. This meant that `EnumRawValuesRequest` was computing potentially incorrect raw values when the enum declaration supported it and was emitting incorrect diagnostics for other enum decls.

Resolves SR-14355 and rdar://75451691
2022-01-26 13:43:00 -08:00
Slava Pestov
fa570fe072 ASTMangler: Respect @_originallyDefinedIn in mangleOpaqueTypeDecl()
mangleOpaqueTypeDecl() used to enable DWARFMangling, which
ignores @_originallyDefinedIn, which would in turn break module
interfaces.

Fixes rdar://problem/86480663.
2022-01-06 23:44:14 -05:00
Karoy Lorentey
e2cfab4f28 [stdlib][test] Adopt availability macros in tests 2021-10-31 15:00:58 -07:00
Karoy Lorentey
47956908b7 [Concurrency] SwiftStdlib 5.5 ⟹ SwiftStdlib 5.1 (usages)
The concurrency runtime now deploys back to macOS 10.15, iOS 13.0, watchOS 6.0, tvOS 13.0, which corresponds to the 5.1 release of the stdlib.

Adjust macro usages accordingly.
2021-10-28 14:36:36 -07:00
Becca Royal-Gordon
2240a39446 Add arm64 -> arm64e fallback
If we are building for ARM64 but we try to import a module with only an ARM64e interface, fall back to importing said interface.

This is the reverse of a similar fallback briefly introduced last year, but removed in #31196.
2021-09-07 12:00:02 -07:00
Becca Royal-Gordon
9358d7644a [NFC] Start separating DummyFramework
DummyFramework.framework has two different properties to support two different kinds of test cases: to support ModuleInterface/build-alternative-interface-framework.swift, its macOS interfaces are broken, but to support ModuleInterface/arm64e-fallback.swift, it supports only arm64, not arm64e, on iOS. The arm64e test's behavior is about to change, which will complicate all of this. As a preliminary step, make the two tests use two different frameworks so they aren't so intertwined.

This temporarily keeps the arm64e test using the name "DummyFramework", but that will change.
2021-08-27 14:50:56 -07:00
Luciano Almeida
1fc7f07d9b [tests] Make sure to build module interface test dummy library for arm64e 2021-07-28 20:14:07 -03:00
Luciano Almeida
eb70e0f418 [tests] Make sure to build module interface test dummy library for x86_64 2021-07-28 18:35:05 -03:00
Doug Gregor
eeeea49764 Remove -enable-experimental-concurrency almost everywhere. 2021-07-26 21:24:43 -07:00
John McCall
b182bbce6b Don't emit a bogus diagnostic when processing an old actor declaration.
This seems to only happen when parsing swiftinterfaces, but I've written
this to be more generally defensive.

rdar://78233377
2021-06-09 04:16:33 -04:00
Doug Gregor
03f55d7bb4 Revert "Revert "Remove @actorIndependent attribute.""
This reverts commit 7c0b50e8ea.
2021-06-03 14:03:57 -07:00
Karoy Lorentey
7c0b50e8ea Revert "Remove @actorIndependent attribute." 2021-05-24 14:43:32 -07:00
Becca Royal-Gordon
77117b03a0 Emit a remark when rebuilding the standard library interface
Although users should usually use a prebuilt standard library, in those rare configurations where one needs to be built, the compiler appears to hang for several minutes, even on a trivial compilation. This commit adds a remark that's emitted when this happens, explaining that the standard library is being rebuilt and it will take a few minutes.
2021-05-22 15:45:16 -07:00
Doug Gregor
d6e8fd81f5 Remove @actorIndependent attribute.
`@actorIndependent` has been superseded by `nonisolated`. Remove
the old spelling entirely.
2021-05-17 12:21:10 -07:00
Xi Ge
b6cd513534 Frontend: teach the compiler to use a backup directory to find .swiftinterface files to compile
This mechanism allows the compiler to use a backup interface file to build into a binary module when
a corresponding interface file from the SDK is failing for whatever reasons. This mechansim should be entirely opaque
to end users except several diagnostic messages communicating backup interfaces are used.

Part of rdar://77676064
2021-05-13 09:11:45 -07:00
Alexis Laferrière
3310a55682 [Test] Use the SwiftStdlib 5.5 macro in Concurrency tests 2021-05-06 13:48:49 -07:00
John McCall
186c53000d Introduce basic support for custom executors.
- Introduce an UnownedSerialExecutor type into the concurrency library.
- Create a SerialExecutor protocol which allows an executor type to
  change how it executes jobs.
- Add an unownedExecutor requirement to the Actor protocol.
- Change the ABI for ExecutorRef so that it stores a SerialExecutor
  witness table pointer in the implementation field.  This effectively
  makes ExecutorRef an `unowned(unsafe) SerialExecutor`, except that
  default actors are represented without a witness table pointer (just
  a bit-pattern).
- Synthesize the unownedExecutor method for default actors (i.e. actors
  that don't provide an unownedExecutor property).
- Make synthesized unownedExecutor properties `final`, and give them
  a semantics attribute specifying that they're for default actors.
- Split `Builtin.buildSerialExecutorRef` into a few more precise
  builtins.  We're not using the main-actor one yet, though.

Pitch thread:
  https://forums.swift.org/t/support-custom-executors-in-swift-concurrency/44425
2021-04-30 03:11:56 -04:00
Alex Hoppen
6e36a051ec [test] Fix CI failure in bad stdlib test
https://github.com/apple/swift/pull/36928 changed the error message while https://github.com/apple/swift/pull/36594 added a test case looking for the old error message. Update the test to look for the non-dynamic substring of the new error message.
2021-04-16 13:11:48 +02:00
Becca (née Brent) Royal-Gordon
6e710b2806 Merge pull request #36594 from beccadax/nonstandard-library
Preload standard library in ModuleInterfaceBuilder
2021-04-15 10:43:28 -07:00
Mike Ash
6d2fc9e9bd Add @availability to some concurrency tests that were missing it. 2021-04-01 15:34:33 -04:00
Becca Royal-Gordon
02c747609b Preload standard library in ModuleInterfaceBuilder
Previously, when the standard library module interface was broken, Swift would try to rebuild it repeatedly during -compile-module-from-interface jobs because `ASTContext::getStdlibModule()` would try to load the standard library again each time it was called. This led to extremely slow compilations that repeatedly emitted the same errors.

To avoid this, we make ModuleInterfaceBuilder try to load the standard library right away and bail out if it can’t.

Fixes rdar://75669548.
2021-03-25 18:48:00 -07:00
Becca (née Brent) Royal-Gordon
e6aee251be Merge pull request #35904 from beccadax/go-back-to-the-shadow
Warn about module name shadowing in interfaces
2021-02-16 15:32:41 -08:00
Becca Royal-Gordon
c2f3725f56 Warn about module name shadowing in interfaces
There is a known issue with module interfaces where a type with the same name as a module will disrupt references to types in that module. Fully fixing it will require a new language feature (SR-898) which is not yet available. In the meantime, module interfaces support a workaround flag (“-Xfrontend -module-interface-preserve-types-as-written”) which prints an alternate form that usually works. However, you have to know to add this flag, and it’s not obvious because nothing breaks until a compiler tries to consume the affected module interface (or sometimes even one of its clients).

This commit emits a warning during module interface emission whenever the module interface either imports a type with the same name as the module being built, or declares a type with the same name as a visible module. This lets the user know that the type may cause problems and they might need to implement a workaround.
2021-02-10 19:03:06 -08:00
Evan Wilde
8b80331c3d Updating tests to use actor
This patch updates the `actor class` spelling to `actor` in almost all
of the tests. There are places where I verify that we sanely handle
`actor` as an attribute though. These include:

 - test/decl/class/actor/basic.swift
 - test/decl/protocol/special/Actor.swift
 - test/SourceKit/CursorInfo/cursor_info_concurrency.swift
 - test/attr/attr_objc_async.swift
 - test/ModuleInterface/actor_protocol.swift
2021-02-10 08:09:13 -08:00
Artem Chikin
6f3fda1369 Avoid false FileDependnecies among Implicitly-build Swift and Clang modules
`InterfaceSubContextDelegateImpl` causes sub-instances to inherit `-fmodule-map-file=` options.
Those Module Maps become file dependencies of all downstream PCMs and their depending Swift modules, even though they really aren't.
This causes frequent re-builds of the Module Cache contents when seemingly-unrelated files are touched.

Explicit Module Builds rely on these options for building Swift Interface files, so for now we just disable inheritance of these options in Implicit Module builds.
2021-02-03 16:47:46 -08:00
Kavon Farvardin
f76645dab1 [concurrency] global actors in reslient modules need thick metatype.
Resolves rdar://72604101
2021-01-06 15:01:22 -08:00
Doug Gregor
b6c0145932 [SE-0289] Continue printing @_functionBuilder in .swiftinterfaces.
Maintain the ability for older Swift compilers to read .swiftinterfaces
that make use of result builders by always emitting @_functionBuilder
rather than the newer @resultBuilder.
2020-10-20 22:24:41 -07:00
Doug Gregor
6d41524fe6 [SE-0289] Finish renaming source code, tests to "result builders" 2020-10-20 22:18:51 -07:00
Saleem Abdulrasool
240ae1b589 test: make make-unreadable Python 3 friendly
Make `make-unreadable` python 3 compatible.  `POINTER` is now in
`ctypes` rather than in `ctypes.wintypes`.  Use the new location which
is compatible across python 2 and python 3.
2020-06-24 09:00:21 -07:00
Pavel Yaskevich
d23b938331 [Diagnostics] Implement IgnoreAssignmentDestinationType::diagnoseForAmbiguity
For cases like this:

```swift
struct X {}
struct Y {}

func overloaded<T>(_ value: T) -> T { value }
func overloaded<T>(_ value: T) -> Int { 0 }

func test(x: inout X, y: Y) {
  x = overloaded(y)
}
```

Solver would record a `IgnoreAssignmentDestinationType` fix per overload,
`diagnoseForAmbiguity` could be used to properly diagnose ambiguity cases
like that.
2020-06-12 11:47:04 -07:00
Varun Gandhi
93958ed76b [NFC] Add test case for old arm64e fallback behavior. 2020-04-22 23:57:48 -07:00
swift-ci
448807f579 Merge remote-tracking branch 'origin/master' into master-next 2019-09-20 19:09:54 -07:00
Pavel Yaskevich
8eaeb51fe5 [ConstraintSystem] Introduce a fix for assignment type mismatch
Introduce a fix/diagnostic when there is a contextual mismatch
between source and destination types of the assignment e.g.:

```swift
var x: Int = 0
x = 4.0 // destination expects an `Int`, but source is a `Double`
```
2019-09-20 17:12:04 -07:00
swift-ci
bd0d9603b1 Merge remote-tracking branch 'origin/master' into master-next 2019-09-16 01:29:22 -07:00
Pavel Yaskevich
a1643d94f7 [Diagnostics] NFC: Update all of the improved test-cases 2019-09-13 22:35:52 -07:00
swift-ci
0c440ff5ef Merge remote-tracking branch 'origin/master' into master-next 2019-09-13 20:49:32 -07:00