Skip to content

Fix string concat #543

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Oct 1, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/stdlib_string_type.fypp
Original file line number Diff line number Diff line change
Expand Up @@ -1082,7 +1082,7 @@ contains
type(string_type), intent(in) :: rhs
type(string_type) :: string

string%raw = maybe(rhs) // maybe(lhs)
string%raw = maybe(lhs) // maybe(rhs)

end function concat_string_string

Expand Down
14 changes: 9 additions & 5 deletions src/tests/string/test_string_operator.f90
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,15 @@ subroutine test_ne
end subroutine test_ne

subroutine test_concat
type(string_type) :: string

string = "Hello, "
string = string // "World!"
call check(len(string) == 13)
type(string_type) :: a, b

a = "a"
b = "b"
call check( "a" // b == "ab" )
call check( a // "b" == "ab" )
call check( a // b == "ab" )
call check( a // "" == "a" )
call check( "" // b == "b" )
end subroutine test_concat

end module test_string_operator
Expand Down