Commit Graph

52 Commits

Author SHA1 Message Date
Artem Chikin
1f14158a1d Introduce VisionOS Platform
This change introduces a new compilation target platform to the Swift compiler - visionOS.

- Changes to the compiler build infrastrucuture to support building compiler-adjacent artifacts and test suites for the new target.
- Addition of the new platform kind definition.
- Support for the new platform in language constructs such as compile-time availability annotations or runtime OS version queries.
- Utilities to read out Darwin platform SDK info containing platform mapping data.
- Utilities to support re-mapping availability annotations from iOS to visionOS (e.g. 'updateIntroducedPlatformForFallback', 'updateDeprecatedPlatformForFallback', 'updateObsoletedPlatformForFallback').
- Additional tests exercising platform-specific availability handling and availability re-mapping fallback code-path.
- Changes to existing test suite to accomodate the new platform.
2024-04-10 09:38:02 -07:00
Mike Ash
ea6a2e26f2 [Test] Remove stdlib/NSStringAPI.swift and some supporting code.
This is testing the Foundation overlay, which is no longer part of the Swift project.
2023-07-12 12:18:58 -04:00
Mike Ash
798edb9d0e [Runtime][Stdlib][Overlays] Rename various Objective-C classes and methods that would conflict when loading old Swift libraries into a process alongside ABI-stable libraries.
rdar://problem/35768222
2018-09-13 16:55:10 -04:00
Ben Cohen
345879429b [stdlib] Take several underscored stdlib functions private (#18134)
* Make _sanityCheck internal

* Make _debugPrecondition internal

* Make Optional._unsafelyUnwrappedUnchecked internal.

* Make _precondition internal

* Switch Foundation _sanityChecks to assertions

* Update file check tests

* Remove one more _debugPrecondition

* Update Optimization-with-check tests
2018-07-24 18:26:19 -07:00
Karoy Lorentey
c7da0f3184 [stdlib] StdlibUnittestFoundationExtras: fix warnings 2018-07-05 16:02:51 +01:00
Karoy Lorentey
91bb2c0a6c [test] check getObjects:andKeys:count: implementations in bridged Dictionaries 2018-07-05 15:52:11 +01:00
Slava Pestov
e1f50b2d36 SE-0193: Rename @_inlineable to @inlinable, @_versioned to @usableFromInline 2018-03-30 21:55:30 -07:00
Greg Parker
58c9b45c78 [runtime] Clean up symbols in StdlibUnittest and the internal leak checker.
* Export fewer symbols.
* Prefix exported but not-public symbols with `_swift_`.
2017-10-24 13:13:43 -07:00
Kuba (Brecka) Mracek
d03a575279 Unify the capitalization across all user-visible error messages (#11599)
* Unify the capitalization across all user-visible error messages (fatal errors, assertion failures, precondition failures) produced by the runtime, standard library and the compiler.

* Update some more tests to the new expectations.
2017-08-29 12:16:04 -07:00
Greg Parker
9c80b23953 [stdlib] Make StdlibUnittest nullability-agnostic for ObjC runtime functions. 2017-04-28 18:08:41 -07:00
Roman Levenstein
29ad714bb7 Annotate stdlib functions to get a good performance even in resilient mode, when -sil-serialize-all is disabled
This commit mostly improves the performance of arrays and ranges.
It does not cover Strings, Dictionaries and Sets yet.
2017-03-16 19:46:11 -07:00
practicalswift
6d1ae2a39c [gardening] 2016 → 2017 2017-01-06 16:41:22 +01:00
practicalswift
797b80765f [gardening] Use the correct base URL (https://swift.org) in references to the Swift website
Remove all references to the old non-TLS enabled base URL (http://swift.org)
2016-11-20 17:36:03 +01:00
Joe Groff
9b1f238e5b SE-0139: Bridge all standard number types to NSNumber.
Extend NSNumber bridging to cover not only `Int`, `UInt`, `Double`, and `Bool`, but all of the standard types as well. Extend the `TypePreservingNSNumber` subclass to accommodate all of these types, so that we preserve type identity for `AnyHashable` and dynamic casting of Swift-bridged NSNumbers. If a pure Cocoa NSNumber is cast, just trust that the user knows what they're doing.

This XFAILs a couple of serialization tests that attempt to build the Foundation overlay, but which don't properly handle `gyb` files.
2016-09-23 10:34:22 -07:00
Joe Groff
86fbeee285 SE-0139: Bridge Cocoa framework structs to NSValue.
For every struct type for which the frameworks provides an NSValue category for boxing and unboxing values of that type, provide an _ObjectiveCBridgeable conformance in the Swift overlay that bridges that struct to NSValue, allowing the structs to be used naturally with id-as-Any APIs and Cocoa container classes. This is mostly a matter of gyb-ing out boilerplate using `NSValue.init(bytes:objCType:)` to construct the instance, `NSValue.objCType` to check its type when casting, and `NSValue.getValue(_:)` to extract the unboxed value, though there are a number of special snowflake cases that need special accommodation:

- To maintain proper layering, CoreGraphics structs need to be bridged in the Foundation overlay.
- AVFoundation provides the NSValue boxing categories for structs owned by CoreMedia, but it does so using its own internal subclasses of NSValue, and these subclasses do not interop properly with the standard `NSValue` subclasses instantiated by Foundation. To do the right thing, we therefore have to let AVFoundation provide the bridging implementation for the CoreMedia types, and we have to use its category methods to do so.
- SceneKit provides NSValue categories to box and unbox SCNVector3, SCNVector4, and SCNMatrix4; however, the methods it provides do so in an unusual way. SCNVector3 and SCNVector4 are packaged into `CGRect`s and then the CGRect is boxed using `valueWithCGRect:`. SCNMatrix4 is copied into a CATransform3D, which is then boxed using `valueWithCATransform3D:` from CoreAnimation. To be consistent with what SceneKit does, use its category methods for these types as well, and when casting, check the type against the type encoding SceneKit uses rather than the type encoding of the expected type.
2016-09-21 19:26:10 -07:00
practicalswift
fa7fbdb8b0 [gardening] Remove redundant nil-initialization of optional variable
From the Swift documentation:

"If you define an optional variable without providing a default value,
 the variable is automatically set to nil for you."
2016-09-18 07:40:07 +02:00
Dmitri Gribenko
987acd375d stdlib: make tests rely on Array implementation details less 2016-08-07 14:20:36 -07:00
Michael Ilseman
b7c9eddd11 [noescape by default] drop @noescape from stdlib 2016-08-04 16:09:01 -07:00
Dave Abrahams
7ac11087de [stdlib] Minor fixups for SE-0118 implementation 2016-07-19 07:35:46 -07:00
Dave Abrahams
b5bc9be6fb <label> body => _ body 2016-07-19 07:05:53 -06:00
Michael Gottesman
fc37603c5f Revert "Implement SE-0118" 2016-07-18 16:44:58 -07:00
Dave Abrahams
22c8515558 <label> body => _ body 2016-07-18 14:29:08 -06:00
Tony Parker
8e814ac875 New value types for Calendar, TimeZone, and Locale
As part of the extensive work on value types in Foundation this year, we
decided to also add value types for these three key classes. In addition
to adding value semantics, the API was extensively audited to improve
Swift interop (especially Calendar).

rdar://26628184
2016-07-17 09:42:37 -07:00
Andrew Trick
888ff1ae99 Revert "New value types for Calendar, TimeZone, and Locale"
This reverts commit 46a9f57329.

This broke Swift CI, OSS incremental RA:

./swift/stdlib/public/SDK/Foundation/TimeZone.swift:228:45: error: 'NSTimeZone' is not implicitly convertible to 'TimeZone'; did you mean to use 'as' to explicitly convert?
        return lhs._wrapped.isEqual(to: rhs._wrapped)
2016-07-16 18:34:32 -07:00
Tony Parker
46a9f57329 New value types for Calendar, TimeZone, and Locale
As part of the extensive work on value types in Foundation this year, we
decided to also add value types for these three key classes. In addition
to adding value semantics, the API was extensively audited to improve
Swift interop (especially Calendar).

rdar://26628184
2016-07-16 17:58:27 -07:00
Andrew Trick
7b5723b9a5 Revert "New value types for Calendar, TimeZone, and Locale"
This reverts commit 9c1f21bdf0.

This breaks swift-ci for everyone:

stdlib/public/SDK/Foundation/Calendar.swift:426:74: error: 'DateInterval' is only available on iOS 10.0 or newer
    public func dateInterval(of component: Component, for date: Date) -> DateInterval? {
2016-07-16 17:08:06 -07:00
Tony Parker
9c1f21bdf0 New value types for Calendar, TimeZone, and Locale
As part of the extensive work on value types in Foundation this year, we
decided to also add value types for these three key classes. In addition
to adding value semantics, the API was extensively audited to improve
Swift interop (especially Calendar).

rdar://26628184
2016-07-16 15:48:08 -07:00
Michael Gottesman
40e1991e12 Revert "Name and label changes for closure parameters (for review only) (#2981)"
This reverts commit 18406900ba.
2016-07-15 19:45:26 -07:00
Michael Gottesman
ac5a9789e7 Revert "A fix for 33023b389f95d1577ee15a10393a2fcc865472bb"
This reverts commit 220bd9cc5a.
2016-07-15 19:45:25 -07:00
Dave Abrahams
220bd9cc5a A fix for 33023b389f95d1577ee15a10393a2fcc865472bb 2016-07-15 16:04:34 -07:00
Dave Abrahams
18406900ba Name and label changes for closure parameters (for review only) (#2981)
Implement SE-0118 Name and label changes for closure parameters

[SE-0118](https://github.com/apple/swift-evolution/blob/master/proposals/0118-closure-parameter-names-and-labels.md)
2016-07-15 15:31:48 -07:00
Mishal Shah
23b646eed2 Update master to build with Xcode 8 beta 2, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs 2016-07-06 10:48:45 -07:00
Mishal Shah
87b7bcfd3e Update master to build with Xcode 8 beta 1, OS X 10.12, iOS 10, tvOS 10, and watchOS 3 SDKs. 2016-06-14 14:53:55 -07:00
Chris Lattner
4fd8418ba7 move the stdlib to put noescape and autoclosure on the type, instead of
the parameter.  Progress towards SE-0049.
2016-04-14 23:13:43 -07:00
Manav Gabhawala
7928140f79 [SE-0046] Implements consistent function parameter labels by discarding extraneous parameter names and adding _ where necessary 2016-04-06 20:21:58 -04:00
Max Moiseev
7fe6916bf6 Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-03-07 12:10:47 -08:00
Hugh Bellamy
c1b25bb32f [gardening] Remove double new lines from stdlib files 2016-03-05 15:44:54 +00:00
Max Moiseev
40b1a0b7e0 [stdlib] all sorts of require renamed back to precondition 2016-02-19 18:21:29 -08:00
Max Moiseev
39fdbca8d0 making Swift build succesfully after the merge 2016-02-04 16:48:14 -08:00
Max Moiseev
61c837209b Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-02-04 16:13:39 -08:00
Doug Gregor
2a42664129 Use #selector in StdlibUnitTest's Foundation extras 2016-01-28 11:23:14 -08:00
Max Moiseev
f51e708a8f Merge remote-tracking branch 'origin/master' into swift-3-api-guidelines 2016-01-04 12:25:25 -08:00
Zach Panzarino
e3a4147ac9 Update copyright date 2015-12-31 23:28:40 +00:00
Maxim Moiseev
f2f50d6a9d precondition => require 2015-12-16 17:16:08 -08:00
Dmitri Hrybenko
6536edd68c stdlib: fix coding style
Swift SVN r32425
2015-10-03 21:13:15 +00:00
Dave Abrahams
146d2daa9d [stdlib] Add missing nullability to reflected NSString API
getBytes still lacks the ability to take an optional buffer, but Ali
agrees that we can leave that off for this release in light of the fact
that we have lengthOfBytesUsingEncoding.

Swift SVN r31223
2015-08-13 20:11:40 +00:00
Dmitri Hrybenko
8387fc45b5 StdlibUnittest: add a facility to activate autorelease pools only on platforms that don't implement the return-autoreleased optimization
Swift SVN r29295
2015-06-04 09:06:16 +00:00
Dmitri Hrybenko
035d72d5a7 stdlib: protocol extensions: de-underscore contains()
Swift SVN r28236
2015-05-07 00:30:24 +00:00
Doug Gregor
793b3326af Implement the new rules for argument label defaults.
The rule changes are as follows:
  * All functions (introduced with the 'func' keyword) have argument
  labels for arguments beyond the first, by default. Methods are no
  longer special in this regard.
  * The presence of a default argument no longer implies an argument
  label.

The actual changes to the parser and printer are fairly simple; the
rest of the noise is updating the standard library, overlays, tests,
etc.

With the standard library, this change is intended to be API neutral:
I've added/removed #'s and _'s as appropriate to keep the user
interface the same. If we want to separately consider using argument
labels for more free functions now that the defaults in the language
have shifted, we can tackle that separately.

Fixes rdar://problem/17218256.

Swift SVN r27704
2015-04-24 19:03:30 +00:00
Dmitri Hrybenko
ab408d4dc3 Update the compiler and SDK overlay for nullability and generics in Foundation
We have an SPI between the Swift compiler and Foundation based on the
SWIFT_SDK_OVERLAY_FOUNDATION_EPOCH preprocessor macro that allows us to
request the new API.  rdar://20270080 tracks removing it.

Swift SVN r26475
2015-03-24 02:18:06 +00:00