Skip to content

Commit 07b0eed

Browse files
committed
Change 'unsafe_*' to 'unchecked_*', and recommend discard instead of 'as void'
For replacing 'unsafe_*': Thanks to Redditor @tialaramex for their suggestion here, presuasively citing Rust's naming style (and thanks to the Rust designers too for the inspiration): https://www.reddit.com/r/cpp/comments/1euacbu/cpp2_is_looking_absolutely_great_will_convert/liy6g8r/ For replacing 'as void': Thanks to @Velocirobtor and @JohelEGP for their suggestions on improving this diagnostic in the #1279 comment thread.
1 parent ce033fe commit 07b0eed

File tree

58 files changed

+190
-184
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

58 files changed

+190
-184
lines changed

docs/cpp2/expressions.md

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -186,20 +186,20 @@ Here are some `as` casts with their Cpp1 equivalents. In this table, uppercase n
186186
> Note: `as` unifies a variety of differently-named Cpp1 language and library casts and conversions under one syntax, and supports only the type-safe ones.
187187
188188

189-
### <a id="unsafe-casts"></a> Unsafe casts
189+
### <a id="unchecked-casts"></a> Unchecked (explicitly type-unsafe) casts
190190

191-
Unsafe casts must always be explicit.
191+
Casts that are not known to be type-safe at compile time must always be explicit.
192192

193-
To perform a numeric narrowing cast, such as `i32` to `i16` or `u32`, use `unsafe_narrow<To>(from)`. For example:
193+
To perform a numeric narrowing cast, such as `i32` to `i16` or `u32`, use `unchecked_narrow<To>(from)`. Otherwise, if you must perform any other type-unsafe cast, use `unchecked_cast<To>(from)`. For example:
194194

195-
``` cpp title="Unsafe narrowing and casts must be explicit" hl_lines="2 3 6 7"
195+
``` cpp title="Type-unsafe narrowing and casts must be explicit" hl_lines="2 3 6 7"
196196
f: (i: i32, inout s: std::string) = {
197197
// j := i as i16; // error, maybe-lossy narrowing
198-
j := unsafe_narrow<i16>(i); // ok, 'unsafe' is explicit
198+
j := unchecked_narrow<i16>(i); // ok, 'unchecked' is explicit
199199

200200
pv: *void = s&;
201-
// pi := pv as *std::string; // error, unsafe cast
202-
pi := unsafe_cast<*std::string>(pv); // ok, 'unsafe' is explicit
201+
// pi := pv as *std::string; // error, type-unsafe cast
202+
pi := unchecked_cast<*std::string>(pv); // ok, 'unchecked' is explicit
203203
}
204204
```
205205

@@ -383,4 +383,3 @@ std::cout << "now x+2 is (x+2)$\n";
383383
```
384384

385385
A string literal capture can include a `:suffix` where the suffix is a [standard C++ format specification](https://en.cppreference.com/w/cpp/utility/format/spec). For example, `#!cpp (x.price(): <10.2f)$` evaluates `x.price()` and converts the result to a string with 10-character width, 2 digits of precision, and left-justified.
386-

docs/cpp2/metafunctions.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ Unlike C `#!cpp union`, this `@union` is safe to use because it always ensures o
337337

338338
Unlike C++11 `std::variant`, this `@union` is easier to use because its alternatives are anonymous, and safer to use because each union type is a distinct type. [^variant]
339339

340-
Each `@union` type has its own type-safe name, has clear and unambiguous named members, and safely encapsulates a discriminator to rule them all. Sure, it uses unsafe casts in the implementation, but they are fully encapsulated, where they can be tested once and be safe in all uses.
340+
Each `@union` type has its own type-safe name, has clear and unambiguous named members, and safely encapsulates a discriminator to rule them all. It uses type-unsafe casts in the implementation, but they are fully encapsulated, where they can be tested once and be safe in all uses.
341341

342342
Because a `@union type` is still a `type`, it can naturally have other things normal types can have, such as template parameter lists and member functions:
343343

docs/welcome/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ main: () = {
2525

2626
We can't make an improvement that large to C++ via gradual evolution to today's syntax, because some important changes would require changing the meaning of code written in today's syntax. For example, we can never change a language feature default in today's syntax, not even if the default creates a security vulnerability pitfall, because changing a default would break vast swathes of existing code. Having a distinct alternative syntax gives us a "bubble of new code" that doesn't exist today, and have:
2727

28-
- **Freedom to make any desired improvement, without breaking any of today's code.** Cpp2 is designed to take all the consensus C++ best-practices guidance we already teach, and make them the default when using "syntax 2." Examples: Writing unsafe type casts is just not possible in Cpp2 syntax; and Cpp2 can change language defaults to make them simpler and safer. You can always "break the glass" when needed to violate the guidance, but you have to opt out explicitly to write unsafe code, so if the program has a bug you can grep for those places to look at first. For details, see [Design note: unsafe code](https://github.com/hsutter/cppfront/wiki/Design-note%3A-Unsafe-code).
28+
- **Freedom to make any desired improvement, without breaking any of today's code.** Cpp2 is designed to take all the consensus C++ best-practices guidance we already teach, and make them the default when using "syntax 2." Examples: Writing type-unsafe casts is just not possible in Cpp2 syntax; and Cpp2 can change language defaults to make them simpler and safer. You can always "break the glass" when needed to violate the guidance, but you have to opt out explicitly to write type-unsafe code (usually using the word `unchecked`), so if the program has a bug you can grep for those places to look at first. For details, see [Design note: unsafe code](https://github.com/hsutter/cppfront/wiki/Design-note%3A-Unsafe-code).
2929

3030
- **Perfect link compatibility always on, perfect source compatibility always available (but you pay for it only if you use it).** Any type/function/object/namespace written in either syntax is always still just a normal C++ type/function/object/namespace, so any code or library written in either Cpp2 or today's C++ syntax ("Cpp1" for short) can seamlessly call each other, with no wrapping/marshaling/thunking. You can write a "mixed" source file that has both Cpp2 and Cpp1 code and get perfect backward C++ source compatibility (even SFINAE and macros), or you can write a "pure" all-Cpp2 source file and write code in a 10x simpler syntax.
3131

include/cpp2regex.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -690,14 +690,14 @@ template <typename Iter> match_return<Iter>::match_return(){}
690690
if (cpp2::impl::cmp_greater_eq(group,max_groups) || !(CPP2_ASSERT_IN_BOUNDS(groups, group).matched)) {
691691
return 0;
692692
}
693-
return cpp2::unsafe_narrow<int>(std::distance(begin, CPP2_ASSERT_IN_BOUNDS(groups, group).end));
693+
return cpp2::unchecked_narrow<int>(std::distance(begin, CPP2_ASSERT_IN_BOUNDS(groups, group).end));
694694
}
695695
#line 85 "cpp2regex.h2"
696696
template <typename CharT, typename Iter, int max_groups> [[nodiscard]] auto match_context<CharT,Iter,max_groups>::get_group_start(auto const& group) const& -> int{
697697
if (cpp2::impl::cmp_greater_eq(group,max_groups) || !(CPP2_ASSERT_IN_BOUNDS(groups, group).matched)) {
698698
return 0;
699699
}
700-
return cpp2::unsafe_narrow<int>(std::distance(begin, CPP2_ASSERT_IN_BOUNDS(groups, group).start));
700+
return cpp2::unchecked_narrow<int>(std::distance(begin, CPP2_ASSERT_IN_BOUNDS(groups, group).start));
701701
}
702702
#line 91 "cpp2regex.h2"
703703
template <typename CharT, typename Iter, int max_groups> [[nodiscard]] auto match_context<CharT,Iter,max_groups>::get_group_string(auto const& group) const& -> std::string{
@@ -1109,7 +1109,7 @@ template<typename CharT, bool negate> [[nodiscard]] auto word_boundary_token_mat
11091109
template <typename CharT, typename matcher_wrapper> template <typename Iter> regular_expression<CharT,matcher_wrapper>::search_return<Iter>::search_return(cpp2::impl::in<bool> matched_, context<Iter> const& ctx_, Iter const& pos_)
11101110
: matched{ matched_ }
11111111
, ctx{ ctx_ }
1112-
, pos{ cpp2::unsafe_narrow<int>(std::distance(ctx_.begin, pos_)) }{
1112+
, pos{ cpp2::unchecked_narrow<int>(std::distance(ctx_.begin, pos_)) }{
11131113

11141114
#line 693 "cpp2regex.h2"
11151115
}

include/cpp2regex.h2

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,13 +80,13 @@ match_context: <CharT, Iter, max_groups: int> type =
8080
if group >= max_groups || !groups[group].matched {
8181
return 0;
8282
}
83-
return cpp2::unsafe_narrow<int>( std::distance(begin, groups[group].end) );
83+
return cpp2::unchecked_narrow<int>( std::distance(begin, groups[group].end) );
8484
}
8585
get_group_start: (in this, group) -> int = {
8686
if group >= max_groups || !groups[group].matched {
8787
return 0;
8888
}
89-
return cpp2::unsafe_narrow<int>( std::distance(begin, groups[group].start) );
89+
return cpp2::unchecked_narrow<int>( std::distance(begin, groups[group].start) );
9090
}
9191
get_group_string: (in this, group) -> std::string = {
9292
if group >= max_groups || !groups[group].matched {
@@ -689,7 +689,7 @@ regular_expression: <CharT, matcher_wrapper> type =
689689
operator=:(out this, matched_: bool, ctx_: context<Iter>, pos_: Iter) = {
690690
matched = matched_;
691691
ctx = ctx_;
692-
pos = unsafe_narrow<int>(std::distance(ctx_.begin, pos_));
692+
pos = unchecked_narrow<int>(std::distance(ctx_.begin, pos_));
693693
}
694694

695695
group_number: (this) = ctx..size();

include/cpp2util.h

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2290,12 +2290,12 @@ class finally_presuccess
22902290

22912291
//-----------------------------------------------------------------------
22922292
//
2293-
// An implementation of GSL's narrow_cast with a clearly 'unsafe' name
2293+
// An implementation of GSL's narrow_cast with a clearly 'unchecked' name
22942294
//
22952295
//-----------------------------------------------------------------------
22962296
//
22972297
template <typename C, typename X>
2298-
constexpr auto unsafe_narrow( X x ) noexcept
2298+
constexpr auto unchecked_narrow( X x ) noexcept
22992299
-> decltype(auto)
23002300
requires (
23012301
impl::is_narrowing_v<C, X>
@@ -2310,7 +2310,7 @@ constexpr auto unsafe_narrow( X x ) noexcept
23102310

23112311

23122312
template <typename C, typename X>
2313-
constexpr auto unsafe_cast( X&& x ) noexcept
2313+
constexpr auto unchecked_cast( X&& x ) noexcept
23142314
-> decltype(auto)
23152315
{
23162316
return static_cast<C>(CPP2_FORWARD(x));
@@ -2364,7 +2364,7 @@ struct args
23642364
constexpr auto end() const -> iterator { return iterator{ argc, argv, argc }; }
23652365
constexpr auto cbegin() const -> iterator { return begin(); }
23662366
constexpr auto cend() const -> iterator { return end(); }
2367-
constexpr auto size() const -> std::size_t { return cpp2::unsafe_narrow<std::size_t>(ssize()); }
2367+
constexpr auto size() const -> std::size_t { return cpp2::unchecked_narrow<std::size_t>(ssize()); }
23682368
constexpr auto ssize() const -> std::ptrdiff_t { return argc; }
23692369

23702370
constexpr auto operator[](int i) const {
@@ -2496,7 +2496,7 @@ class range
24962496
return curr;
24972497
}
24982498
else {
2499-
return unsafe_narrow<T>(curr);
2499+
return unchecked_narrow<T>(curr);
25002500
}
25012501
}
25022502
else {
@@ -2518,7 +2518,7 @@ class range
25182518
return curr + i;
25192519
}
25202520
else {
2521-
return unsafe_narrow<T>(curr + i);
2521+
return unchecked_narrow<T>(curr + i);
25222522
}
25232523
}
25242524
else {
@@ -2548,7 +2548,7 @@ class range
25482548
constexpr auto end() const -> const_iterator { return iterator{ first, last, last }; }
25492549
constexpr auto begin() -> iterator { return iterator{ first, last, first }; }
25502550
constexpr auto end() -> iterator { return iterator{ first, last, last }; }
2551-
constexpr auto size() const -> std::size_t { return unsafe_narrow<std::size_t>(ssize()); }
2551+
constexpr auto size() const -> std::size_t { return unchecked_narrow<std::size_t>(ssize()); }
25522552
constexpr auto ssize() const -> std::ptrdiff_t { return last - first; }
25532553
constexpr auto empty() const -> bool { return first == last; }
25542554

@@ -2558,7 +2558,7 @@ class range
25582558
return first;
25592559
}
25602560
else {
2561-
return unsafe_narrow<T>(first);
2561+
return unchecked_narrow<T>(first);
25622562
}
25632563
}
25642564

@@ -2569,7 +2569,7 @@ class range
25692569
return --ret;
25702570
}
25712571
else {
2572-
auto ret = unsafe_narrow<T>(last);
2572+
auto ret = unchecked_narrow<T>(last);
25732573
return --ret;
25742574
}
25752575
}
@@ -2581,7 +2581,7 @@ class range
25812581
return first + i;
25822582
}
25832583
else {
2584-
return unsafe_narrow<T>(first + i);
2584+
return unchecked_narrow<T>(first + i);
25852585
}
25862586
}
25872587
else {
@@ -2745,7 +2745,7 @@ CPP2_FORCE_INLINE constexpr auto cmp_mixed_signedness_check() -> void
27452745
// static_assert to reject the comparison is the right way to go.
27462746
static_assert(
27472747
program_violates_type_safety_guarantee<T, U>,
2748-
"mixed signed/unsigned comparison is unsafe - prefer using .ssize() instead of .size(), consider using std::cmp_less instead, or consider explicitly casting one of the values to change signedness by using 'as' or 'cpp2::unsafe_narrow'"
2748+
"mixed signed/unsigned comparison is unsafe - prefer using .ssize() instead of .size(), consider using std::cmp_less instead, or consider explicitly casting one of the values to change signedness by using 'as' or 'cpp2::unchecked_narrow'"
27492749
);
27502750
}
27512751
}
@@ -2842,14 +2842,14 @@ constexpr auto as_( auto&& x ) -> decltype(auto)
28422842
if constexpr (is_narrowing_v<C, CPP2_TYPEOF(x)>) {
28432843
static_assert(
28442844
program_violates_type_safety_guarantee<C, CPP2_TYPEOF(x)>,
2845-
"'as' does not allow unsafe possibly-lossy narrowing conversions - if you're sure you want this, use 'unsafe_narrow<T>' to explicitly force the conversion and possibly lose information"
2845+
"'as' does not allow unsafe possibly-lossy narrowing conversions - if you're sure you want this, use 'unchecked_narrow<T>' to explicitly force the conversion and possibly lose information"
28462846
);
28472847
}
28482848
else if constexpr (is_unsafe_pointer_conversion_v<C, CPP2_TYPEOF(x)>)
28492849
{
28502850
static_assert(
28512851
program_violates_type_safety_guarantee<C, CPP2_TYPEOF(x)>,
2852-
"'as' does not allow unsafe pointer conversions - if you're sure you want this, use `unsafe_cast<T>()` to explicitly force the unsafe cast"
2852+
"'as' does not allow unsafe pointer conversions - if you're sure you want this, use `unchecked_cast<T>()` to explicitly force the cast"
28532853
);
28542854
}
28552855
else if constexpr( std::is_same_v< CPP2_TYPEOF(as<C>(CPP2_FORWARD(x))), nonesuch_ > ) {
@@ -2869,7 +2869,7 @@ constexpr auto as_() -> decltype(auto)
28692869
if constexpr( std::is_same_v< CPP2_TYPEOF((as<C, x>())), nonesuch_ > ) {
28702870
static_assert(
28712871
program_violates_type_safety_guarantee<C, CPP2_TYPEOF(x)>,
2872-
"'as' does not allow unsafe possibly-lossy narrowing conversions - if you're sure you want this, use `unsafe_narrow<T>()` to explicitly force the conversion and possibly lose information"
2872+
"'as' does not allow unsafe possibly-lossy narrowing conversions - if you're sure you want this, use `unchecked_narrow<T>()` to explicitly force the conversion and possibly lose information"
28732873
);
28742874
}
28752875
}

regression-tests/pure2-regex_01_char_matcher.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ create_result: (resultExpr: std::string, r) -> std::string = {
8484

8585
if next* == '-' || next* == '+' {
8686
i := 0;
87-
while i < cpp2::unsafe_narrow<int>(r.group_number()) next i++ {
87+
while i < cpp2::unchecked_narrow<int>(r.group_number()) next i++ {
8888
pos := 0;
8989
if next* == '-' {
9090
pos = r.group_start(i);

regression-tests/pure2-regex_02_ranges.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ create_result: (resultExpr: std::string, r) -> std::string = {
8484

8585
if next* == '-' || next* == '+' {
8686
i := 0;
87-
while i < cpp2::unsafe_narrow<int>(r.group_number()) next i++ {
87+
while i < cpp2::unchecked_narrow<int>(r.group_number()) next i++ {
8888
pos := 0;
8989
if next* == '-' {
9090
pos = r.group_start(i);

regression-tests/pure2-regex_03_wildcard.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ create_result: (resultExpr: std::string, r) -> std::string = {
8484

8585
if next* == '-' || next* == '+' {
8686
i := 0;
87-
while i < cpp2::unsafe_narrow<int>(r.group_number()) next i++ {
87+
while i < cpp2::unchecked_narrow<int>(r.group_number()) next i++ {
8888
pos := 0;
8989
if next* == '-' {
9090
pos = r.group_start(i);

regression-tests/pure2-regex_04_start_end.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ create_result: (resultExpr: std::string, r) -> std::string = {
8484

8585
if next* == '-' || next* == '+' {
8686
i := 0;
87-
while i < cpp2::unsafe_narrow<int>(r.group_number()) next i++ {
87+
while i < cpp2::unchecked_narrow<int>(r.group_number()) next i++ {
8888
pos := 0;
8989
if next* == '-' {
9090
pos = r.group_start(i);

regression-tests/pure2-regex_05_classes.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ create_result: (resultExpr: std::string, r) -> std::string = {
8484

8585
if next* == '-' || next* == '+' {
8686
i := 0;
87-
while i < cpp2::unsafe_narrow<int>(r.group_number()) next i++ {
87+
while i < cpp2::unchecked_narrow<int>(r.group_number()) next i++ {
8888
pos := 0;
8989
if next* == '-' {
9090
pos = r.group_start(i);

regression-tests/pure2-regex_06_boundaries.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ create_result: (resultExpr: std::string, r) -> std::string = {
8484

8585
if next* == '-' || next* == '+' {
8686
i := 0;
87-
while i < cpp2::unsafe_narrow<int>(r.group_number()) next i++ {
87+
while i < cpp2::unchecked_narrow<int>(r.group_number()) next i++ {
8888
pos := 0;
8989
if next* == '-' {
9090
pos = r.group_start(i);

regression-tests/pure2-regex_07_short_classes.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ create_result: (resultExpr: std::string, r) -> std::string = {
8484

8585
if next* == '-' || next* == '+' {
8686
i := 0;
87-
while i < cpp2::unsafe_narrow<int>(r.group_number()) next i++ {
87+
while i < cpp2::unchecked_narrow<int>(r.group_number()) next i++ {
8888
pos := 0;
8989
if next* == '-' {
9090
pos = r.group_start(i);

regression-tests/pure2-regex_08_alternatives.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ create_result: (resultExpr: std::string, r) -> std::string = {
8484

8585
if next* == '-' || next* == '+' {
8686
i := 0;
87-
while i < cpp2::unsafe_narrow<int>(r.group_number()) next i++ {
87+
while i < cpp2::unchecked_narrow<int>(r.group_number()) next i++ {
8888
pos := 0;
8989
if next* == '-' {
9090
pos = r.group_start(i);

regression-tests/pure2-regex_09_groups.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ create_result: (resultExpr: std::string, r) -> std::string = {
8484

8585
if next* == '-' || next* == '+' {
8686
i := 0;
87-
while i < cpp2::unsafe_narrow<int>(r.group_number()) next i++ {
87+
while i < cpp2::unchecked_narrow<int>(r.group_number()) next i++ {
8888
pos := 0;
8989
if next* == '-' {
9090
pos = r.group_start(i);

regression-tests/pure2-regex_10_escapes.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ create_result: (resultExpr: std::string, r) -> std::string = {
8484

8585
if next* == '-' || next* == '+' {
8686
i := 0;
87-
while i < cpp2::unsafe_narrow<int>(r.group_number()) next i++ {
87+
while i < cpp2::unchecked_narrow<int>(r.group_number()) next i++ {
8888
pos := 0;
8989
if next* == '-' {
9090
pos = r.group_start(i);

regression-tests/pure2-regex_11_group_references.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ create_result: (resultExpr: std::string, r) -> std::string = {
8484

8585
if next* == '-' || next* == '+' {
8686
i := 0;
87-
while i < cpp2::unsafe_narrow<int>(r.group_number()) next i++ {
87+
while i < cpp2::unchecked_narrow<int>(r.group_number()) next i++ {
8888
pos := 0;
8989
if next* == '-' {
9090
pos = r.group_start(i);

regression-tests/pure2-regex_12_case_insensitive.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ create_result: (resultExpr: std::string, r) -> std::string = {
8484

8585
if next* == '-' || next* == '+' {
8686
i := 0;
87-
while i < cpp2::unsafe_narrow<int>(r.group_number()) next i++ {
87+
while i < cpp2::unchecked_narrow<int>(r.group_number()) next i++ {
8888
pos := 0;
8989
if next* == '-' {
9090
pos = r.group_start(i);

regression-tests/pure2-regex_13_possessive_modifier.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ create_result: (resultExpr: std::string, r) -> std::string = {
8484

8585
if next* == '-' || next* == '+' {
8686
i := 0;
87-
while i < cpp2::unsafe_narrow<int>(r.group_number()) next i++ {
87+
while i < cpp2::unchecked_narrow<int>(r.group_number()) next i++ {
8888
pos := 0;
8989
if next* == '-' {
9090
pos = r.group_start(i);

regression-tests/pure2-regex_14_multiline_modifier.cpp2

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ create_result: (resultExpr: std::string, r) -> std::string = {
8484

8585
if next* == '-' || next* == '+' {
8686
i := 0;
87-
while i < cpp2::unsafe_narrow<int>(r.group_number()) next i++ {
87+
while i < cpp2::unchecked_narrow<int>(r.group_number()) next i++ {
8888
pos := 0;
8989
if next* == '-' {
9090
pos = r.group_start(i);

0 commit comments

Comments
 (0)