Skip to content

[5.1] [stdlib] Revise CollectionDifference documentation #24691

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed

Conversation

natecook1000
Copy link
Member

This is a cherry pick of #24675.

gottesmm and others added 30 commits April 25, 2019 19:49
…r49882071

[5.1][cast-opt] Eliminate a leak along the cast failure path when bridging…
This is necessary because:

```
func foo() -> some P
func foo() -> some P
```

theoretically defines two distinct return types, but there'd be no way to disambiguate them. Disallow overloading only by opaque return type.
…fix-it-lazy-5.1

[5.1] [CSDiagnostics] Removes lazy when applying computed property fix-it
* [Accelerate] [Quadrature] New Quadrature Overlay (swiftlang#23127)

* [Accelerate] [Quadrature] New Quadrature Overlay

A class that simplifies approximating the definite integral of a function.

* Fixes in response to PR Review.

Change `@_exported import Accelerate` to `import Accelerate`.
Correct date in copyright comment.

* Code Review Fixes.

* Remove mutable integrator, simply set options in init().
* Remove mutable `maxIntervals` and `qagPointsPerInterval`.
* Update tests.

* Code Review Fixes.

* Use standard library `Result`.
* Implement `QAGPointsPerInterval` as a struct.

* Tidy up Passing Integrand to `quadrature_integrate_function`.

Pass the integrand closure directly to the `quadrature_integrate_function` initialiser rather than attaching as a property of the `Quadrature` class.

* Make `Quadrature` a struct, and remove requirement for `integrand` to be escaping.

* Code Review Changes

* Add long-form integrator algorithm aliases (update tests to use these aliases).
* Make quadrature error description public.
* New tests for error description and `QAGPointsPerInterval`.

* Vectorized Integrand for Quadrature

Create an alternative implementation of `integrate` that accepts an integrand of type `(_ input: UnsafeBufferPointer<Double>, _ result: UnsafeMutableBufferPointer<Double>)`.

* Vectorized Integrand for Quadrature

Create an alternative implementation of `integrate` that accepts an integrand of type `(_ input: UnsafeBufferPointer<Double>, _ result: UnsafeMutableBufferPointer<Double>)`.

* Vectorized Integrand for Quadrature

Remove _ContiguousCollection - it's no longer used.

* Delete ContiguousCollection.swift

Not required.

* Refactor tests.

* Accelerate vForce (swiftlang#24152)

* [Accelerate] [vForce] New vForce Overlay

This PR contains a suite of overlays to the vForce transcendental and trigonometric functions on vectors of any length. The overlays simplify the API to the existing functions and accept collections that implement a new protocol called AccelerateBuffer. Conformances are provided for the most useful stdlib Collections.

* Merge pull request swiftlang#24184 from FlexMonkey/Accelerate_Swift-vDSP-Overlays

* Fix a case where vDSP is missing a cast (swiftlang#24197)

* Add missing cast to new vDSP_FIR overlay.

* Use macOS instead of OSX in availability annotations.

* Reorder Accelerate/CMakeLists.txt alphabetically.

* [Accelerate] [vImage] Swift Overlays (swiftlang#23592)

* Accelerate vImage Swift Overlays

A suite of functions, enumerations, and option sets to make working with vImage in Swift simpler.

* vImage_Buffer - new initializers to instantiate and initialize buffers with a single function call.
* vImage_Buffer - new functions to copy buffers and create CGImage instances from contents.
* vImage_CGImageFormat - new initializers.
* vImage_CGImageFormat - new equivalence operator.
* vImageConverter - methods to wrap free functions.
* vImageConverter - new make and convert functions.
* vImageCVImageFormat - new make functions.
* vImageCVImageFormat - methods to wrap free functions.
* vImage_Error - errorDescription function.
* vImage flags as an option set.

* Add new methods for generating CV -> CG and CG -> CV converters.

* update comments: `height` and `width` to `size`.

* `vImage_CGImageFormat.componentCount` should be `Int`.

* `vImage_CGImageFormat.componentCount` should be `Int`

* Move `self.init()` to after the size check for kvImageNoAllocate init.

* Buffer initializers to width and height rather than size.

* change vImage_CGImageFormat lightweight initializer to accept Int for `bitsPerComponent` and `bitsPerPixel`.

* Flesh out docs for vImage_Buffer.size

* Remove faux initializer in favor of new static function: `preferredAlignmentAndRowBytes`.

* Change functions to use proper error handling rather than inout error codes.

* Removed `flags` from basic init.

The only real flag to pass here is print diagnostics to console, and I now throw proper errors.

* Tests to check error throwing for buffer copy.

* remove unnecessary import, add missing docs.

* Add comments to error enums.

* Fix bug creating string from format code.

* Make `vImageCVImageFormat.formatCode` a `UInt32`.

* Remove equivalence operator from `CGImageFormat`.

* [Accelerate] [vDSP] DFT, FFT, DCT, and Biquad (swiftlang#24207)

* Swift overlay to vDSP cascaded biquad IIR filter.

* update comment in test

* Swift overlay to vDSP Discrete Cosine Transform

* Swift Overlays to vDSP Fast Fourier Transform and Discrete Fourier Transform

* Tests for DFT and FFT

* Some refactoring and begin documentation.

* Swift overlays to FFT and DFT operations.

* Expand docs.
* Implement `vDSP_destroy_fftsetup` and `vDSP_destroy_fftsetupD`

* Refactor Tests

* Refactor Tests

* Provide transform function that returns the result. Refactoring: parameter names more consistent with other vDSP operations, push `fileprivate` symbols to bottom of file.

* Add apply() function that returns the result.

* Added a version of DFT transform that returns the result.

* update some DFT comments

* Remove FFT overlays from this branch to separate DFT and FFT pull requests.

* [Accelerate] [vDSP] Swift Overlays to FFT Operations

This PR contains Swift overlays to simplify performing 1D and 2D fast Fourier transforms on single- and double-precision data.

This PR includes a subset of the operations (e.g. vDSP_fft_zrop for FFT). My plan is to add the additional operations (e.g. multiple signals, in-place operations, etc.) in a subsequent PR once this is approved.

cc: @moiseev @airspeedswift @stephentyrone

* Composite Branch

Contains FFT, DFT, DCT, and Biquad branches.

* Merge pull request swiftlang#24232 from stephentyrone/veclib-enum-availability

* Merge pull request swiftlang#24275 from stephentyrone/disable-broken-vImage-test

Temporarily disable a new vImage test that's failing for some platforms.

* Remove magic-symbols-for-install-name.c from Accelerate CMakeLists.txt

This file exists on master but not on 5.1.

* Apparently GYB_SOURCES hasn't made it onto 5.1.

* Slice should only conform to AB when the Base conforms to AB.
XFAIL the vImage test, as it's falling over for arm64.
…result-types

[5.1][SourceKit] SourceKit support for opaque result types
Previously, it did't take super class constraint into account.

rdar://problem/50113513
(cherry picked from commit 6126665)
In addition to brace statements (previously handled), several other
statements allow a trailing closure (return, yield, throw). Also fix the
handling of statements nested within expressions for closures - both
single-expression bodies and brace statements.

This also fixes a particular regression caused by single-expression
function bodies where we would fail to expand to a trailing closure when
a function body only contained a single expression.

rdar://50227500

Conflicts:
	test/SourceKit/CodeExpand/code-expand.swift
[5.1][Foundation] Modernize hashing in Foundation's Swift-only types
Detect situations where key path doesn't have capability required
by the context e.g. read-only vs. writable, or either root or value
types are incorrect e.g.

```swift
struct S { let foo: Int }
let _: WritableKeyPath<S, Int> = \.foo
```

Here context requires a writable key path but `foo` property is
read-only.

(cherry picked from commit 94977ee)
[Typechecker] Allow bridging of Unmanaged to Objective-C for throwing functions
…loc_ref_dynamic

If the initializer witnesses a protocol requirement, the protocol witness
thunk references the allocating entry point directly, since it has no
vtable entry. For this reason we must use alloc_ref_dynamic and not
alloc_ref to ensure the right type of instance is allocated.

Fixes <rdar://problem/49560721>, <https://bugs.swift.org/browse/SR-10285>.
…onstructors

Previously we would emit an alloc_ref_dynamic followed by a call
of the initializing entry point when calling an @objc dynamic
initializer in a class.

However this is unnecessary now that the allocating entry point
does the right alloc_ref_dynamic.
These were recorded but never emitted. Fixes rdar://problem/50258536.
…to a CMake cache variable in cmake/modules/StandaloneOverlay.cmake

(cherry picked from commit 4cddfcc)
…t-availability-5.1

[5.1] Correct availability for opaque type execution test.
…king-5.1

[5.1] Sema: don't consider opaque types distinct for overloading purposes.
[5.1] [placeholder-expansion] Expand trailing closure in statements correctly
…-category-test-10.9-xfail-5.1

[5.1][Tests] XFAIL objc_class_resilience Category test on OS X 10.9.
…built-modules (swiftlang#24321)

By default, prebuilt modules will live in
<resource-dir>/<platform>/prebuilt-modules, so make this explicit if it wasn't
passed in explicitly.
…s-for-keypath-5.1

[5.1][TypeChecker] Improve contextual mismatch diagnostics for key path
They assume bitwise reproducible results for vDSP calls, but don't align
the buffers they are working with enough to guarantee that will occur.

These tests should be updated to use the new approximate comparison stuff
once it becomes available, or otherwise revised.

fixes: <rdar://problem/50301438>
…e-5.1

XFAIL all the Accelerate tests for 5.1 branch.
…aque-descriptors-5.1

[5.1] [IRGen] Emit lazy opaque type descriptors.
mikeash and others added 27 commits May 8, 2019 17:51
…Availability.h.

While we're in there, make SwiftReflectionTest's debugLog function take an @autoclosure so we don't waste a ton of time constructing log messages that are never logged.
…-pointer-size-fix-5.1

[5.1][Reflection] Switch Remote Mirror back to uintptr_t for pointers on watchOS.
…zer_fixes-5.1

[5.1] Opaque specializer fixes
swift_getInitializedObjCClass called [c class] to trigger class initialization, and returned the value. This wreaked havoc when the class in question overrides +class. Instead, ignore the return value and return c. Switch from +class to +self, which is much less likely to be overridden. Calling an overridden method could have performance downsides or even cause unwanted side effects.

rdar://problem/49853091
…d-index-alias

[5.1] stdlib: Fix ReversedIndex compatibility alias
Follow-up cleanup to simplify code related to diagnosing of
opaque return type conformance mismatches.

(cherry picked from commit 83d6f02)
Diagnose extraneous use of address of (`&`) which could only be
associated with arguments to `inout` parameters e.g.

```swift
struct S {}

var a: S = ...
var b: S = ...

a = &b
```

(cherry picked from commit 3af163a)
…unctions

Diagnose an attempt return something from a function which
doesn't have a return type specified e.g.

```swift
func foo() { return 42 }
```

(cherry picked from commit 4f63c4a)
Now covers following new areas (alongside simple assignments):

- Contextual type coercions:
  - In assignment e.g. `let _: X = foo`
  - In return type positions e.g. `func foo() -> A { return bar }`

- Argument-to-parameter applications (including @autoclosure)

(cherry picked from commit cb3252e)
…struggle-5.1

[5.1][Runtime] Avoid +class overrides when initializing an ObjC class.
… shimming object_getClass()

(cherry picked from commit 96a9326)
…rt-swiftmodule

[5.1][CodeCompletion] Complete Swift only module name after 'import'
Previously 'isSystemModule()' returns true only if the module is:
- Standard library
- Clang module and that is `IsSystem`
- Swift overlay for clang `IsSystem` module

Now:
- Clang module and that is `IsSystem`; or
- Swift overlay for clang `IsSystem` module
- Swift module found in either of these directories:
  - Runtime library directoris (including stdlib)
  - Frameworks in `-Fsystem` directories
  - Frameworks in `$SDKROOT/System/Library/Frameworks/` (Darwin)
  - Frameworks in `$SDKROOT/Library/Frameworks/` (Darwin)

rdar://problem/50516314
(cherry picked from commit d3d30ee)
[5.1] Use the Swift runtime's (faster) class check in the stdlib instead of shimming object_getClass()
…porovements-5.1

[5.1][Diagnostics] Assorted diagnostics imporovements
…oh-5.1

[5.1] Avoid the overhead of looking up the current CFAllocator in String bridging
…ftonly-system-module

[5.1][Serialization] Support Swift only system module
This allows _swift_getClassOfAllocated to use a constant instead of loading from a global, and allows swift_isaMask to be computed without a static initializer. Debug builds verify that the #define matches the value from libobjc.

rdar://problem/22375602 rdar://problem/46385113
* Drop @inline(__always) from Accelerate overlay; it doesn't do what you want. (swiftlang#24641)

@inline(__always) does not imply inlinable, which means that it effectively does nothing in the context of the Accelerate overlay. I have replaced all of these with @inlinable where that can be done as a one-line change. Functions that switch over open enums and more complex API (DCT, DFT, FFT) will require more sophisticated corrections, which we can undertake in later commits. For now, they have been rolled back to simply being normal public API.

* Also apply @inlinable to AccelerateBuffer default implementations.
XFAIL ParsableInterface/verify_all_overlays.py
[5.1] XFAIL ParsableInterface/verify_all_overlays.py
…k-5.1

[5.1][Runtime] Use a #define for the value of swift_isaMask.
@natecook1000
Copy link
Member Author

Wrong branch!

@natecook1000 natecook1000 deleted the nc_51a_collectiondifference branch August 29, 2019 19:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.