Commit Graph

272 Commits

Author SHA1 Message Date
Xi Ge
3ab9ddfa6d TextualInterface: print __conuming before accessors
rdar://80535144
2021-07-15 13:32:36 -07:00
Doug Gregor
d18a2b7fda Re-enable actor inheritance from NSObject.
For now, it's the only way to get NSObjectProtocol conformance.
Fixes rdar://80476009.
2021-07-12 16:12:35 -07:00
Doug Gregor
06bbc70b3e Module printing and serialization support for @unchecked Sendable 2021-07-11 12:29:54 -07:00
Doug Gregor
6406f08661 [SE-0306] Disallow actor inheritance from NSObject, but allow @objc actor.
Allow an actor to be exposed to Objective-C via `@objc` without
inheriting from `NSObject`, and remove the loophole that allowed
actors to inherit from `NSObject`.

Fixes rdar://78333614
2021-07-02 23:37:09 -07:00
Doug Gregor
9ec20776c9 [SE-0306] Make actors semantically "final".
Treat actors as being semantically `final` throughout the type checker.
This allows, for example, a non-`required` initializer to satisfy a
protocol requirement.

We're leaving the ABI open for actor inheritance should we need it.

Addresses rdar://78269551.
2021-06-30 10:59:49 -07:00
Varun Gandhi
8ccc176cca Merge pull request #38014 from varungandhi-apple/vg-interface-respect-flag
[ASTPrinter] Use TypeLoc printing for extended types.
2021-06-22 09:17:53 -07:00
Varun Gandhi
284fcb5faa [ASTPrinter] Use TypeLoc printing for extended types.
When the -module-interface-preserve-types-as-written flag is used,
the extended type should be printed similar to other types. The
checking for that flag happens in TypeLoc printing, not Type printing.
So we change extended type printing to use a TypeLoc instead.

Fixes rdar://79563937.
2021-06-21 16:19:42 -07:00
Doug Gregor
c6039af984 Merge pull request #37961 from nkcsgexi/sanitize-when-disagree
ModuleInterface: sanitize arch when interface file name and encoded flags disagree
2021-06-21 14:01:26 -07:00
Xi Ge
49c64cf902 ModuleInterface: sanitize arch when interface file name and encoded flags disagree
It's a known issue that we are using arm64e interfaces contents for the arm64 target,
meaning the encoded module flags are specifying -target arm64e-x-x instead of
-target arm64-x-x. Fortunately, we can tell the target arch from the interface file
name, so we could sanitize the target to use by inferring arch from the file name.
2021-06-16 22:20:55 -07:00
Varun Gandhi
8f0235ed51 Merge pull request #37879 from varungandhi-apple/vg-fix-interface-bug
[ModuleInterface] Print full type if ambiguous for extensions.
2021-06-15 21:10:42 -07:00
Alexis Laferrière
73960ee977 [ModuleInterface] Fix implementation-only imported type leak in indirect conformance
Don't print indirect conformances for protocols that are
implementation-only imported. Indirect conformances are synthesized when
the middle protocol is internal and not printed in the swiftinterface.
This logic didn't previously check for implementation-only imports,
likely because type-checking usually forbids it. Let's still protect
this use case as we are considering relaxing this type-checking
restriction in the future.

rdar://78718838
2021-06-14 15:08:25 -07:00
Varun Gandhi
02afb9d49b [ModuleInterface] Print full type if ambiguous for extensions.
The patch introduces a new setting instead of changing existing settings
because the generated interfaces in the IDE have slightly different
requirements; the extended type there is unconditionally not printed
qualified (even if it is ambiguous). This is likely because the
ambiguity heuristic is very weak; it doesn't even do name lookup.
Simplifying that logic would be nice, but then we'd need to update
a bunch of IDE/print* tests and end up with more more visual clutter
in the IDE.

Introducing the new setting means we can change the behavior for
swiftinterface files without affecting the behavior for IDE interfaces.

Fixes rdar://79093752.
2021-06-11 20:04: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
Ben Langmuir
202c9a7b24 Disable test/ModuleInterface/swift_build_sdk_interfaces/ignore-non-stdlib-failures.test-sh
This is timing out in CI in some configurations.

rdar://78483379
2021-05-25 16:51:22 -07:00
Karoy Lorentey
7c0b50e8ea Revert "Remove @actorIndependent attribute." 2021-05-24 14:43:32 -07:00
swift-ci
6a5f7fd6a3 Merge pull request #37126 from beccadax/not-gonna-go-fast 2021-05-22 19:47:16 -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
Xi Ge
048ef11d9f Merge pull request #37588 from nkcsgexi/78233352
ModuleInterface: move -user-module-version to a new field
2021-05-22 07:26:42 -07:00
Xi Ge
03e0006a48 ModuleInterface: move -user-module-version to a new field
Titled as "// swift-module-flags-ignorable:", this new field contains new
frontend arguments that can be safely ignored by the older version of the compiler.
For compilers that don't know the field at all, all arguments in it are ignored.

rdar://78233352
2021-05-21 14:52:10 -07:00
Ben Langmuir
e42932ea54 Disable ModuleInterface/swift_build_sdk_interfaces/xfail-logs.test-sh
This is timing out in CI in some configurations.

rdar://78318467
2021-05-21 11:02:19 -07:00
Xi Ge
d08050fc5d Merge pull request #37489 from nkcsgexi/build-backup-explicit
ModuleInterface: teach module build action to use fall-back interface if building canonical interface failed
2021-05-18 17:30:01 -07:00
Xi Ge
dbba4c22c1 Merge pull request #37486 from nkcsgexi/78160707
Frontend: sanitize version numbers beyond the scope of llvm::VersionTuple
2021-05-18 17:29:49 -07:00
Xi Ge
62dddc1c53 ModuleInterface: teach module build action to use fall-back interface if building canonical interface failed. 2021-05-18 13:21:31 -07:00
Doug Gregor
4d91f79bd5 Merge pull request #37462 from DougGregor/remove-actor-independent 2021-05-18 12:08:17 -07:00
Xi Ge
e17a9d192a Frontend: sanitize version numbers beyond the scope of llvm::VersionTuple
rdar://78160707
2021-05-18 11:04:04 -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
5c5715f626 Serialization: embed subminor and build version in the user module version entry 2021-05-17 10:15:47 -07:00
Xi Ge
ae4781dd90 test: specify touch time to ensure mod time difference
rdar://78027229
2021-05-14 13:04:44 -07:00
Doug Gregor
2b9ca315fe [Concurrency] Remove asyncHandler attribute.
The `asyncHandler` attribute turned out to be the wrong solution
to the problem of creating a sync->async bridge. Remove it.
2021-05-13 17:01:39 -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
Alex Hoppen
7462a62b37 Merge pull request #37238 from ahoppen/pr/dont-print-dollar-internal-labels
[AST] Don’t print internal function labels if they start with '$'
2021-05-04 18:34:20 +02:00
Alex Hoppen
66e416b604 [AST] Don’t print internal function labels if they start with '$'
We might infer internal function labels as `$0` from a closure with which a variable is initialised. But we don’t want to print the function signature as `(_ $0: Int) -> Int` because `$0` is not a valid variable name to declare.

So, in the case described above, only print the type.

Fixes rdar://77462547
2021-05-04 12:42:58 +02:00
Kavon Farvardin
e17e09c294 Enable effectful properties (SE-310) by default.
1. Removes gating on -enable-experimental-concurrency.
2. Updates eff. prop tests to remove experimental flag,
   and also adjusts some tests slightly to avoid things
   that are still behind that flag.
2021-05-03 14:10:44 -07:00
Kavon Farvardin
c5ec5bf5b1 fix feature guards in swiftinterface for eff. props 2021-04-30 17:07:18 -07:00
Alexis Laferrière
a232ebbf43 [Test] Disable ModuleInterface/ossa-modules/sdk-test-stdlib-ossa.swift for hangs 2021-04-30 15:36:02 -07:00
Xi Ge
c7b383c1e7 Merge pull request #37177 from nkcsgexi/73992299-1
ModuleInterface/Serialization: allow library authors to define a custom module version number
2021-04-30 14:43:16 -07:00
Xi Ge
043d492c65 Merge branch 'main' into 73992299-1 2021-04-30 10:19:57 -07:00
Xi Ge
fe5c7ef995 ModuleInterface/Serialization: allow library authors to define a custom module version number
This allows library authors to pass down a project version number so that library users can conditionally
import that library based on the available version in the search paths.

Needed for rdar://73992299
2021-04-30 10:00:45 -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
Kavon Farvardin
c1f48c6855 fix missing effects specifiers on eff props in swiftinterface
I missed the case where the body is also being printed in the
interface file.
2021-04-29 20:29:50 -07:00
Doug Gregor
b88e678694 [SE-0306] Disable actor inheritance.
Actor inheritance was removed in the second revision of SE-0306. Remove
the ability to inherit actors.

Note that this doesn't fully eliminate all vestigates of inheritance
from actors. There are simplifications that need to be performed
still, e.g., there's no need to distinguish
designated/convenience/required initializers. That will follow.
2021-04-23 15:08:57 -07:00
Doug Gregor
cdd6ad8bfd Introduce a feature for @_inheritActorContext
Add a feature for this new attribute, and make sure we use the feature
guard for functions that use it, e.g., the new `async`.

Finishes rdar://76927008.
2021-04-22 15:49:48 -07:00
David Zarzycki
654234ad64 [Testing] Unbreak minimal Swift builds
For various reasons, it can be useful/interesting to create builds of
Swift that minimize dependencies. Let's try to keep that working as long
as we can.
2021-04-16 17:39:01 -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
eeckstein
f53f80ff04 Merge pull request #36928 from eeckstein/module-build-error-message
ModuleInterfaceBuilder: give a more specific error message in case of a compiler mismatch
2021-04-16 08:55:32 +02:00
Doug Gregor
c1328bd83f Merge pull request #36857 from DougGregor/import-concurrency-by-default-take-2
Enable import of the _Concurrency module by default.
2021-04-15 13:12:45 -07: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
Erik Eckstein
d49de1a982 ModuleInterfaceBuilder: give a more specific error message in case of a compiler mismatch 2021-04-15 14:06:17 +02:00