Commit Graph

7762 Commits

Author SHA1 Message Date
Benedicto Hong
5b30f78b53 [stdlib] Fix typos in Dictionary.swift
Hi, I fixed several typos in Dictionary.swift file(#Line: 347, 1194).

- origin comments
```swift
// #347
// Prints "The 'star' image is a glyph.")

// #1194
// Prints "No value found for that key.""
```

- changed comments
```swift
// #347
// Prints "The 'star' image is a glyph.")  // I thought the ' ) ' character was unnecessary, so I removed it.

// #1194
// Prints "No value found for that key.""  // I thought the ' " ' character was unnecessary, so I removed it.
```
2024-08-29 20:31:59 +09:00
Mykola Pokhylets
e0ad7bde82 Merge branch 'main' into mpokhylets/isolated-deinit
# Conflicts:
#	include/swift/Basic/Features.def
#	lib/AST/ASTPrinter.cpp
#	lib/AST/FeatureSet.cpp
2024-08-29 11:28:43 +02:00
Allan Shortlidge
51143aa8ea stdlib: Upstream _stdlib_isOSVersionAtLeast_AEIC().
In the standard library shipped in Apple's SDKs and OSes, the implementation of
`_stdlib_isOSVersionAtLeast()` has diverged in order to solve some tricky
issues related to supporting iOS applications running on macOS. It's now time
to bring that change upstream in order to unblock further changes that depend
on it.

Originally introduced to resolve rdar://83378814.
2024-08-28 22:07:59 -07:00
정훈
193a3063dc [stdlib] Fix the indentation from 1 space to 2 spaces in ArraySlice.swift 2024-08-27 09:01:54 +09:00
Changhyun-Kyle
1b97c574a4 [stdlib] Fix typo in Collection.swift 2024-08-26 18:53:05 +09:00
Kuba Mracek
555ca3bcec [embedded] Make assert helper functions always inlined to avoid trap basic blocks from merging 2024-08-21 15:03:46 -07:00
Mykola Pokhylets
0412597731 Added swift_retainCount to EmbeddedRuntime.swift
Fixes test/embedded/concurrency-actors.swift
2024-08-19 23:41:33 +02:00
Doug Gregor
8378562e12 Adopt @unsafe throughout the standard library
Annotate all of the `Unsafe*` types and `unsafe` functions in the standard
library (including concurrency, synchronization, etc.) as `@unsafe`. Add a
few tests to ensure that we detect uses of these types in clients that
have disabled unsafe code.
2024-08-19 14:33:09 -07:00
Doug Gregor
f8d483da0e Restore comment accidentally removed in typed throws adoption 2024-08-16 14:10:08 -07:00
Doug Gregor
8760b7caad Consistently use @usableFromInline and remove redundant @inlinables 2024-08-16 13:03:07 -07:00
Doug Gregor
45a44a7d01 Use @_alwaysEmitIntoClient for new entrypoints 2024-08-16 11:13:19 -07:00
Doug Gregor
4d037ce6ef Adopt typed throws for withUnsafeMutableBufferPointer 2024-08-16 11:13:19 -07:00
Doug Gregor
5c07fd9502 Adopt typed throws in withUnsafeBufferPointer.
Part of rdar://131405937.
2024-08-16 11:13:18 -07:00
Guillaume Lessard
79bf5d51ca Merge pull request #75782 from glessard/rdar133343460-incorrectly-sendable
[stdlib] fix sendability of ManagedBufferPointer
2024-08-08 16:28:19 -07:00
Kuba (Brecka) Mracek
f9631e121c Merge pull request #75768 from kubamracek/embedded-string-switch
[embedded] Add StringSwitch.swift to the embedded stdlib
2024-08-08 15:28:22 -07:00
Guillaume Lessard
f9eb3223fe [stdlib] mark ManagedBufferPointer non-Sendable 2024-08-08 11:26:30 -07:00
Alex Martini
906efcbe93 Merge pull request #75625 from amartini51/param_132944086
Match parameter names in documentation to declaration

Fixes: rdar://132944086
2024-08-08 09:22:11 -07:00
Kuba Mracek
3c9f1ebb55 [embedded] Add StringSwitch.swift to the embedded stdlib 2024-08-07 21:37:01 -07:00
Alex Martini
d0d15167d3 Add missing "parameters" directive
Co-authored-by: Ben Rimmington <me@benrimmington.com>
2024-08-07 11:07:54 -07:00
Guillaume Lessard
29a4b8abff Merge pull request #75622 from glessard/rdar132941798-aEIC-private-consternation 2024-08-06 20:31:04 -07:00
Allan Shortlidge
41fad31e64 stdlib: Add runtime support for zippered availability checks.
Now that `__isPlatformOrVariantPlatformVersionAtLeast()` is available in
upstream LLVM, the implementation of the zippered variant of the OS version
check utility can use the `targetOSVersionOrVariantOSVersionAtLeast` builtin
safely.

Resolves rdar://103960437.
2024-08-02 10:25:40 -07:00
Ben Rimmington
28e1fdf919 [stdlib] Remove _FixedArray16 from GroupInfo.json (#75631) 2024-08-01 19:54:09 -07:00
Guillaume Lessard
dd854faad1 [stdlib] use temporary rebinding as appropriate 2024-08-01 16:26:34 -07:00
Guillaume Lessard
a77b8cea70 [stdlib] alter inconsistent declarations
`private` declarations should never be allowed to carry the `@_alwaysEmitIntoClient` attribute. This has been allowed by mistake for a while, but newer compilers should make this an error.
2024-08-01 16:26:34 -07:00
Alex Martini
63323e04a9 Match parameter names in docs to the declaration 2024-08-01 11:01:02 -07:00
Karoy Lorentey
56bcc8dc83 [stdlib] Remove _FixedArray16
We are no longer using this internal type; remove it from the stdlib.
2024-07-30 16:14:05 -07:00
Philippe Hausler
5b20f7d10f [Embedded] Correct the signature of free to avoid using Builtin module for potential client implementations (#75496) 2024-07-30 11:59:24 -07:00
Dave Lee
abe697ff72 [Debug] Rename DebugDescription fallback property to lldbDescription (#75305)
From feedback, replace the name `_debugDescription`, which was confusing because of the 
underscore, with `lldbDescription`. This new name also indicates that this property may 
contain [LLDB Summary Strings](https://lldb.llvm.org/use/variable.html#summary-strings).
2024-07-29 11:10:43 -07:00
Xiaodi Wu
ea1baed83a Address 128-bit integer comparison type inference issue (#75529) 2024-07-28 21:38:38 -07:00
Ben Rimmington
66e6c009eb [stdlib] Move unused functions to LegacyABI.swift (#75462) 2024-07-27 04:45:31 +01:00
Alex Martini
0958bdd312 Merge pull request #75383 from Jager-yoo/fix-compiler-protocols
[stdlib] Correct documentation formatting in CompilerProtocols
2024-07-26 17:20:33 -07:00
Holly Borla
7d65170614 Merge pull request #75495 from hborla/remove-redundant-sendable-stdlib 2024-07-26 06:38:19 -07:00
Holly Borla
dc3893d9ca [Concurrency] Remove redundant Sendable conformances in the standard library.
These conformances are all redundant because the `Sendable` conformance is
inherited from a superclass.
2024-07-25 21:51:56 -07:00
Dave Lee
e0129799fa [Debug] Add user friendly diagnostic when @DebugDescription is atached to a generic (#75307)
Emit a user friendly diagnostic when `@DebugDescription` is attached to a generic 
definition.
2024-07-25 10:06:47 -07:00
Ben Rimmington
3c855da45d [stdlib] Fix coding style of AdditiveArithmetic (#75461)
Use explicit access modifiers instead of `public extension` inheritance.
2024-07-25 11:30:14 -04:00
Ben Rimmington
fc8cc33777 [stdlib] Update documentation of integer types (#74973)
* [stdlib] Remove docs from default implementations

Customized docs were not removed:

  public static var isSigned: Bool
  public static var max: Self
  public static var min: Self
  public var description: String
  public var magnitude: Self
  public init<T: BinaryInteger>(_ source: T)
  public func distance(to other: Self) -> Int
  public func advanced(by n: Int) -> Self

* [stdlib] Remove unused docs for "unsafe" methods

* [stdlib] Remove inherited "ReportingOverflow" docs

* [stdlib] Remove inherited docs for operators

Customized docs were not removed.
(`+`, `-`, `*`, `+=`, `-=`, `*=`)

Non-inherited docs were not removed.
(`&+`, `&-`, `&+=`, `&-=`, `&*=`)

* [stdlib] Reattach doc comments to their APIs

Use `rstrip()` to remove the trailing newline.
<https://docs.python.org/3/library/stdtypes.html#str.rstrip>

* [stdlib] Remove inherited docs from integer types

* [stdlib] Remove FIXME(ABI) comments

* [stdlib] Remove unused docs for operators

* [stdlib] Update example code for `-=` and `*=`

* [stdlib] Update internal gyb comments

* [stdlib] Move docs to BinaryInteger overrides

* [stdlib] Remove unused gyb code

* [stdlib] Fix `&-` and `&*` examples
2024-07-24 17:31:15 -05:00
Allan Shortlidge
6fb6a56b20 SILGen: Introduce macCatalyst support for if #available.
Upstream the necessary changes to compile `if #available` queries correctly
when a `macabi` target triple or a `-target-variant` is specified.
2024-07-23 17:00:10 -07:00
Mishal Shah
48d5aca28d Revert "Use associated objects to attach contiguous array buffers to lazy one…"
This reverts commit 7c011813f2.
2024-07-21 23:34:57 -07:00
Michael Ilseman
a0bf388bd5 UTF8-validation: speed up findInvalidRange (#75381)
Changes findInvalidRange from being O(n) to O(1).
2024-07-20 07:49:49 -06:00
Jaeho Yoo
ec78f498ec [stdlib] Correct documentation formatting in CompilerProtocols 2024-07-20 22:01:28 +09:00
David Smith
7c011813f2 Use associated objects to attach contiguous array buffers to lazy ones (#75148)
rdar://132124808
2024-07-19 23:21:41 -07:00
Minseong Kim
d5bcdca2b6 fix indentation from 1 space to 2 spaces 2024-07-19 16:41:58 +09:00
Carl Peto
de449c9611 revert atomics for now 2024-07-16 22:39:31 +01:00
Carl Peto
3689427834 [AVR] standard library support for AVR
- when compiling embedded cross compile target standard libraries, include AVR
- add 16-bit pointer as a conditional compilation condition and get the void pointer size right for gyb sources
- attempt to fix clang importer not importing __swift_intptr_t correctly on 16 bit platforms
- changed the unit test target to avr-none-none-elf to match the cmake build

[AVR] got the standard library compiling in a somewhat restricted form:

General
- updated the Embedded Runtime
- tweaked CTypes.swift to fix clang import on 16 bit platforms

Strings
- as discussed in https://forums.swift.org/t/stringguts-stringobject-internals-how-to-layout-on-16-bit-platforms/73130, I went for just using the same basic layout in 16 bit as 32 bit but with 16 bit pointers/ints... the conversation is ongoing, I think something more efficient is possible but at least this compiles and will probably work (inefficiently)

Unicode
- the huge arrays of unicode stuff in UnicodeStubs would not compile, so I skipped it for AVR for now.

Synchronization
- disabled building the Synchronization library on AVR for now. It's arguable if it adds value on this platform anyway.
2024-07-16 12:28:27 +01:00
Nate Cook
846a861660 Improve RangeSet initialization performance (#75089)
When initializing a range set with a group of overlapping, identical,
or empty ranges, the initializer can exhibit poor performance due
to removing the unneeded ranges during processing. This change uses
a partitioning scheme instead, only removing the unnecessary ranges
at the end of initialization.
2024-07-12 15:01:38 -05:00
Allan Shortlidge
14200e412c SILGen/stdlib: Remove _diagnoseUnavailableCodeReached_aeic().
It should no longer be necessary to provide an `@_alwaysEmitIntoClient` version
of `_diagnoseUnavailableCodeReached()`. This workaround was originally added to
provide compatibility with projects that were misconfigured to compile against
a newer stdlib but link against an older one.

Resolves rdar://119892482.
2024-07-11 14:53:03 -07:00
Allan Shortlidge
99dbbe4a12 AST: Promote BuiltinStoreRaw feature to baseline. 2024-07-09 14:28:29 -07:00
Allan Shortlidge
9717961202 AST: Promote BuiltinAllocVector feature to baseline. 2024-07-09 14:28:29 -07:00
Allan Shortlidge
ab99cac77d AST: Promote BuiltinUnprotectedStackAlloc feature to baseline. 2024-07-09 14:28:28 -07:00
Allan Shortlidge
7e4425c97e Merge pull request #75090 from tshortli/no-more-ncg-condfails
AST: Remove `NoncopyableGenerics` feature suppression
2024-07-08 23:03:40 -07:00