diff options
-rw-r--r-- | Tests/LibRegex/Regex.cpp | 1 | ||||
-rw-r--r-- | Userland/Libraries/LibRegex/RegexOptimizer.cpp | 4 |
2 files changed, 3 insertions, 2 deletions
diff --git a/Tests/LibRegex/Regex.cpp b/Tests/LibRegex/Regex.cpp index 49e05203e9..eac8709085 100644 --- a/Tests/LibRegex/Regex.cpp +++ b/Tests/LibRegex/Regex.cpp @@ -922,6 +922,7 @@ TEST_CASE(optimizer_atomic_groups) Tuple { "a+b"sv, "aaaaa"sv, false }, Tuple { "\\\\(\\d+)"sv, "\\\\"sv, false }, // Rewrite bug turning a+ to a*, see #10952. Tuple { "[a-z.]+\\."sv, "..."sv, true }, // Rewrite bug, incorrect interpretation of Compare. + Tuple { "[.-]+\\."sv, ".-."sv, true }, // Alternative fuse Tuple { "(abcfoo|abcbar|abcbaz).*x"sv, "abcbarx"sv, true }, Tuple { "(a|a)"sv, "a"sv, true }, diff --git a/Userland/Libraries/LibRegex/RegexOptimizer.cpp b/Userland/Libraries/LibRegex/RegexOptimizer.cpp index cc595798b1..78f7017f58 100644 --- a/Userland/Libraries/LibRegex/RegexOptimizer.cpp +++ b/Userland/Libraries/LibRegex/RegexOptimizer.cpp @@ -187,7 +187,7 @@ static bool has_overlap(Vector<CompareTypeAndValuePair> const& lhs, Vector<Compa lhs_negated_char_classes.set(static_cast<CharClass>(pair.value)); break; case CharacterCompareType::CharRange: { - auto range = bit_cast<CharRange>(pair.value); + auto range = CharRange(pair.value); if (!current_lhs_inversion_state()) lhs_ranges.insert(range.from, range.to); else @@ -257,7 +257,7 @@ static bool has_overlap(Vector<CompareTypeAndValuePair> const& lhs, Vector<Compa return true; break; case CharacterCompareType::CharRange: { - auto range = bit_cast<CharRange>(pair.value); + auto range = CharRange(pair.value); if (!current_lhs_inversion_state() && range_contains(range)) return true; break; |