You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The string I got from a tuple compares inconsistently with values that should be exactly the same. Additionally, printing the string obtained from the tuple results in bogus characters.
See below for more details.
Steps to reproduce
Include relevant code snippet or link to code that did not work as expected.
I've come to the following minimal example:
alias T = SIMD[DType.int8, 1]
fn to_string(x: T) -> String:
return String(x)
fn to_string_with_tuple(x: T) -> Tuple[String]:
var y = to_string(x)
print("y in function:", y)
return (y,)
fn main():
var v: T = 123
print("v: ", v)
var y = to_string(v)
var out = to_string_with_tuple(v)
var y_from_tuple = out.get[0, String]()
if y_from_tuple != to_string(v):
print("y_from_tuple NOT EQUAL TO to_string(v)")
else:
print("y_from_tuple EQUAL TO to_string(v)")
if y_from_tuple != y:
print("y_from_tuple NOT EQUAL TO y")
else:
print("y_from_tuple EQUAL TO y")
print("y:", y)
print("to_string(v):", to_string(v))
print("y_from_tuple:", y_from_tuple)
Expectations:
I expect y_from_tuple, y, and String(v) to be equal in value
I expect the print function to print things with the same value in the same way
Results:
"y_from_tuple EQUAL TO to_string(v)" is printed, indicating they are equal. This is expected.
"y_from_tuple NOT EQUAL TO y" is printed, indicating they are not equal, this is unexpected since y is just to_string(v) stored in a variable.
"y: 123" and "to_string(v): 123" are printed as expected, but the final print statement prints bogus characters ("�" etc.) on my system. So even though y_from_tuple is equal in value to to_string(v) according to the if-statement, they print in a different way, the latter being printed correctly
If applicable, add screenshots to help explain the problem.
Not applicable.
If using the Playground, name the pre-existing notebook that failed and the steps that led to failure.
Not applicable.
Include anything else that might help us debug the issue.
Not applicable.
System information
- What OS did you do install Mojo on ?
Linux 6.5.0-35-generic #35~22.04.1-Ubuntu SMP PREEMPT_DYNAMIC Tue May 7 09:00:52 UTC 2 x86_64 x86_64 x86_64 GNU/Linux
- Provide version information for Mojo by pasting the output of `mojo -v`
mojo 24.3.0 (9882e19d)
- Provide Modular CLI version by pasting the output of `modular -v`
modular 0.8.0 (39a426b5)
The text was updated successfully, but these errors were encountered:
Bug description
The string I got from a tuple compares inconsistently with values that should be exactly the same. Additionally, printing the string obtained from the tuple results in bogus characters.
See below for more details.
Steps to reproduce
Include relevant code snippet or link to code that did not work as expected.
I've come to the following minimal example:
Expectations:
y_from_tuple
,y
, andString(v)
to be equal in valueResults:
y
is justto_string(v)
stored in a variable.y_from_tuple
is equal in value toto_string(v)
according to the if-statement, they print in a different way, the latter being printed correctlyIf applicable, add screenshots to help explain the problem.
Not applicable.
If using the Playground, name the pre-existing notebook that failed and the steps that led to failure.
Not applicable.
Include anything else that might help us debug the issue.
Not applicable.
System information
The text was updated successfully, but these errors were encountered: