Skip to content
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

3 to 4 converter adds seemingly spurious ") #" #74171

Closed
Tracked by #73960
miv391 opened this issue Mar 1, 2023 · 1 comment · Fixed by #74567
Closed
Tracked by #73960

3 to 4 converter adds seemingly spurious ") #" #74171

miv391 opened this issue Mar 1, 2023 · 1 comment · Fixed by #74567

Comments

@miv391
Copy link
Contributor

miv391 commented Mar 1, 2023

Godot version

v4.0.stable.official [92bee43]

System information

Windows 10

Issue description

This Godot 3 line

assert(r.hash() == {"a":1, "b":2}.hash())

was converted to this:

assert(r.hash() == {"a":1) #,"b":2}.hash())

For some reason ) # is added after 1.

Steps to reproduce

Just converting Godot 3 project containing the line to Godot 4.

Minimal reproduction project

N/A

@Chubercik
Copy link
Contributor

it would seem this part of the converter's code is responsible for this:

if (line.contains("assert(")) {

the whole block looks like this:

//  assert(speed < 20, str(randi()%10))  ->  assert(speed < 20) #,str(randi()%10))    GDScript - GDScript bug constant message
if (line.contains("assert(")) {
    int start = line.find("assert(");
    int end = get_end_parenthesis(line.substr(start)) + 1;
    if (end > -1) {
        Vector<String> parts = parse_arguments(line.substr(start, end));
        if (parts.size() == 2) {
            line = line.substr(0, start) + "assert(" + parts[0] + ") " + line.substr(end + start) + "#," + parts[1] + ")";
        }
    }
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants