Skip to content

Commit

Permalink
CI Add explanatory comments to type safety tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jarzec committed Aug 25, 2024
1 parent 7e21145 commit cce9711
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions regression-tests/mixed-type-safety-1.cpp2
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ print: ( msg: std::string, b: bool ) =

main: () -> int =
{
// Full qualification is necessary to avoid ambiguity in C++23
// C++23 defines std::print, which would be picked up here by ADL
::print( "1.1 is int? ", 1.1 is int );
::print( "1 is int? ", 1 is int );

Expand Down
2 changes: 2 additions & 0 deletions regression-tests/pure2-type-safety-1.cpp2
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ main: () -> int =

test_generic: ( x, msg ) = {
msgx: std::string = msg;
// Full qualification is necessary to avoid ambiguity in C++23
// C++23 defines std::print, which would be picked up here by ADL
::print( msgx + " is int? ", x is int );
}

Expand Down
2 changes: 2 additions & 0 deletions regression-tests/test-results/mixed-type-safety-1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,8 @@ auto print(cpp2::impl::in<std::string> msg, cpp2::impl::in<bool> b) -> void
#line 28 "mixed-type-safety-1.cpp2"
[[nodiscard]] auto main() -> int
{
// Full qualification is necessary to avoid ambiguity in C++23
// C++23 defines std::print, which would be picked up here by ADL
::print("1.1 is int? ", cpp2::impl::is<int>(1.1));
::print( "1 is int? ", cpp2::impl::is<int>(1));

Expand Down
8 changes: 5 additions & 3 deletions regression-tests/test-results/pure2-type-safety-1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,9 @@
#line 24 "pure2-type-safety-1.cpp2"
auto test_generic(auto const& x, auto const& msg) -> void;

#line 29 "pure2-type-safety-1.cpp2"
#line 31 "pure2-type-safety-1.cpp2"
auto print(cpp2::impl::in<std::string> msg, cpp2::impl::in<bool> b) -> void;
#line 35 "pure2-type-safety-1.cpp2"
#line 37 "pure2-type-safety-1.cpp2"

#line 1 "pure2-type-safety-1.cpp2"

Expand Down Expand Up @@ -55,10 +55,12 @@ auto print(cpp2::impl::in<std::string> msg, cpp2::impl::in<bool> b) -> void;
#line 24 "pure2-type-safety-1.cpp2"
auto test_generic(auto const& x, auto const& msg) -> void{
std::string msgx {msg};
// Full qualification is necessary to avoid ambiguity in C++23
// C++23 defines std::print, which would be picked up here by ADL
::print(cpp2::move(msgx) + " is int? ", cpp2::impl::is<int>(x));
}

#line 29 "pure2-type-safety-1.cpp2"
#line 31 "pure2-type-safety-1.cpp2"
auto print(cpp2::impl::in<std::string> msg, cpp2::impl::in<bool> b) -> void{
cpp2::impl::deferred_init<char const*> bmsg;
if (b) { bmsg.construct("true");}
Expand Down

0 comments on commit cce9711

Please sign in to comment.