Commit Graph

34 Commits

Author SHA1 Message Date
Nate Cook
f19aca6cb0 [WIP] Revise documentation for Swift 5 stdlib additions (#21333)
* Revise the Unicode scalar/Character properties
* Minor revisions to `compactMapValues` docs.
* Add documentation for AdditiveArithmetic, revise Numeric
* Apply minor style updates to count(where:).
* Revise string interpolation docs.

- Convert table of interpolation examples to a list of examples. Tables
aren't supported by Swift markup, so this wouldn't render properly in
Xcode or on the web.
- Add a description of what a user must implement in a custom
string interpolation type to get the behavior they want.

* Revise isMultiple(of:) docs.

- In particular, add emphasis to mathematical symbols and equations to
match how we document such things elsewhere.
- I'm using asterisks for single symbols, and underscores for equations
because it's easier to read in-source when you don't have to escape
multiplication within emphasis.

* Add some abstracts to the SIMD vector types.

- Adds a dictionary of spelled out numbers. Only numbers < 10
  should be spelled out according to editorial.
- Adds abstracts to some of the basic members.
- Includes parameter descriptions for the xyzw properties and inits,
but not for the unlabeled initializers. Combined with the protocol
extension method abstracts, this should complete coverage of the concrete
types.
2019-01-03 18:19:20 -06:00
Karoy Lorentey
545fa5e640 [stdlib] Re-add previously synthesized hashing definitions 2018-11-22 17:15:36 +00:00
Ben Cohen
1673c12d78 [stdlib] Replace "sanityCheck" with "internalInvariant" (#20616)
* Replace "sanityCheck" with "internalInvariant"
2018-11-15 20:50:22 -08:00
Michael Ilseman
f9e6df312a Implement SE-0221: Character Properties (#20520)
Provide convenience properties on Character.
2018-11-15 14:03:49 -08:00
Michael Ilseman
948655e850 [String] Cleanups, comments, documentation
After rebasing on master and incorporating more 32-bit support,
perform a bunch of cleanup, documentation updates, comments, move code
back to String declaration, etc.
2018-11-04 10:42:42 -08:00
Michael Ilseman
fe7c3ce2e4 [String] Refactorings and cleanup
* Refactor out RRC implementation into dedicated file.

* Change our `_invariantCheck` pattern to generate efficient code in
  asserts builds and make the optimizer job's easier.

* Drop a few Bidi shims we no longer need.

* Restore View decls to String, workaround no longer needed

* Cleaner unicode helper facilities
2018-11-04 10:42:40 -08:00
Michael Ilseman
f23a3c19b8 [String] Bounds checking and Index cleanup 2018-11-04 10:42:40 -08:00
Michael Ilseman
4ab45dfe20 [String] Drop in initial UTF-8 String prototype
This is a giant squashing of a lot of individual changes prototyping a
switch of String in Swift 5 to be natively encoded as UTF-8. It
includes what's necessary for a functional prototype, dropping some
history, but still leaves plenty of history available for future
commits.

My apologies to anyone trying to do code archeology between this
commit and the one prior. This was the lesser of evils.
2018-11-04 10:42:40 -08:00
Ben Rimmington
cec9faf1c0 [SE-0211] Emoji properties require ICU 57 or later 2018-09-13 18:18:33 +01:00
Michael Ilseman
b93a351c89 Merge branch 'master' into patch-1 2018-08-11 18:51:29 -07:00
Thomas Roughton
839d92b247 [stdlib] UnicodeScalarProperties: use RawValue over UInt32
On Windows, `__swift_stdlib_UNumericType` and `__swift_stdlib_UCharCategory` are imported as `Int32`s rather than `UInt32`. Change the constructors to use the type's inferred `RawValue` rather than always `UInt32`.
2018-08-11 12:01:19 +12:00
Michael Ilseman
9f6eecb1ef [string] Internal Unicode.Scalar.withUTF16CodeUnits
Clean up Unicode.Scalar.Properties a bit and add internal methods to
access UTF-16 and UTF-8 code units by pointer. NFC.
2018-08-10 16:22:49 -07:00
swift-ci
4edbd83576 Merge pull request #17923 from allevato/unicode-properties-docs 2018-07-24 17:45:06 -07:00
Tony Allevato
5352545f9c Apply review feedback 2018-07-16 18:00:39 -07:00
Ben Cohen
b77b544cdc Remove remaining @ininable from @_transparent (#17968) 2018-07-16 08:12:52 -07:00
Tony Allevato
f99109c552 [stdlib] NFC: Unicode.Scalar.Properties documentation fixes 2018-07-12 21:32:05 -07:00
Tony Allevato
b454e8d0f4 Make emoji properties Darwin only.
Ubuntu 16.04 doesn't have a recent enough ICU to support these; we need a better long-term solution, such as bundling ICU with the toolchain.
2018-07-09 18:42:42 -07:00
Tony Allevato
d0e93acb00 Various fixes to Unicode.Scalar.Properties.
- numericValue returns nil instead of .nan for non-numerics
- Remove small-string optimizations from _scalarName that failed on 32-bit archs
- Put case mappings back into U.S.Properties
- Added more sanity tests
2018-07-05 20:42:56 -07:00
Tony Allevato
54f4c77ce7 [stdlib] Revert hasNormalizationBoundaryBefore
This property is too specific in that it forces a particular normalization; let's not expose it this way, but instead in the future with a full normalization API.
2018-04-22 12:01:03 -07:00
Tony Allevato
95dc229d17 [stdlib] Fix age property and update case mappings
Using &foo.0 is not a suitable shortcut for getting a mutable
pointer to the first element of a tuple.
2018-04-06 06:29:50 -07:00
Tony Allevato
f06af77e01 [stdlib] Lift case mappings directly into Unicode.Scalar 2018-04-03 23:02:15 -07:00
Tony Allevato
56d04befd1 [stdlib] Rewrite _scalarName to fully use a small string 2018-04-03 19:20:38 -07:00
Tony Allevato
47deadc2fb [stdlib] Compute scalar's UTF-16 on demand instead of caching 2018-04-02 21:38:54 -07:00
Tony Allevato
5a7d7d3929 [stdlib] Update case mappings to use small strings if possible 2018-04-02 21:12:08 -07:00
Tony Allevato
4a1794074a [stdlib] Update documentation for case mappings 2018-04-01 19:41:43 -07:00
Tony Allevato
5807bb9436 [stdlib] Fix _scalarName to use small string if possible 2018-04-01 19:29:26 -07:00
Tony Allevato
3a2ad05092 [stdlib] Add "isDefined", "hasNormalizationBoundaryBefore" to Unicode.Scalar.Properties 2018-03-28 06:40:25 -07:00
Tony Allevato
354f2ad66e [stdlib] Add "numeric{Type,Value}" to Unicode.Scalar.Properties 2018-03-27 21:07:27 -07:00
Tony Allevato
e7078a473b [stdlib] Add "canonicalCombiningClass" to Unicode.Scalar.Properties 2018-03-26 06:38:55 -07:00
Tony Allevato
e7fa49984a [stdlib] Add "{lower,title,upper}caseMapping" to Unicode.Scalar.Properties 2018-03-26 06:38:55 -07:00
Tony Allevato
9858d4edfb [stdlib] Add "name", "nameAlias" to Unicode.Scalar.Properties 2018-03-26 06:38:55 -07:00
Tony Allevato
af798fa972 [stdlib] Add "generalCategory" to Unicode.Scalar.Properties 2018-03-26 06:38:55 -07:00
Tony Allevato
d6ee54f4b5 [stdlib] Add "age" to Unicode.Scalar.Properties 2018-03-26 06:38:54 -07:00
Tony Allevato
6726645109 [stdlib] Add binary properties to Unicode.Scalar 2018-03-19 13:54:33 -07:00