Commit Graph

231 Commits

Author SHA1 Message Date
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
Becca Royal-Gordon
28c260e38d Disable ModuleInterface/BadStdlib.swiftinterface on Windows (SR-14489) 2021-04-14 17:29:51 -07:00
Doug Gregor
568e943115 Enable import of the _Concurrency module by default. 2021-04-13 23:14:06 -07:00
Arnold Schwaighofer
9286ece71c Revert "Enable import of the _Concurrency module by default." 2021-04-09 13:20:30 -07:00
Doug Gregor
95fd3ede09 Update tests and testing tools for implicit _Concurrency import 2021-04-06 14:08:41 -07:00
Doug Gregor
878d6c258c [Module interface] Ensure that we keep #ifs for compiler workarounds.
Fixes rdar://76236364.
2021-04-05 21:46:53 -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
Doug Gregor
c76dac7155 Banish @asyncHandler to a hidden flag.
We don't want @asyncHandler to be part of the concurrency model, so put
it behind a different flag.
2021-03-25 16:45:21 -07:00
Erik Eckstein
78ec15cf38 tests: remove some unused FileCheck prefix options
Such tests would fail with the -allow-unused-prefixes FileCheck option.

diff --git a/test/lit.cfg b/test/lit.cfg
-run_filecheck = '%s %s --sanitize BUILD_DIR=%s --sanitize SOURCE_DIR=%s --use-filecheck %s %s' % (
+run_filecheck = '%s %s --sanitize BUILD_DIR=%s --sanitize SOURCE_DIR=%s --use-filecheck %s %s -allow-unused-prefixes=false' % (

It helps avoiding some wrong CHECK patterns.
I just looked briefly at some of the fails. TODO: fix remaining tests, too.

rdar://74189761
2021-03-25 15:19:30 +01:00
David Zarzycki
00533e8712 [NFC] Change magic emoji to __ 2021-03-23 13:41:16 -04:00
Michael Gottesman
9aa211112f Merge pull request #36379 from gottesmm/pr-cff5438783955ec4ac3e7b541e54eb87b9cc3b04
[ossa][frontend] Separately namespace enable-ossa-modules in the module cache so that the flag causes recompilation of imported resilient modules.
2021-03-19 04:02:14 -07:00
Doug Gregor
52096a640e SE-0302: Rename ConcurrentValue/@concurrent to Sendable/@Sendable. 2021-03-18 23:48:21 -07:00
Doug Gregor
9579390024 [SE-0304] Rename ConcurrentValue to Sendable 2021-03-18 22:48:20 -07:00
Michael Gottesman
05f8d933da Eliminate a subshell from a test so test works on windows. 2021-03-18 21:14:20 -07:00
Michael Gottesman
ae835036cb [ossa-modules] Add a new lit pattern %relative-platform-module-dir-prefix so tests can use the proper prefix to have Swift find a fake sdk module. 2021-03-18 18:36:40 -07:00
Michael Gottesman
504b5f2058 [ossa][frontend] Separately namespace enable-ossa-modules in the prebuilt module cache so that the flag causes recompilation of imported resilient modules when the flag is enabled.
This will enable users to try out the '-enable-ossa-modules' flag if their
compiler supports it and get OSSA code on all inlinable code that they use. The
idea is that this is a nice way to stage this in and get more testing.

The specific implementation is that the module interface loader:

1. Knows if enable ossa modules is enabled not to search for any compiled
modules. We always rebuild from the interface file on the system.

2. Knows that if enable ossa modules is enabled to mixin a bit into the module
interface loader cache hash to ensure that we consider the specialized ossa
compiled modules to be different than the modules in that cache from the system.

This ensures that when said flag is enabled, the user transparently gets all
their code in OSSA form from transparent libraries.
2021-03-18 13:03:51 -07:00
Doug Gregor
7f5c5695d1 Merge pull request #36405 from DougGregor/mangle-module-abi-name-concurrency 2021-03-12 19:29:05 -08:00
Doug Gregor
c18ef1af94 Properly collect all enclosing features. 2021-03-12 11:23:27 -08:00
Doug Gregor
2a28fed34d Allow one to separately specify the ABI name of a module.
Introduce a new compiler flag `-module-abi-name <name>` that uses the
given name as the ABI name for the module (rather than the module's
name in source code). The ABI name impacts name mangling and metadata.
2021-03-12 07:42:07 -08:00
Doug Gregor
7015543c9c [Module interfaces] More aggressively #if-out declarations.
Extend the checks for marker protocols and rethrows protocols to ensure
that we #if out more code that relies on them in module interface
generation. This makes the _Concurrency module parseable by much older
compilers.

Fixes rdar://75291705.
2021-03-11 22:03:29 -08:00
Alexis Laferrière
eeab067a45 Merge pull request #36380 from xymus/private-over-prebuilt
[Frontend] Don't load modules from the prebuilt cache for private interfaces
2021-03-10 11:22:57 -08:00
Alexis Laferriere
82cb31d629 [Frontend] Don't load modules from the prebuilt cache for private interfaces
rdar://73007024
2021-03-09 19:21:14 -08:00
Slava Pestov
6615e16bfa AST: Skip stub initializers when printing module interfaces
When a derived class does not inherit a designated initializer from
its base class, we override the designated initializer's vtable
entry with a stub which traps with a fatal error.

The stub cannot be called and clients do not need to be aware of
its existence, so don't print it at all in the module interface.

Fixes rdar://problem/71122015 / https://bugs.swift.org/browse/SR-13832.
2021-03-05 23:53:57 -05:00
Doug Gregor
2b9fa92914 [AST Printing] Consider the storage decl as the "enclosing" decl of an acccessor
Fixes spurious #if's when printing for backward compatibility, rdar://75074036
2021-03-04 21:47:17 -08:00
Doug Gregor
b5e4b085aa Infer ConcurrentValue conformances for structs and enums.
When a struct or enum has only ConcurrentValue-conforming instance
data, infer conformance to ConcurrentValue.
2021-03-02 00:23:33 -08:00
Doug Gregor
e7d7585503 Add a feature for global actors & module interface support 2021-02-22 20:46:58 -08:00
Doug Gregor
f21c60928c Add feature for rethrows protocols and use it in module interface generation 2021-02-22 16:18:47 -08:00
Doug Gregor
2fd1912f5a Simplify printing of marker protocols in Swift interfaces
Thanks to a great idea from Slava, simplify the printing of marker
protocols in Swift interfaces while maintaining backward compatibility.
For compilers that cannot handle marker protocols, print a typealias
to `Any` instead, which is a good stand-in for just about everything.
2021-02-18 22:58:19 -08: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
Slava Pestov
cdbba60674 AST: ASTPrinter support for 'reasync'
Part of <rdar://problem/71098795>.
2021-02-15 22:18:54 -05:00
Becca Royal-Gordon
ba3b2610b8 Shorten diagnostic and refer to bug report instead
diag::warning_module_shadowing_may_break_module_interface was *enormous* but still described the problem too tersely to convey everything that was needed. Instead, reference a bug report that describes the problem and its workarounds in more detail.
2021-02-12 17:30:47 -08:00
Doug Gregor
e8375e13ee Define a feature for @concurrent functions. 2021-02-12 16:36:12 -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
Doug Gregor
c26c5029a5 [Actor isolation] Compute actor isolation properly even in Swift interfaces.
The check that limited inference of actor isolation meant that we were
incorrectly computing actor isolation for (e.g.) overrides when
parsing from Swift interfaces. Only limit inference for cases where we
are guaranteed to synthesize an attribute by inference.
2021-02-10 15:55:51 -08:00
Doug Gregor
43df1d8363 [Concurrency] Don't spuriously record protocols inherited by Actor. 2021-02-10 15:52:03 -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
swift-ci
bcfafc1b07 Merge pull request #35854 from davezarzycki/pr35854 2021-02-09 13:07:51 -08:00
David Zarzycki
5a17429b25 [Testing] Add missing REQUIRES: concurrency 2021-02-09 13:26:44 -05:00
Doug Gregor
b1aa56dbd1 Clean up test comment and mark as REQUIRES: concurrency 2021-02-09 09:28:17 -08:00
Doug Gregor
643ce71a09 Peer into the types of declarations to find async/actors/etc. 2021-02-08 22:50:48 -08:00
Doug Gregor
627e4f03a3 Properly print protocols that inherit marker protocols under $MarkerProtocol 2021-02-08 22:37:13 -08:00