Skip to content

Syntax errors in Python code for constructor call #980

@lars-reimann

Description

@lars-reimann

Describe the bug

Syntactically wrong Python code is created for constructor calls if runner integration is enabled.

To Reproduce

Generate Python code with runner integration for this:

package tests.generator.safeds

pipeline test {
    val a = Table();
}

Output:

# Imports ----------------------------------------------------------------------

import safeds_runner
from safeds.data.tabular.containers import Table

# Pipelines --------------------------------------------------------------------

def test():
    a = safeds_runner.memoized_call("safeds.data.tabular.containers.Table", Table, [, None], [])
    safeds_runner.save_placeholder('a', a)

[, None] is not syntactically correct. Before the comma, an empty thisParam is inserted.

Expected behavior

The following code should be created:

# Imports ----------------------------------------------------------------------

import safeds_runner
from safeds.data.tabular.containers import Table

# Pipelines --------------------------------------------------------------------

def test():
    a = safeds_runner.memoized_call("safeds.data.tabular.containers.Table", Table, [None], [])
    safeds_runner.save_placeholder('a', a)

Screenshots (optional)

No response

Additional Context (optional)

No response

Metadata

Metadata

Assignees

Labels

releasedIncluded in a release

Type

No type

Projects

Status

✔️ Done

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions