Commit Graph

314 Commits

Author SHA1 Message Date
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
Saleem Abdulrasool
849d5f0aaf Serialization: normalize the path before use
This normalizes the path so that we always have the mapping in normal
form.  This fixes a bug in the cross-module import tracing, allowing us
to finally enable the test on Windows.
2021-12-22 08:41:17 -08:00
Xi Ge
ad3588eb82 sema: avoid emitting several _const diagnostics for .swiftinterface files 2021-11-23 19:48:29 -08:00
Xi Ge
06e63896cd ModuleInterface: consume _const keyword at var and parameter decls and keep them in textual/binary modules
This is to ensure users can start adding these annotations. Type checker supports will come in later commits.

Related to pitch: https://forums.swift.org/t/pitch-compile-time-constant-values/53606

rdar://85268028
2021-11-19 22:13:23 -08:00
Xi Ge
17cba71a18 Merge pull request #40196 from nkcsgexi/85426499 2021-11-16 07:43:07 -08:00
Xi Ge
2f2ee1bf1e ModuleInterface: print @_originallyDefinedIn attributes for synthesized extensions for synthesized conformances
rdar://85426499
2021-11-15 22:25:27 -08:00
Doug Gregor
035d492a3a Fix printing of 'isolated' parameters.
Fixes rdar://83316058.
2021-11-12 21:45:44 -08:00
Xi Ge
9acf26b0d0 Merge pull request #40113 from nkcsgexi/flag-downgrade-module-verification-error 2021-11-09 20:55:25 -08:00
Xi Ge
f77ca2e2ae Frontend: add a flag to downgrade all module interface verification errors to warnings
Ideally, module interface verification should fail the build when fatal error occurs when
type checking emitted module interfaces. However, we found it's hard to stage this phase in
because the ideal case requires all Swift adopters to have valid interfaces. This new front-end flag allows
driver to downgrade all interface verification errors to warnings as an intermediate step.
2021-11-09 15:58:42 -08:00
Arnold Schwaighofer
2b41beeb12 Merge pull request #39966 from aschwaighofer/feature_specialize_with_availability
Define a feature for _specialize with availability
2021-11-08 12:13:33 -08:00
Karoy Lorentey
e2cfab4f28 [stdlib][test] Adopt availability macros in tests 2021-10-31 15:00:58 -07:00
Karoy Lorentey
8e154a415a Merge pull request #39962 from lorentey/concurrency-availability
[stdlib] Introduce availability macros
2021-10-31 14:23:57 -07:00
Arnold Schwaighofer
0965a63eb8 Test case 2021-10-30 06:16:30 -07:00
Erik Eckstein
c578c937c8 SILOptimizer: run the GlobalOpt pass in the mandatory pipeline.
Replace the dynamic initialization of trivial globals with statically initialized globals, even in -Onone.
This is required to be able to use global variables in performance-annotated functions.
Also, it's a small performance improvement for -Onone.
2021-10-29 22:35:57 +02: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
Xi Ge
495bd36238 ABIChecker: teach wmo mode to emit ABI descriptor files 2021-10-28 08:16:19 -07:00
Becca Royal-Gordon
195896a175 Print @_nonSendable extension in module interfaces
…instead of printing the attribute itself. This allows uses of @_nonSendable to back-deploy.
2021-10-14 12:14:46 -07:00
Arnold Schwaighofer
8840ea6b5b Add support for parsing an availability argument in @_specialize 2021-10-05 14:46:17 -07:00
Meghana Gupta
f458d9b490 Fix unnecessary one-time recompile of stdlib with -enable-ossa-flag (#39516)
* Fix unnecessary one-time recompile of stdlib with -enable-ossa-flag

This includes a bit in the module format to represent if the module was
compiled with -enable-ossa-modules flag. When compiling a client module
with -enable-ossa-modules flag, all dependent modules are checked for this bit,
if not on, recompilation is triggered with -enable-ossa-modules.

* Updated tests
2021-10-04 18:46:40 -07:00
Hamish Knight
36511474a4 [AST] Preserve source location in packIntoImplicitTupleOrParen
When type-checking a tuple construction such as
`Void()`, make sure to preserve the source info
from the argument list in the resulting
type-checked TupleExpr `()`. This is needed for
serialization to be able to grab the textual
representation.

SR-15181
rdar://83202870
2021-09-30 13:03:41 +01:00
Slava Pestov
3f8ef30185 RequirementMachine: Preserve sugared generic params in getSuperclassBound() and getConcreteType()
This was manifesting as module interfaces printing generic parameters
as `τ_0_0` in some cases.

Note that the GSB has the same bug, so this test case will fail with
-requirement-machine=off. I don't plan on fixing the bug in the GSB
unless we need to.

Fixes rdar://problem/78977127.
2021-09-29 14:39:38 -04:00
Xi Ge
f97653ef37 Frontend: teach -emit-module and -merge-modules to emit ABI descriptor files 2021-09-21 16:51:52 -07:00
Becca Royal-Gordon
e16cf3085f Override -triple on fallback to arm64e interface
When we fall back to loading an arm64e module interface during an arm64 build, we want to compile it for the arm64 target so that it is fully compatible with the module that will load it, even though the flags in the file specify the arm64e target. Rewrite the sub-invocation's TargetTriple property in this specific situation. If the two targets differ by more than just the sub-architecture, we will continue to respect the -target flag in the file.

Fixes <rdar://83056545>.
2021-09-15 12:36:17 -07:00
Evan Wilde
ddf210b449 Disabling arm64e testing in two tests
I wasn't aware that arm64e was a thing in open-source, but these two
tests are failing on Apple Silicon both on the main branch and on the
rebranch branch, so I'm disabling it for now.

The failing tests are:
 - ModuleInterface/arm64e-fallback.swift
 - stdlib/Reflection_objc.swift
2021-09-13 13:30:50 -07:00
Becca Royal-Gordon
e13fafc001 Merge pull request #39083 from beccadax/give-me-some-e
Add arm64 -> arm64e fallback to module loading
2021-09-10 13:12:52 -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
Xi Ge
a8b95cb9cd ABIChecker: don't fail when hitting EnumCaseDecl
All enum elments should have been handled separately so we don't need to anything special
for EnumCaseDecl except consuming them.
2021-09-03 16:45:24 -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
Doug Gregor
ebd7b49755 Build compiler, other libraries, and tests for back-deployed concurrency.
When build-script is given `--back-deploy-concurrency`, also use that
to build other parts of Swift with the back-deployed versions:

* The compiler allows async and actors to be defined with the
back-deployed availability, e.g., the same as `-Xfrontend
-enable-experimental-back-deploy-concurrency`. (The latter will go
away soon)
* The standard library unit testing framework and distributed actors
library are build with the older OS versions.
* The tests use the older OS versions, with some adjustments to make
them agnostic to the back-deployment setting.
2021-08-26 08:49:44 -07:00
Xi Ge
1a660c08ca Frontend: teach -compile-module-from-interface action to emit ABI descriptor as byproduct
We have implemented a libSwiftDriver-based tool to generate prebuilt module cache for
entire SDKs. Anchored on the same infrastructure, we could also generate ABI baselines
for entire SDKs.
2021-08-20 15:47:10 -07:00
Slava Pestov
1f652bc7d8 Sema: Don't derive witnesses in swiftinterface files
This fixes a regression from https://github.com/apple/swift/pull/36752.

Previously, a RawRepresentable enum would use the default implementation
of == from a protocol extension in the standard library. After the above
PR, we began synthesizing the == operator, just like we do for ordinary
enums.

However, when type checking an older swiftinterface file, we would
still synthesize the declaration and try to use it, even though it would
not have existed in the older dylib built with the older compiler.

Fix this by not deriving witnesses in swiftinterface files at all.
The interface should already explicitly list out all derived witnesses;
if one is not listed, it should not be derived, because it does not
exist in the dylib.

Fixes rdar://problem/80466745.
2021-08-18 16:22:26 -04:00
Xi Ge
c2e4e86670 ModuleInterface: avoid omitting platform names when printing @available
rdar://81903124
2021-08-13 11:14:11 -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
c5ad28779d [tests] Run module interface build alternative interface test in dynamic target cpu 2021-07-28 18:35:05 -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
Slava Pestov
389bbc7c96 Merge pull request #38500 from slavapestov/actor-isolation-cycle
Sema: Kick off ActorIsolationRequest after checking conformances to avoid cycles
2021-07-22 20:59:48 -04:00
Slava Pestov
c3d3879637 Sema: Kick off ActorIsolationRequest after checking conformances to avoid cycles
Fixes rdar://problem/80107082.
2021-07-22 16:07:50 -04:00
Xi Ge
a25d5ec47d ModuleInterface: skip printing the override keyword if the overriden decl is skipped
rdar://80918826
2021-07-21 19:30:10 -07:00
Doug Gregor
1e2012d816 Disable availability checking in tests that use concurrency 2021-07-20 12:46:26 -07:00
Xi Ge
a87f591feb test: require X86_64 for disable-availability-checking.swift
rdar://80799638
2021-07-19 14:14:59 -07:00
Xi Ge
d237455481 ModuleInterface: pass down -disable-availability-checking to module building command
Related to: rdar://80703470
2021-07-17 09:40:27 -07:00
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