aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2022-09-17 03:01:03 +0000
committerQt Forward Merge Bot <qt_forward_merge_bot@qt-project.org>2022-09-17 03:01:03 +0000
commit083ac1f8f33ef264e4e904a34c4cdbfaf8589e8b (patch)
tree5e4d614b5961d8392b4b2820fc670c222b4479fb
parent2b517f7c971272ed8faf50a760cdc5955ba9ce20 (diff)
parent5aaffdee4cc4821fd9a827954efcf5776a8842cc (diff)
Merge branch 6.3 into wip/6.3_pypy
-rw-r--r--tools/snippets_translate/converter.py2
-rw-r--r--tools/snippets_translate/tests/test_converter.py2
2 files changed, 3 insertions, 1 deletions
diff --git a/tools/snippets_translate/converter.py b/tools/snippets_translate/converter.py
index 92c89bdf6..a0650b3af 100644
--- a/tools/snippets_translate/converter.py
+++ b/tools/snippets_translate/converter.py
@@ -128,6 +128,8 @@ def snippet_translate(x):
# that include the string 'new'
if "new " in x:
x = x.replace("new ", "")
+ if not x.endswith(")"): # "new Foo" -> "new Foo()"
+ x += "()"
# Handle 'const'
# Some variables/functions have the word 'const' so we explicitly
diff --git a/tools/snippets_translate/tests/test_converter.py b/tools/snippets_translate/tests/test_converter.py
index d47ab9ef2..28436e846 100644
--- a/tools/snippets_translate/tests/test_converter.py
+++ b/tools/snippets_translate/tests/test_converter.py
@@ -100,7 +100,7 @@ def test_else():
def test_new():
assert st("a = new Something(...);") == "a = Something(...)"
- assert st("a = new Something") == "a = Something"
+ assert st("a = new Something") == "a = Something()"
def test_semicolon():