Commit Graph

10 Commits

Author SHA1 Message Date
Suyash Srijan
7ee6319cdc [Parse] [Sema] Update confusables diagnostic to mention the character names as well (#33105)
* [Parser] Update 'Confusables.def' file to include confusable and base character names

* [Parser] Add a new utility method to return the names of the confusable and base characters for a given confusable codepoint

* [Parser] Update diagnostic for confusable character during lexing to mention confusable and base character names

* [Sema] If there is just a single confusable character, emit a tailored diagnostic that also mentions the character names

* [Diagnostics] Add new diagnostic messages to the localization file

* [Test] Update confusables test

* [Utils] Update unicode confusables txt file and update script to regenerate confusables def file

* [Parse] Regenerate 'Confusables.def' using updated script

* [Utils] Adjust generate_confusables script based on review feedback

Fix a mistake with name mapping. Updated header comment. Fix a couple of linting issues.

* [Parse] Regenerate 'Confusables.def' file once again after script changes

* [Parse] Add the newline after end of 'getConfusableAndBaseCodepointNames' method

* [Test] Update diagnostic message in 'Syntax/Parser/diags.swift'
2020-07-27 23:15:31 +01:00
Michael Ilseman
f88fb9a97a Be a little more permissive in emoji grapheme literals.
The user experience with extended grapheme literals is currently:

1. Strict: we hard error on "invalid" grapheme literals.

2. Complete: we validate all literals to either be
known-single-grapheme or not.

3. Incorrect: we have Unicode 8 semantics implemented but applications
will have some other version of Unicode as dictated by the OS they are
running on.

In Swift 4.0, this incorrectness mostly crops up in obscure corner
case areas, where we are overly restrictive in some ways and overly
relaxed in others. But, there is one particularly embarrassing area
where it does come up: we reject emoji introduced after Unicode 8 as
grapheme literals, counter to common user expectations.

In a future (sub-)version of Swift we should completely re-evaluate
this user story, but doing so in time for Swift 4.0 is untenable. This
patch attempts to tweak the way in which we are incorrect in the most
minimally invasive way possible to preserve the same user experience
while permitting many post-Unicode-8 emoji as valid grapheme literals.

This change overrides processing of ZWJ and emoji modifiers to not
declare a grapheme break after/before, respectively.
2017-07-21 13:33:03 -07:00
Michael Ilseman
573c15ea00 [stdlib] Disable legacy Unicode 8.0 regional break test.
Disables the portions of the regional break test file corresponding to
Unicode 8.0 vs 9.0 differences. Once the compiler and stdlib are in
sync with Unicode 9.0, and the legacy tries are dropped, we should
splat down newer versions of these test files.
2017-05-16 20:30:03 -07:00
Michael Ilseman
f0abff5539 Revert "Merge pull request #9265 from milseman/tls_ftw"
This reverts commit 26f7659efe, reversing
changes made to 7b927e55e8.
2017-05-11 10:39:58 -07:00
Michael Ilseman
2af0acead1 [stdlib] Disable legacy Unicode 8.0 regional break test.
Disables the portions of the regional break test file corresponding to
Unicode 8.0 vs 9.0 differences. Once the compiler and stdlib are in
sync with Unicode 9.0, and the legacy tries are dropped, we should
splat down newer versions of these test files.
2017-05-10 15:46:39 -07:00
Robin Kunde
6d63d90e0e SR-331: Diagnostic notes and fixits for unicode confusables (#9070) 2017-05-06 17:40:35 -04:00
practicalswift
cc852042c9 [gardening] Fix accidental trailing whitespace. 2016-10-29 10:22:58 +02:00
Dmitri Hrybenko
7ae303aeb3 Update Unicode data files to 8.0.0
rdar://19582621

Swift SVN r30141
2015-07-13 08:00:39 +00:00
Dmitri Hrybenko
cb2870c230 Update Unicode data files to 7.0.0
rdar://17561742

Swift SVN r24692
2015-01-23 22:17:45 +00:00
Dmitri Hrybenko
7704e19b7d libBasic: implement extended grapheme cluster segmentation algorithm
This is only for the frontend, not for stdlib.  The implementation is very
slow, optimizing it is the next step.

rdar://16755123 rdar://16013860


Swift SVN r18928
2014-06-16 14:20:43 +00:00