Bug 188678 - Replace TextCheckingTypeMask with OptionSet
Summary: Replace TextCheckingTypeMask with OptionSet
Status: RESOLVED FIXED
Alias: None
Product: WebKit
Classification: Unclassified
Component: WebCore Misc. (show other bugs)
Version: WebKit Nightly Build
Hardware: Unspecified Unspecified
: P2 Normal
Assignee: Daniel Bates
URL:
Keywords: InRadar
: 188510 (view as bug list)
Depends on:
Blocks:
 
Reported: 2018-08-16 14:13 PDT by Daniel Bates
Modified: 2018-08-21 09:48 PDT (History)
9 users (show)

See Also:


Attachments
Patch (54.00 KB, patch)
2018-08-16 14:14 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews107 for mac-sierra-wk2 (3.44 MB, application/zip)
2018-08-16 15:14 PDT, EWS Watchlist
no flags Details
Patch (72.04 KB, patch)
2018-08-16 15:31 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch (73.64 KB, patch)
2018-08-16 15:41 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch (73.69 KB, patch)
2018-08-16 15:46 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
For landing (89.65 KB, patch)
2018-08-17 10:20 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
For EWS: Ross Kirsling's first suggested fix (89.13 KB, patch)
2018-08-20 16:38 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
For EWS: Ross Kirsling's second suggested fix (89.20 KB, patch)
2018-08-20 16:38 PDT, Daniel Bates
ews-watchlist: commit-queue-
Details | Formatted Diff | Diff
For EWS: Make shouldPerformReplacement non-const (89.11 KB, patch)
2018-08-20 16:39 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
For EWS: Explicitly pass constexpr to OptionSet::containsAny() (89.20 KB, patch)
2018-08-20 16:41 PDT, Daniel Bates
no flags Details | Formatted Diff | Diff
Patch (89.61 KB, patch)
2018-08-20 20:04 PDT, Fujii Hironori
no flags Details | Formatted Diff | Diff
Archive of layout-test-results from ews205 for win-future (12.91 MB, application/zip)
2018-08-21 05:38 PDT, EWS Watchlist
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Daniel Bates 2018-08-16 14:13:46 PDT
Make TextCheckingTypeMask an OptionSet for type safety and code clarity.
Comment 1 Daniel Bates 2018-08-16 14:14:33 PDT
Created attachment 347303 [details]
Patch
Comment 2 EWS Watchlist 2018-08-16 15:14:15 PDT Comment hidden (obsolete)
Comment 3 EWS Watchlist 2018-08-16 15:14:17 PDT Comment hidden (obsolete)
Comment 4 Daniel Bates 2018-08-16 15:31:59 PDT
Created attachment 347313 [details]
Patch
Comment 5 EWS Watchlist 2018-08-16 15:34:10 PDT
Attachment 347313 [details] did not pass style-queue:


ERROR: Source/WebKit/UIProcess/mac/TextCheckerMac.mm:343:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 1 in 26 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 6 Daniel Bates 2018-08-16 15:41:40 PDT
Created attachment 347316 [details]
Patch
Comment 7 Daniel Bates 2018-08-16 15:46:46 PDT
Created attachment 347318 [details]
Patch
Comment 8 EWS Watchlist 2018-08-16 15:56:22 PDT
Attachment 347318 [details] did not pass style-queue:


ERROR: Source/WebKit/UIProcess/mac/TextCheckerMac.mm:343:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 1 in 28 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 9 Alex Christensen 2018-08-16 16:15:29 PDT
Comment on attachment 347318 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=347318&action=review

> Source/WebCore/editing/Editor.cpp:3723
> -        textCheckingOptions &= TextCheckingTypeReplacement;
> +        textCheckingOptions = TextCheckingType::Replacement;

This looks like a change in behavior.  It could contain other things.
Comment 10 Antti Koivisto 2018-08-16 22:53:32 PDT
Comment on attachment 347318 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=347318&action=review

r=me with the logic mistake fixed.

> Source/WebCore/SourcesCocoa.txt:530
> +platform/text/mac/TextCheckingMac.mm

Shouldn't this be platform/text/cocoa/TextCheckingCocoa or is this really Mac specific?

>> Source/WebCore/editing/Editor.cpp:3723
>> +        textCheckingOptions = TextCheckingType::Replacement;
> 
> This looks like a change in behavior.  It could contain other things.

This should be 

textCheckingOptions = textCheckingOptions & TextCheckingType::Replacement;

This is so rare that it is probably better to not add OptionSet::operator&= as it would be easy to use by mistake.

> Source/WebCore/editing/SpellChecker.cpp:220
> -        if (requestData.mask() & TextCheckingTypeSpelling)
> +        if (requestData.mask() & TextCheckingType::Spelling)

It would be nice to rename mask() to something more descriptive.

> Source/WebCore/editing/TextCheckingHelper.cpp:586
> -    TextCheckingTypeMask checkingTypes = checkGrammar ? (TextCheckingTypeSpelling | TextCheckingTypeGrammar) : TextCheckingTypeSpelling;
> +    TextCheckingTypeMask checkingTypes = checkGrammar ? TextCheckingTypeMask { TextCheckingType::Spelling, TextCheckingType::Grammar } : TextCheckingTypeMask { TextCheckingType::Spelling };

You could use auto.

Alternatively using if may read better:

TextCheckingTypeMask checkingTypes { TextCheckingType::Spelling };
if (checkGrammar)
   checkingTypes |= { TextCheckingType::Grammar };

> Source/WebCore/platform/text/TextChecking.h:53
> -typedef unsigned TextCheckingTypeMask;
> +using TextCheckingTypeMask = OptionSet<TextCheckingType>;

OptionSet is not really a "mask" so this should at least be renamed. I would prefer just removing the whole type and instead using OptionSet<TextCheckingType> everywhere. It is more readable that way.

> Source/WebCore/platform/text/TextChecking.h:87
> -        , m_mask(TextCheckingTypeNone)
> +        , m_mask(TextCheckingType::None)

This line can be removed, empty set is initialized by default.

Also if TextCheckingTypeMask is renamed, m_mask should be too.

> Source/WebKit/UIProcess/gtk/TextCheckerGtk.cpp:206
> -    ASSERT(request.mask() != TextCheckingTypeNone);
> +    ASSERT(request.mask() != TextCheckingType::None);

This can be just ASSERT(request.mask())
Comment 11 Antti Koivisto 2018-08-16 22:57:59 PDT
Comment on attachment 347318 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=347318&action=review

> Source/WebCore/editing/Editor.cpp:2647
>      TextCheckingTypeMask textCheckingOptions = request.data().mask();

auto

> Source/WebCore/editing/TextCheckingHelper.cpp:354
> -                TextCheckingTypeMask checkingTypes = checkGrammar ? (TextCheckingTypeSpelling | TextCheckingTypeGrammar) : TextCheckingTypeSpelling;
> +                TextCheckingTypeMask checkingTypes = checkGrammar ? TextCheckingTypeMask { TextCheckingType::Spelling, TextCheckingType::Grammar } : TextCheckingTypeMask { TextCheckingType::Spelling };

Same as above here.
Comment 12 Antti Koivisto 2018-08-17 02:07:41 PDT
*** Bug 188510 has been marked as a duplicate of this bug. ***
Comment 13 Daniel Bates 2018-08-17 09:41:41 PDT
(In reply to Antti Koivisto from comment #10)
> > Source/WebCore/SourcesCocoa.txt:530
> > +platform/text/mac/TextCheckingMac.mm
> 
> Shouldn't this be platform/text/cocoa/TextCheckingCocoa or is this really
> Mac specific?
> 

Yes, it is Mac specific. On iOS we use different machinery (UITextChecker) to perform spell checking that does not make use of the flags NSTextCheckingType.

> >> Source/WebCore/editing/Editor.cpp:3723
> >> +        textCheckingOptions = TextCheckingType::Replacement;
> > 
[...]
> 
> This should be 
> 
> textCheckingOptions = textCheckingOptions & TextCheckingType::Replacement;
> 
> This is so rare that it is probably better to not add OptionSet::operator&=
> as it would be easy to use by mistake.

Will fix.

> 
> > Source/WebCore/editing/SpellChecker.cpp:220
> > -        if (requestData.mask() & TextCheckingTypeSpelling)
> > +        if (requestData.mask() & TextCheckingType::Spelling)
> 
> It would be nice to rename mask() to something more descriptive.
> 

Maybe typesToCheck?

> > Source/WebCore/editing/TextCheckingHelper.cpp:586
> > -    TextCheckingTypeMask checkingTypes = checkGrammar ? (TextCheckingTypeSpelling | TextCheckingTypeGrammar) : TextCheckingTypeSpelling;
> > +    TextCheckingTypeMask checkingTypes = checkGrammar ? TextCheckingTypeMask { TextCheckingType::Spelling, TextCheckingType::Grammar } : TextCheckingTypeMask { TextCheckingType::Spelling };
> 
> You could use auto.
> 
> Alternatively using if may read better:
> 
> TextCheckingTypeMask checkingTypes { TextCheckingType::Spelling };
> if (checkGrammar)
>    checkingTypes |= { TextCheckingType::Grammar };
> 

Will change.

> > Source/WebCore/platform/text/TextChecking.h:53
> > -typedef unsigned TextCheckingTypeMask;
> > +using TextCheckingTypeMask = OptionSet<TextCheckingType>;
> 
> OptionSet is not really a "mask" so this should at least be renamed. I would
> prefer just removing the whole type and instead using
> OptionSet<TextCheckingType> everywhere. It is more readable that way.
> 

Will substitute OptionSet<TextCheckingType> for TextCheckingTypeMask and remove the type alias.

> > Source/WebCore/platform/text/TextChecking.h:87
> > -        , m_mask(TextCheckingTypeNone)
> > +        , m_mask(TextCheckingType::None)
> 
> This line can be removed, empty set is initialized by default.
> 

Will remove.

> Also if TextCheckingTypeMask is renamed, m_mask should be too.
> 
> > Source/WebKit/UIProcess/gtk/TextCheckerGtk.cpp:206
> > -    ASSERT(request.mask() != TextCheckingTypeNone);
> > +    ASSERT(request.mask() != TextCheckingType::None);
> 
> This can be just ASSERT(request.mask())

Will change.
Comment 14 Daniel Bates 2018-08-17 09:44:06 PDT
Comment on attachment 347318 [details]
Patch

View in context: https://bugs.webkit.org/attachment.cgi?id=347318&action=review

> Source/WebCore/editing/SpellChecker.cpp:222
> -        if (requestData.mask() & TextCheckingTypeSpelling)
> +        if (requestData.mask() & TextCheckingType::Spelling)
>              markerTypes |= DocumentMarker::Spelling;
> -        if (requestData.mask() & TextCheckingTypeGrammar)
> +        if (requestData.mask() & TextCheckingType::Grammar)

Will change this code to read:

if (requestData.sequence() == sequence) {
    OptionSet<DocumentMarker::MarkerType> markerTypes;
    if (requestData.mask().contains(TextCheckingType::Spelling))
        markerTypes |= DocumentMarker::Spelling;
    if (requestData.mask().contains(TextCheckingType::Grammar))
        markerTypes |= DocumentMarker::Grammar;
    if (!markerTypes.isEmpty())
        m_frame.document()->markers().removeMarkers(&m_processingRequest->checkingRange(), markerTypes);
}
Comment 15 Daniel Bates 2018-08-17 09:48:38 PDT
(In reply to Daniel Bates from comment #13)
> > > Source/WebCore/editing/SpellChecker.cpp:220
> > > -        if (requestData.mask() & TextCheckingTypeSpelling)
> > > +        if (requestData.mask() & TextCheckingType::Spelling)
> > 
> > It would be nice to rename mask() to something more descriptive.
> > 
> 
> Maybe typesToCheck?
> 

Or checkingTypes?
Comment 16 Daniel Bates 2018-08-17 10:19:00 PDT
(In reply to Daniel Bates from comment #15)
> (In reply to Daniel Bates from comment #13)
> > > > Source/WebCore/editing/SpellChecker.cpp:220
> > > > -        if (requestData.mask() & TextCheckingTypeSpelling)
> > > > +        if (requestData.mask() & TextCheckingType::Spelling)
> > > 
> > > It would be nice to rename mask() to something more descriptive.
> > > 
> > 
> > Maybe typesToCheck?
> > 
> 
> Or checkingTypes?

I chose to rename TextCheckingRequestData::mask() to TextCheckingRequestData::checkingTypes().
Comment 17 Daniel Bates 2018-08-17 10:20:19 PDT
Created attachment 347365 [details]
For landing
Comment 18 EWS Watchlist 2018-08-17 10:21:43 PDT
Attachment 347365 [details] did not pass style-queue:


ERROR: Source/WebKit/UIProcess/mac/TextCheckerMac.mm:343:  Weird number of spaces at line-start.  Are you using a 4-space indent?  [whitespace/indent] [3]
Total errors found: 1 in 36 files


If any of these errors are false positives, please file a bug against check-webkit-style.
Comment 19 Daniel Bates 2018-08-17 10:36:22 PDT
For some reason the Windows and WinCairo bots are not happy with the patch (attachment #347318 [details]) and have similar error messages:

[[
 UnifiedSource232.cpp
C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\ForwardingHeaders\wtf/OptionSet.h(84): error C2131: expression did not evaluate to a constant (compiling source file C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\WebCore\unified-sources\UnifiedSource223.cpp) [C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\Source\WebCore\WebCore.vcxproj]
  C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\ForwardingHeaders\wtf/OptionSet.h(84): note: failure was caused by a read of a variable outside its lifetime (compiling source file C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\WebCore\unified-sources\UnifiedSource223.cpp)
  C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\ForwardingHeaders\wtf/OptionSet.h(84): note: see usage of '<begin>$L0' (compiling source file C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\WebCore\unified-sources\UnifiedSource223.cpp)
]]
<https://webkit-queues.webkit.org/results/8890767>

Anybody have any insight/suggestions?
Comment 20 Ross Kirsling 2018-08-17 11:01:09 PDT
(In reply to Daniel Bates from comment #19)
> For some reason the Windows and WinCairo bots are not happy with the patch
> (attachment #347318 [details]) and have similar error messages:
> 
> [[
>  UnifiedSource232.cpp
> C:
> \cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\ForwardingHea
> ders\wtf/OptionSet.h(84): error C2131: expression did not evaluate to a
> constant (compiling source file
> C:
> \cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\WebCore\unifi
> ed-sources\UnifiedSource223.cpp)
> [C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\Source\WebCore\WebCore.
> vcxproj]
>  
> C:
> \cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\ForwardingHea
> ders\wtf/OptionSet.h(84): note: failure was caused by a read of a variable
> outside its lifetime (compiling source file
> C:
> \cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\WebCore\unifi
> ed-sources\UnifiedSource223.cpp)
>  
> C:
> \cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\ForwardingHea
> ders\wtf/OptionSet.h(84): note: see usage of '<begin>$L0' (compiling source
> file
> C:
> \cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\WebCore\unifi
> ed-sources\UnifiedSource223.cpp)
> ]]
> <https://webkit-queues.webkit.org/results/8890767>
> 
> Anybody have any insight/suggestions?

I think we had a related issue here:
https://bugs.webkit.org/show_bug.cgi?id=188501

I'll see what I can find.
Comment 21 Don Olmstead 2018-08-17 14:35:29 PDT
(In reply to Ross Kirsling from comment #20)
> (In reply to Daniel Bates from comment #19)
> > For some reason the Windows and WinCairo bots are not happy with the patch
> > (attachment #347318 [details]) and have similar error messages:
> > 
> > [[
> >  UnifiedSource232.cpp
> > C:
> > \cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\ForwardingHea
> > ders\wtf/OptionSet.h(84): error C2131: expression did not evaluate to a
> > constant (compiling source file
> > C:
> > \cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\WebCore\unifi
> > ed-sources\UnifiedSource223.cpp)
> > [C:\cygwin\home\buildbot\WebKit\WebKitBuild\Release\Source\WebCore\WebCore.
> > vcxproj]
> >  
> > C:
> > \cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\ForwardingHea
> > ders\wtf/OptionSet.h(84): note: failure was caused by a read of a variable
> > outside its lifetime (compiling source file
> > C:
> > \cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\WebCore\unifi
> > ed-sources\UnifiedSource223.cpp)
> >  
> > C:
> > \cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\ForwardingHea
> > ders\wtf/OptionSet.h(84): note: see usage of '<begin>$L0' (compiling source
> > file
> > C:
> > \cygwin\home\buildbot\WebKit\WebKitBuild\Release\DerivedSources\WebCore\unifi
> > ed-sources\UnifiedSource223.cpp)
> > ]]
> > <https://webkit-queues.webkit.org/results/8890767>
> > 
> > Anybody have any insight/suggestions?
> 
> I think we had a related issue here:
> https://bugs.webkit.org/show_bug.cgi?id=188501
> 
> I'll see what I can find.

I think the issue is around usages of { } which end up in the std::initializer_list constructor. MSVC is not handling those properly and doesn't think they're constexpr.
Comment 22 Don Olmstead 2018-08-17 14:43:19 PDT
Comment on attachment 347365 [details]
For landing

View in context: https://bugs.webkit.org/attachment.cgi?id=347365&action=review

Overall patch looks great. VC++ definitely has a bug there.

> Source/WebCore/editing/Editor.cpp:2840
> +        OptionSet<TextCheckingType> textCheckingOptions { TextCheckingType::Spelling };

Can you try using () instead of {} for these cases? I think VC++ should compile it out then.

> Source/WebCore/editing/TextCheckingHelper.cpp:354
> +                OptionSet<TextCheckingType> checkingTypes { TextCheckingType::Spelling };

Same

> Source/WebCore/editing/TextCheckingHelper.cpp:588
> +    OptionSet<TextCheckingType> checkingTypes { TextCheckingType::Spelling };

Same
Comment 23 Ross Kirsling 2018-08-20 14:25:55 PDT
(In reply to Don Olmstead from comment #22)
> Comment on attachment 347365 [details]
> For landing
> 
> View in context:
> https://bugs.webkit.org/attachment.cgi?id=347365&action=review
> 
> Overall patch looks great. VC++ definitely has a bug there.
> 
> > Source/WebCore/editing/Editor.cpp:2840
> > +        OptionSet<TextCheckingType> textCheckingOptions { TextCheckingType::Spelling };
> 
> Can you try using () instead of {} for these cases? I think VC++ should
> compile it out then.
> 
> > Source/WebCore/editing/TextCheckingHelper.cpp:354
> > +                OptionSet<TextCheckingType> checkingTypes { TextCheckingType::Spelling };
> 
> Same
> 
> > Source/WebCore/editing/TextCheckingHelper.cpp:588
> > +    OptionSet<TextCheckingType> checkingTypes { TextCheckingType::Spelling };
> 
> Same

Even though there is something weird with initializer_list and constexpr in MSVC, it seems that changing these lines won't help us at all. :(
I should have a(n initial) working suggestion shortly.
Comment 24 Ross Kirsling 2018-08-20 15:00:13 PDT
Comment on attachment 347365 [details]
For landing

View in context: https://bugs.webkit.org/attachment.cgi?id=347365&action=review

> Source/WebCore/editing/Editor.cpp:2653
> +    const bool shouldPerformReplacement = textCheckingOptions.containsAny({ TextCheckingType::Quote, TextCheckingType::Dash, TextCheckingType::Replacement });

This is evidently the singular failing line.

If you change the lvalue to an rvalue, compilation succeeds:
> const bool shouldPerformReplacement = request.data().checkingTypes().containsAny({ TextCheckingType::Quote, TextCheckingType::Dash, TextCheckingType::Replacement });

FWIW, either of the following unergonomic options also technically work:

>  const bool shouldPerformReplacement = textCheckingOptions.containsAny(OptionSet<TextCheckingType>(TextCheckingType::Quote) | OptionSet<TextCheckingType>(TextCheckingType::Dash) | OptionSet<TextCheckingType>(TextCheckingType::Replacement));

> const bool shouldPerformReplacement = textCheckingOptions.contains(TextCheckingType::Quote) || textCheckingOptions.contains(TextCheckingType::Dash) || textCheckingOptions.contains(TextCheckingType::Replacement);

...but simply making the coercion from initializer_list to OptionSet<TextCheckingType> explicit does not help.

This really ought to be addressed in OptionSet and not at the containsAny callsite, but I'm still not 100% clear on the proper fix.
Comment 25 Daniel Bates 2018-08-20 16:38:05 PDT
Created attachment 347562 [details]
For EWS: Ross Kirsling's first suggested fix

Change:

const bool shouldPerformReplacement = textCheckingOptions.containsAny({ TextCheckingType::Quote, TextCheckingType::Dash, TextCheckingType::Replacement });

to read:

const bool shouldPerformReplacement = request.data().checkingTypes().containsAny({ TextCheckingType::Quote, TextCheckingType::Dash, TextCheckingType::Replacement });
Comment 26 Daniel Bates 2018-08-20 16:38:47 PDT
Created attachment 347563 [details]
For EWS: Ross Kirsling's second suggested fix

Change:

const bool shouldPerformReplacement = textCheckingOptions.containsAny({ TextCheckingType::Quote, TextCheckingType::Dash, TextCheckingType::Replacement });

to read:

const bool shouldPerformReplacement = textCheckingOptions.contains(TextCheckingType::Quote) || textCheckingOptions.contains(TextCheckingType::Dash) || textCheckingOptions.contains(TextCheckingType::Replacement);
Comment 27 Daniel Bates 2018-08-20 16:39:58 PDT
Created attachment 347565 [details]
For EWS: Make shouldPerformReplacement non-const

Change:

const bool shouldPerformReplacement = textCheckingOptions.containsAny({ TextCheckingType::Quote, TextCheckingType::Dash, TextCheckingType::Replacement });

to read:

bool shouldPerformReplacement = textCheckingOptions.containsAny({ TextCheckingType::Quote, TextCheckingType::Dash, TextCheckingType::Replacement });
Comment 28 Daniel Bates 2018-08-20 16:41:24 PDT
Created attachment 347566 [details]
For EWS: Explicitly pass constexpr to OptionSet::containsAny()

Change:

const bool shouldPerformReplacement = textCheckingOptions.containsAny({ TextCheckingType::Quote, TextCheckingType::Dash, TextCheckingType::Replacement });

to read:

constexpr OptionSet<TextCheckingType> replacementCriterion { TextCheckingType::Quote, TextCheckingType::Dash, TextCheckingType::Replacement };
const bool shouldPerformReplacement = textCheckingOptions.containsAny(replacementCriterion);
Comment 29 EWS Watchlist 2018-08-20 16:45:59 PDT Comment hidden (obsolete)
Comment 30 EWS Watchlist 2018-08-20 16:47:28 PDT Comment hidden (obsolete)
Comment 31 EWS Watchlist 2018-08-20 16:48:41 PDT Comment hidden (obsolete)
Comment 32 EWS Watchlist 2018-08-20 16:49:56 PDT Comment hidden (obsolete)
Comment 33 Ross Kirsling 2018-08-20 17:35:02 PDT
(In reply to Daniel Bates from comment #27)
> Created attachment 347565 [details]
> For EWS: Make shouldPerformReplacement non-const
> 
> Change:
> 
> const bool shouldPerformReplacement = textCheckingOptions.containsAny({
> TextCheckingType::Quote, TextCheckingType::Dash,
> TextCheckingType::Replacement });
> 
> to read:
> 
> bool shouldPerformReplacement = textCheckingOptions.containsAny({
> TextCheckingType::Quote, TextCheckingType::Dash,
> TextCheckingType::Replacement });

Somehow this one only got sent to a subset of the EWS bots.
It does appear to work locally though (to my surprise)!
Comment 34 Fujii Hironori 2018-08-20 20:04:41 PDT
Created attachment 347603 [details]
Patch

Another workaround.

* const bool shouldPerformReplacement → bool shouldPerformReplacement
Comment 35 Fujii Hironori 2018-08-20 20:08:16 PDT
(In reply to Fujii Hironori from comment #34)
> Another workaround.
> 
> * const bool shouldPerformReplacement → bool shouldPerformReplacement

Oops. Exactly same workaround with comment 27.
Comment 37 Daniel Bates 2018-08-20 20:38:54 PDT
(In reply to Ross Kirsling from comment #33)
> (In reply to Daniel Bates from comment #27)
> > Created attachment 347565 [details]
> > For EWS: Make shouldPerformReplacement non-const
> > 
> > Change:
> > 
> > const bool shouldPerformReplacement = textCheckingOptions.containsAny({
> > TextCheckingType::Quote, TextCheckingType::Dash,
> > TextCheckingType::Replacement });
> > 
> > to read:
> > 
> > bool shouldPerformReplacement = textCheckingOptions.containsAny({
> > TextCheckingType::Quote, TextCheckingType::Dash,
> > TextCheckingType::Replacement });
> 
> Somehow this one only got sent to a subset of the EWS bots.
> It does appear to work locally though (to my surprise)!

Yay! Thank you for confirming. I am going to go with this approach.
Comment 38 Daniel Bates 2018-08-20 20:44:20 PDT
(In reply to Fujii Hironori from comment #36)
> I created a reproducer and reportd.
> 
> https://godbolt.org/z/onbBA9
> https://gist.github.com/fujii/96ab8fef265870f36ad05c8faf7c3031
> https://developercommunity.visualstudio.com/content/problem/316713/msvc-cant-
> compile-webkits-optionsetcontainsany.html

Thank you Fujii for creating the reduction and reporting it. Maybe someone should tweet the reduction to the Twitter thread: <https://twitter.com/UlziiLuvsanbat/status/1030589141250007040>.
Comment 39 EWS Watchlist 2018-08-21 05:38:39 PDT
Comment on attachment 347563 [details]
For EWS: Ross Kirsling's second suggested fix

Attachment 347563 [details] did not pass win-ews (win):
Output: https://webkit-queues.webkit.org/results/8928919

New failing tests:
http/tests/security/canvas-remote-read-remote-video-localhost.html
Comment 40 EWS Watchlist 2018-08-21 05:38:51 PDT
Created attachment 347633 [details]
Archive of layout-test-results from ews205 for win-future

The attached test failures were seen while running run-webkit-tests on the win-ews.
Bot: ews205  Port: win-future  Platform: CYGWIN_NT-6.1-2.9.0-0.318-5-3-x86_64-64bit
Comment 41 Daniel Bates 2018-08-21 09:47:53 PDT
Committed r235120: <https://trac.webkit.org/changeset/235120>
Comment 42 Radar WebKit Bug Importer 2018-08-21 09:48:21 PDT
<rdar://problem/43565123>