Commit Graph

7182 Commits

Author SHA1 Message Date
swift_jenkins
de7ecec04e Merge remote-tracking branch 'origin/main' into next 2022-04-21 19:22:23 -07:00
Jager-yoo
b3de1f3e25 Fix mismatched constant name in static func == doc
- I've found a mismatched constant name in `static func ==` example.
- Given the context, it should be `numberToMatch`, not `numberToFind`.
2022-04-21 19:11:17 +09:00
Alex Martini
59e951ae9c Fix minor wording issues per review feedback
Co-authored-by: Brian Lanier <blanier@apple.com>
2022-04-20 15:53:50 -07:00
swift_jenkins
a461eb25da Merge remote-tracking branch 'origin/main' into next 2022-04-19 21:21:22 -07:00
swift-ci
4184a0bb57 Merge pull request #42096 from kateinoigakukun/pr-24e8c53c23a06f91bc290068f3209e095a88bdcf
[Wasm][KeyPath] Resolve absolute function pointer as identity
2022-04-19 21:08:45 -07:00
swift_jenkins
da01d52532 Merge remote-tracking branch 'origin/main' into next 2022-04-19 20:41:22 -07:00
Karoy Lorentey
2574d78d40 Merge pull request #42442 from lorentey/better-index-conversions 2022-04-19 20:22:06 -07:00
swift_jenkins
093c99483d Merge remote-tracking branch 'origin/main' into next 2022-04-19 15:08:08 -07:00
Josh Soref
644c18ca9b Spelling stdlib (#42444)
* spelling: against

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: algorithmic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: alignment

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: anything

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: architectural

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: architecture

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: are

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: artificial

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: aside

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: available

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: being

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: bidirectional

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: characters

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: circular

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compatibility

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: compiled

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: correctly

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: covers

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: declaration

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dependencies

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: descriptor

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dictionaries

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: dynamic

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: greater

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: hierarchy

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: immortal

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initialize

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: initializes

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: iterable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: message

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: minimum

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: multiple

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: originally

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: simplified

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: sophisticated

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: trivia

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: wasn't

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-19 14:02:43 -07:00
Josh Soref
a0d2cabda6 Spelling stdlib/public/core (#42441)
* spelling: available

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: components

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: conjunction

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: conversion

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: enforce

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: guarantee

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: interchangeable

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: satisfied

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

* spelling: superfluous

Signed-off-by: Josh Soref <jsoref@users.noreply.github.com>

Co-authored-by: Josh Soref <jsoref@users.noreply.github.com>
2022-04-19 14:02:24 -07:00
Karoy Lorentey
3eed5347c7 [stdlib] Update comments 2022-04-19 14:02:13 -07:00
Karoy Lorentey
47109ac8d6 [stdlib] Fix thinko 2022-04-19 13:08:43 -07:00
Karoy Lorentey
847337efd7 [stdlib][cosmetics] Clean up unused/underused interfaces, update naming
There is little point to having `isUTF16` properties when they simply
return `!isUTF8`; remove them.

Rename `String.Index._copyEncoding(from:)` to
`_copyingEncoding(from:)`.
2022-04-18 21:06:20 -07:00
Karoy Lorentey
5f9828fb88 [stdlib] Don’t reject trailing surrogates in UTF16View overload of String.Index(_:within:)
Fix a long-standing issue where the UTF16View overload of
`String.Index.init(_:within:)` used to return nil for valid indices
that happened to point to a trailing surrogate in a UTF-8-encoded
string.

rdar://91935537
2022-04-18 21:03:44 -07:00
Karoy Lorentey
4d557b0b45 [stdlib] Make String.Index(_:within:) initializers more permissive
In Swift 5.6 and below, (broken) code that acquired indices from a
UTF-16-encoded string bridged from Cocoa and kept using them after a
`makeContiguousUTF8` call (or other mutation) may have appeared to be
working correctly as long as the string was ASCII.

Since https://github.com/apple/swift/pull/41417, the
`String(_:within:)` initializers recognize miscoded indices and reject
them by returning nil. This is technically correct, but it
unfortunately may be a binary compatibility issue, as these used to
return non-nil in previous versions.

Mitigate this issue by accepting UTF-16 indices on a UTF-8 string,
transcoding their offset as needed. (Attempting to use an UTF-8 index
on a UTF-16 string is still rejected — we do not implicitly convert
strings in that direction.)

rdar://89369680
2022-04-18 21:02:14 -07:00
swift_jenkins
1652576a53 Merge remote-tracking branch 'origin/main' into next 2022-04-18 15:40:24 -07:00
swift-ci
58c8e2ecd8 Merge pull request #41033 from glessard/se-unaligned
[SE-0349] Implementation for unaligned loads from raw memory
2022-04-18 15:29:52 -07:00
Guillaume Lessard
a368e59564 [stdlib] incorporate proposal number in silgen name 2022-04-18 12:50:19 -06:00
Guillaume Lessard
3229902990 [stdlib] state clearly the precondition of loadUnaligned 2022-04-14 17:23:53 -06:00
Guillaume Lessard
1828aca9f0 [stdlib] update UnsafeMutableRawBufferPointer.storeBytes
- preserve previous version for ABI and source stability.
- add new version without alignment restriction.
- add explicit POD type enforcement in new version.
2022-04-14 17:23:53 -06:00
Guillaume Lessard
4b3e7fa41f [stdlib] add unaligned loads to Unsafe{Mutable}RawBufferPointer 2022-04-14 17:23:53 -06:00
Guillaume Lessard
9716bc5fd2 [stdlib] update UnsafeMutableRawPointer.storeBytes
- preserve previous version for ABI and source stability.
- add new version without alignment restriction.
- add explicit POD type enforcement in new version.
2022-04-14 17:23:53 -06:00
Guillaume Lessard
d9fff5b4ec [stdlib] add unaligned loads to UnsafeRawPointer 2022-04-14 17:23:53 -06:00
swift_jenkins
ceccb031ed Merge remote-tracking branch 'origin/main' into next 2022-04-14 14:21:33 -07:00
Karoy Lorentey
57f0e67658 Merge pull request #41417 from lorentey/the-horror-of-se-0180
[stdlib] Fix String indexing edge cases, anomalies & validation bugs
2022-04-14 14:08:53 -07:00
Karoy Lorentey
c67f08b2af [stdlib][NFC] Remove obsolete note 2022-04-13 19:15:42 -07:00
Karoy Lorentey
cb2194c024 [stdlib] Fix ABI and portability issues 2022-04-13 19:15:30 -07:00
Karoy Lorentey
89d69a9467 [stdlib] Revert noop change 2022-04-13 18:39:14 -07:00
Karoy Lorentey
b33fefb71c [stdlib] String: be more consistent about when markEncoding is called 2022-04-13 18:38:41 -07:00
swift_jenkins
7f6782fbc3 Merge remote-tracking branch 'origin/main' into next 2022-04-13 15:01:54 -07:00
Daniel Duan
3dfc40898c [NFC] Remove Python 2 imports from __future__ (#42086)
The `__future__` we relied on is now,  where the 3 specific things are
all included [since Python 3.0](https://docs.python.org/3/library/__future__.html):

* absolute_import
* print_function
* unicode_literals
* division

These import statements are no-ops and are no longer necessary.
2022-04-13 14:01:30 -07:00
swift_jenkins
4639b57530 Merge remote-tracking branch 'origin/main' into next 2022-04-13 12:19:40 -07:00
Alex Martini
06cbc7e4c4 Merge pull request #42318 from amartini51/UnsafeMutableRawBufferPointer_missing_parameter
Add missing parameter in `UnsafeMutableRawPointer`
2022-04-13 11:48:30 -07:00
swift_jenkins
06c023ff86 Merge remote-tracking branch 'origin/main' into next 2022-04-12 21:21:29 -07:00
Alex Martini
395a4b29be Add missing parameter.
Here, as in UnsafeMutableRawPointer.storeBytes(of:toByteOffset:as:)
"as" is an argument label and "type" is the parameter.

Because the function body doesn't use this -- it's just for type
information -- changing its name from "as" to "type" doesn't have
any impact there.
2022-04-11 16:50:01 -07:00
Alex Martini
2774f3dedc Call out unsafe-sendable structs & enums. 2022-04-11 16:37:26 -07:00
Alex Martini
c9bdda9cba Add discussion of metatypes.
Co-authored-by: Doug Gregor <dgregor@apple.com>
2022-04-11 16:31:16 -07:00
Alex Martini
c4b6f4bb8b Format bulleted lists the same throughout. 2022-04-11 16:30:23 -07:00
Alex Martini
32e0825068 Revise per tech review feedback.
Co-authored-by: Doug Gregor <dgregor@apple.com>
2022-04-11 16:23:39 -07:00
Karoy Lorentey
ed7d60c711 [stdlib] Remove unused fn 2022-04-11 14:03:01 -07:00
Alex Martini
0089134307 Apply suggestions from tech review
Co-authored-by: Doug Gregor <dgregor@apple.com>
2022-04-11 11:01:40 -07:00
Karoy Lorentey
dcfc26cbc5 [stdlib][NFC] Doc adjustments 2022-04-10 16:57:44 -07:00
Karoy Lorentey
d3df05cb30 [stdlib] String.Index: Remove custom printing 2022-04-10 16:51:51 -07:00
Karoy Lorentey
bbb004854e [stdlib] Minor enhancements 2022-04-10 16:49:01 -07:00
Alejandro Alonso
5fe6a7e247 Add caseFolded to scalar properties 2022-04-10 13:03:13 -07:00
Karoy Lorentey
67adcabefc Apply notes from code review 2022-04-10 00:14:43 -07:00
Karoy Lorentey
58ab3fea34 Apply suggestions from code review
Co-authored-by: Alejandro Alonso <alejandro_alonso@apple.com>
2022-04-10 00:14:43 -07:00
Karoy Lorentey
3c9968945e [stdlib] String: Implement happy paths for index validation 2022-04-10 00:14:43 -07:00
Karoy Lorentey
d18b5f573f [stdlib] Branchless _StringGuts.hasMatchingEncoding 2022-04-09 21:33:53 -07:00
Karoy Lorentey
eadef7a204 [stdlib] String.Index: Use symbolic names rather than magic constants 2022-04-09 21:33:53 -07:00