Fix overaggressive CanBeMadeAtomic check for Set + Notone (#33405)
authorStephen Toub <stoub@microsoft.com>
Tue, 10 Mar 2020 10:51:07 +0000 (06:51 -0400)
committerGitHub <noreply@github.com>
Tue, 10 Mar 2020 10:51:07 +0000 (06:51 -0400)
commit86bef04610f1b7ac410746ce8c741150834a6ac2
tree89aaef34c55bac121a0d1aeb72122d014f7e85ec
parentfd1480ec75c7b783264b0526e38fbbf2e62a3b6e
Fix overaggressive CanBeMadeAtomic check for Set + Notone (#33405)

We're erroneously converting a set loop to be atomic when it's followed by a notone where the notone's character is in the set.  But if we for example have `[ab]*[^a]`, we can't make the loop atomic, because the `[ab]*` can actually give back something (a `b`) that the `[^a]` will match.  The fix is simply to delete the erroneous, overaggressive checks.
src/libraries/System.Text.RegularExpressions/src/System/Text/RegularExpressions/RegexNode.cs
src/libraries/System.Text.RegularExpressions/tests/Regex.Groups.Tests.cs
src/libraries/System.Text.RegularExpressions/tests/RegexReductionTests.cs