Commit Graph

4421 Commits

Author SHA1 Message Date
swift-ci
56f1a55d82 Merge pull request #33797 from tbkka/tbkka/dynamicCastRework-Specification-d 2020-09-08 23:40:45 -07:00
Varun Gandhi
ae8db93dd0 [docs] Revise documentation building instructions and move to FAQ.md. 2020-09-08 20:28:11 -07:00
Varun Gandhi
3fe3500d98 [docs] Add First Pull Request guide and Getting Started guide.
This improves upon the existing documentation to provide a clearer end-to-end
workflow for new contributors and people who wish to build the toolchain
locally but do not intend to submit patches.

We also provide more directions for systematically utilizing our existing
documentation.
2020-09-08 20:28:11 -07:00
Varun Gandhi
384edd1f2b [docs] Link 'The Swift Runtime' blog posts in ExternalResources.md. 2020-09-07 17:45:34 -07:00
Saleem Abdulrasool
4b3d15d65a Update WindowsBuild.md
Add some documentation on how swift-package-manager finds the package description before installation.
2020-09-07 14:24:49 -07:00
Saleem Abdulrasool
edf8947642 Update WindowsBuild.md
- Sort the arguments to CMake to make them easier to spot
- Sort the clones to be in order of use
- Use shorter build directory names as the paths can be troublesome
- Update instructions all the way through to swift-package-manager as that now works
- Fix instructions for cloning swift-llbuild (the repository contains symlinks)
- Add instructions for new swift-package-manager dependencies
- Homogenise the build rules (they are at this point, largely copy-paste from each one, just listing dependencies)
- Switch `swift-llbuild` to use `clang-cl` instead of `cl` and add a workaround for code splitting
2020-09-07 09:46:29 -07:00
YR Chen
3c5322d50d [docs] Deprecate Python 2 in Windows build instructions (#33819) 2020-09-07 13:30:30 +01:00
Tim Kientzle
115b53f091 Punctuation 2020-09-04 09:16:21 -07:00
Varun Gandhi
29f2f7719a [docs] Update branching documentation to use new release branch naming scheme. (#33766) 2020-09-03 23:53:34 -07:00
Varun Gandhi
73a5279a0b [docs] Add 'critical edge' definition to Lexicon. (#33765) 2020-09-03 17:20:43 -07:00
Tim Kientzle
b73330b113 [DynamicCast] Rework existential casting discussion
A previous PR collected the various existential types into a single
section of the document.

This PR takes advantage of that structure to clarify the discussion of existential and protocol casting:

* Adds a general discussion of existential casting

* Introduces the "strong existential invariant" and "weak existential invariant" that are common to all existential types

* Makes a more precise distinction between protocols and existential types

This last point involves a number of careful wording nuances based on the following:
* A "protocol" is a syntactic construct defining a collection of requirements and default implementations (the latter via "protocol extensions")
* Some protocol definitions (those without associated types or `Self` references) have an associated "protocol witness" existential type
* A protocol witness existential type has the same name as the protocol definition from which it is derived but they are conceptually different notions
* Existential types such as `Any`, `AnyObject`, and `Error` are not protocols -- for example, they cannot be extended.
* `AnyHashable` is a type-erased container type but is not an existential.  It does however behave like an existential for casting purposes.
2020-09-03 15:56:00 -07:00
Max Desiatov
e524b1cb62 docs: Add WebAssembly.md describing target implementation details (#33723)
Only general intro and the "Relative Pointers" section are added to get started. More sections to be added in the future after preliminary feedback on this document is gathered.

Related to SR-9307
2020-09-03 11:24:20 +01:00
swift_jenkins
4eaa071e8b Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-31 18:46:27 -07:00
swift-ci
c708785d33 Merge pull request #33696 from varungandhi-apple/vg-fix-doc-library-evolution-protocols 2020-08-31 14:29:54 -07:00
Tim Kientzle
310c2656f0 Reorganize DynamicCasting spec
This only rearranges the existing sections; it does not change any technical points.

This attempts to make the spec a little clearer by grouping the individual type discussions under four main headings:

* Classes and Foreign Types.  This includes Swift classes, Obj-C classes, and CF types.
* Other Concrete Types.  Struct, Enum, Tuple, Function, Optional, and Set/Dict/Array
* Existential Types.  Any, AnyObject, Error, Protocol types, and AnyHashable(*)
* Metatypes & Existential Metatypes (*)

This organization seems to flow a little better.

In particular, it gives me a place to discuss issues common to all Existential types, which I'll work through in a subsequent PR.

Footnotes: This organization isn't perfect, of course:
 * AnyHashable isn't really an Existential type, but it behaves as such for casting purposes, so it makes the most sense to discuss it in the Existentials section.
 * Metatypes are technically concrete types, but it seems to make more sense to discuss them after discussing Existential types.
2020-08-31 09:59:55 -07:00
Varun Gandhi
907b89c8f7 [docs] Clarify wording around adding new associatedtypes to protocols. 2020-08-29 11:14:57 -07:00
swift_jenkins
fb86a758ff Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-28 08:47:16 -07:00
tbkka
c98d89543c Expanded discussion of protocol types (#33621)
* AnyObject behaves as if every class type implicitly conformed to it as a protocol.

* Protocols "inherit" from other protocols, and this has implications for casting to existential metatypes

I also moved the Any self-conformance invariant
to the self-conformance subsection and added a
couple of explanatory sentences.
2020-08-28 08:44:02 -07:00
Joe Groff
f588f2f478 Merge pull request #33650 from jckarter/global_init_mangling
Remove hardcoded symbol name parsing from SILOptimizer passes
2020-08-28 08:34:35 -07:00
swift_jenkins
dd0da19d0d Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-27 19:27:44 -07:00
Ole Begemann
6e8ee7cc49 [docs] Fix small mistake in DynamicCasting.md (#33641)
Foundation has no `Number` type.
2020-08-27 19:10:37 -07:00
Joe Groff
0bef4a661b Give global once symbols stabler manglings.
This allows symbol ordering and other analyses to be more robust with regards to these symbols.
2020-08-27 16:00:20 -07:00
swift_jenkins
0d5419783f Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-17 13:46:31 -07:00
tbkka
4c684d7a76 DynamicCast Rework, Part 1: Specification (#33010)
A specification for Swift's dynamic casting operations.

This specification tries to reflect the _intent_ of the current implementation, defining a consistent behavior that reflects as far as possible the behavior of the current implementation.  Deviations from this specification will generally be treated as bugs in the current implementation.
2020-08-17 13:37:57 -07:00
swift_jenkins
9ab003bcf9 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-14 15:14:01 -07:00
Marcel Hlopko
cb537b41fb [cxx-interop] Import typedef-ed template instantiations #32950 (#33451)
This is a roll-forward of https://github.com/apple/swift/pull/32950, with explicit c++17 version removed from tests. This is not needed since C++17 is the default anyway.

--

In this PR we teach `ClangImporter` to import typedef statements with template instantiation as its underlying type.

```c++
template<class T>
struct MagicWrapper {
  T t;
};

struct MagicNumber {};

typedef MagicWrapper<MagicNumber> WrappedMagicNumber;
```

will be made available in Swift as if `WrappedMagicNumber` is a regular struct. 

In C++, multiple distinct typedeffed instantiations resolve to the same canonical type. We implement this by creating a hidden intermediate struct that typedef aliasses.

The struct is named as `__CxxTemplateInst` plus Itanium mangled type of the instantiation. For the example above the name of the hidden struct is `__CxxTemplateInst12MagicWrapperI11MagicNumberE`. Double underscore (denoting a reserved C++ identifier) is used to discourage direct usage. We chose Itanium mangling scheme because it produces valid Swift identifiers and covers all C++ edge cases.

Imported module interface of the example above:

```swift
struct __CxxTemplateInst12MagicWrapperI11MagicNumberE {
  var t: MagicNumber
}
struct MagicNumber {}
typealias WrappedMagicNumber = __CxxTemplateInst12MagicWrapperI11MagicNumberE
```

We modified the `SwiftLookupTable` logic to show hidden structs in `swift_ide_test` for convenience.

Co-authored-by: Rosica Dejanovska <rosica@google.com>
Co-authored-by: Dmitri Gribenko <gribozavr@gmail.com>
Co-authored-by: Robert Widmann <devteam.codafi@gmail.com>
2020-08-14 20:51:16 +02:00
Meghana Gupta
6b61818fff Revert "[cxx-interop] Import typedef-ed template instantiations (#32950)"
This reverts commit 643aa2d896.
2020-08-12 12:37:13 -07:00
Marcel Hlopko
643aa2d896 [cxx-interop] Import typedef-ed template instantiations (#32950)
In this PR we teach `ClangImporter` to import typedef statements with template instantiation as its underlying type.

```c++
template<class T>
struct MagicWrapper {
  T t;
};

struct MagicNumber {};

typedef MagicWrapper<MagicNumber> WrappedMagicNumber;
```

will be made available in Swift as if `WrappedMagicNumber` is a regular struct. 

In C++, multiple distinct typedeffed instantiations resolve to the same canonical type. We implement this by creating a hidden intermediate struct that typedef aliasses.

The struct is named as `__CxxTemplateInst` plus Itanium mangled type of the instantiation. For the example above the name of the hidden struct is `__CxxTemplateInst12MagicWrapperI11MagicNumberE`. Double underscore (denoting a reserved C++ identifier) is used to discourage direct usage. We chose Itanium mangling scheme because it produces valid Swift identifiers and covers all C++ edge cases.

Imported module interface of the example above:

```swift
struct __CxxTemplateInst12MagicWrapperI11MagicNumberE {
  var t: MagicNumber
}
struct MagicNumber {}
typealias WrappedMagicNumber = __CxxTemplateInst12MagicWrapperI11MagicNumberE
```

We modified the `SwiftLookupTable` logic to show hidden structs in `swift_ide_test` for convenience.

Resolves https://bugs.swift.org/browse/SR-12591.

Co-authored-by: Rosica Dejanovska <rosica@google.com>
Co-authored-by: Dmitri Gribenko <gribozavr@gmail.com>
Co-authored-by: Robert Widmann <devteam.codafi@gmail.com>
2020-08-12 16:54:22 +02:00
swift-ci
3096012cec Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-10 08:43:32 -07:00
Gabriel Igliozzi
ccd82a0589 [Gardening] Fixed 404 in SIL and SIL Optimizations -> HighLevelSILOptimizations.rst (#33384) 2020-08-10 16:31:48 +01:00
swift-ci
1490315a84 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-10 00:03:35 -07:00
Marcel Hlopko
008cc3c2ea Document conventions for constructing names in mangling docs (#33203)
Co-authored-by: Robert Widmann <devteam.codafi@gmail.com>
Co-authored-by: Dmitri Gribenko <gribozavr@gmail.com>
2020-08-10 08:50:05 +02:00
swift-ci
b08ba77dea Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-07 19:03:48 -07:00
swift-ci
85dccde7b6 Merge pull request #33375 from rxwei/reword-manifesto 2020-08-07 19:03:22 -07:00
Richard Wei
ab4cdc12dc [Docs] [AutoDiff] Improve wording in various places in the manifesto. 2020-08-07 15:42:24 -07:00
swift-ci
95654b453e Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-07 00:03:49 -07:00
Mishal Shah
b98085d69e [Doc] Update CI trigger for CentOS and Ubuntu 2020-08-06 23:44:28 -07:00
swift-ci
aad1e2e518 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-05 19:23:49 -07:00
Gabriel Igliozzi
3ad98a504c [Docs] Fix broken url and filename (#33318) 2020-08-06 03:12:38 +01:00
swift-ci
0bd029cce2 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-08-05 09:55:55 -07:00
Suyash Srijan
3502e07bf0 [Mangling] Add a new mangling for opaque return type to use when mangling an ObjC runtime name (#33035)
* [Mangling] Add a new mangling to represent opaque return type for ObjC runtime name

* [Docs] Add the new 'Qu' mangling to 'Mangling.rst' document

* [Test] Update test invocation arguments
2020-08-05 05:03:45 +01:00
swift-ci
0d8e3e1d71 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-29 09:14:39 -07:00
Doug Gregor
f6e9f352f0 [Concurrency] Add async to the Swift type system.
Add `async` to the type system. `async` can be written as part of a
function type or function declaration, following the parameter list, e.g.,

  func doSomeWork() async { ... }

`async` functions are distinct from non-`async` functions and there
are no conversions amongst them. At present, `async` functions do not
*do* anything, but this commit fully supports them as a distinct kind
of function throughout:

* Parsing of `async`
* AST representation of `async` in declarations and types
* Syntactic type representation of `async`
* (De-/re-)mangling of function types involving 'async'
* Runtime type representation and reconstruction of function types
involving `async`.
* Dynamic casting restrictions for `async` function types
* (De-)serialization of `async` function types
* Disabling overriding, witness matching, and conversions with
differing `async`
2020-07-27 18:18:03 -07:00
Nathan Hawes
b0a2230860 Manually merge remote-tracking branch 'upstream/master' into merge-in-master 2020-07-27 09:25:01 -07:00
Meghana Gupta
b34791a0a0 Update code as per Apple Style Guide
whitelist -> allowlist
blacklist -> denylist
2020-07-24 11:37:15 -07:00
swift-ci
4d29897ac3 Merge remote-tracking branch 'origin/master' into master-rebranch 2020-07-21 08:05:28 -07:00
nate-chandler
98253ae69c Merge pull request #32354 from nate-chandler/generic-metadata-prespecialization-components/crossmodule-structs-enums
[metadata prespecialization] Cross-module: structs and enums.
2020-07-21 08:04:00 -07:00
Nathan Hawes
9d4ed5f39c Manually merge remote-tracking branch 'upstream/master' into manually-merge-master-to-master-rebranch 2020-07-20 16:09:55 -07:00
Robert Widmann
1db4120f48 Merge pull request #32731 from compnerd/sealed
docs: make Windows build instructions fully self-contained
2020-07-17 12:54:55 -07:00
Dan Zheng
f3685f9a12 [AutoDiff] Conform Optional to Differentiable. (#32948)
Make `Optional` conditionally conform to `Differentiable` when the `Wrapped` type does.
`Optional.TangentVector` is a wrapper around `Wrapped.TangentVector?`.

Also, fix `Array.TangentVector.zeroTangentVectorInitializer`.

Resolves TF-1301.
2020-07-17 12:07:52 -07:00