godotengine / godotengine/godot
Triple quoted strings cannot be compared to typical strings with the Expression class
- Dominant language
- C++
- Stars
- 117k
- Forks
- 26.8k
- PR merge metrics
- PR metrics pending
Description
### Tested versions
- Reproducible in v4.3.stable.artix_linux
### System information
Godot v4.3.stable unknown - Artix Linux
### Issue description
In the editor, if you compare a double quoted string to a triple double quoted string, they are equivalent.
If you use the Expression class to compare them, they are not equivalent.
I'm guessing it shouldn't matter whether it's a double, single, triple double or triple single quoted string. They should all be the same if the contents mean the same thing.
### Steps to reproduce
func evaluate():
if "x" == """x""":
print("sane")
else:
print("insane")
var xp = Expression.new()
var err = xp.parse('"x" == """x"""', [])
if err != OK:
push_error("failed to parse")
var res = xp.execute([])
if xp.has_execute_failed():
push_error(xp.get_error_text())
print('Does expression.execute() think they are the same?')
print(res)
Prints:
sane
Does expression.execute() think they are the same?
false
Should print:
sane
Does expression.execute() think they are the same?
true
For any combination of quote types.
### Minimal reproduction project (MRP)
[godot-quote-bug.zip](https://github.com/user-attachments/files/17501407/godot-quote-bug.zip)
Contributor guide
Research direction
Start with the Expression class's parse() and execute() entry points, using the attached godot-quote-bug.zip project to reproduce the discrepancy. Compare the handling of regular and triple-quoted strings in the provided expression. Done means Expression.execute() treats equivalent quote styles as equal, matching the editor result.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, godot
- Domain
- game-dev
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100