2024-11-08 08:26:27 +00:00
|
|
|
// Copyright (C) 2024 The Qt Company Ltd.
|
|
|
|
// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR GPL-3.0-only
|
|
|
|
|
|
|
|
pragma Strict
|
|
|
|
|
|
|
|
import QtQml
|
|
|
|
import TestTypes as T
|
|
|
|
|
|
|
|
T.UsingUserObject {
|
|
|
|
id: self
|
|
|
|
property int valA: val.a
|
2024-11-11 15:30:36 +00:00
|
|
|
property int valB: val.getB()
|
2024-11-08 08:26:27 +00:00
|
|
|
property int myA: a
|
QtQml: Fix calling of method with QML_USING types
On the engine side, types made available with QML_USING are recognizable
by their QMetaType conversions. In order to actually call the right
methods, we need to slightly prefer methods to whose arguments we can
convert over ones we have not idea about. This, however, adds the
problem of converting to QString, double, QVariant and QJSValue, which
is possible for any type. Since such conversions are less specific than
manually added converters, we de-prioritize them a bit.
On the compiler side we need to transmit the knowledge about the
overload to be called from the compiler (which has already done its own
overload selection) to the lookup methods. This is easily done using the
relative method index. This way we do not need to do any run time
overload selection at all and we do not need to pass any types to the
lookup methods. We can do this without further compatibility adaptations
because the current version of those lookup methods was only introduced
in 6.9.
Excluded, of course, are shadowable calls, which are performed with only
QVariant arguments. These carry the arguments themselves and trigger the
engine's overload selection. Internally nothing changes about them.
Passing a list of QMetaType::fromType<QVariant>() to the lookup methods
for them has always been a waste.
Only the engine changes are relevant for 6.8. In 6.8, the lookup methods
defer the overload selection to the engine and take the types on every
call. We still cannot separate the engine changes from the compiler
changes in dev because the same test is run once in interpreted and once
in compiled mode.
Pick-to: 6.8
Task-number: QTBUG-127174
Change-Id: I6ab52ddf3be65dcc94547266c5dcc5ac1050c93c
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2024-11-08 16:00:38 +00:00
|
|
|
property int myB: getB()
|
2024-11-08 08:26:27 +00:00
|
|
|
property int myA2: self.a
|
QtQml: Fix calling of method with QML_USING types
On the engine side, types made available with QML_USING are recognizable
by their QMetaType conversions. In order to actually call the right
methods, we need to slightly prefer methods to whose arguments we can
convert over ones we have not idea about. This, however, adds the
problem of converting to QString, double, QVariant and QJSValue, which
is possible for any type. Since such conversions are less specific than
manually added converters, we de-prioritize them a bit.
On the compiler side we need to transmit the knowledge about the
overload to be called from the compiler (which has already done its own
overload selection) to the lookup methods. This is easily done using the
relative method index. This way we do not need to do any run time
overload selection at all and we do not need to pass any types to the
lookup methods. We can do this without further compatibility adaptations
because the current version of those lookup methods was only introduced
in 6.9.
Excluded, of course, are shadowable calls, which are performed with only
QVariant arguments. These carry the arguments themselves and trigger the
engine's overload selection. Internally nothing changes about them.
Passing a list of QMetaType::fromType<QVariant>() to the lookup methods
for them has always been a waste.
Only the engine changes are relevant for 6.8. In 6.8, the lookup methods
defer the overload selection to the engine and take the types on every
call. We still cannot separate the engine changes from the compiler
changes in dev because the same test is run once in interpreted and once
in compiled mode.
Pick-to: 6.8
Task-number: QTBUG-127174
Change-Id: I6ab52ddf3be65dcc94547266c5dcc5ac1050c93c
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2024-11-08 16:00:38 +00:00
|
|
|
property int myB2: self.getB()
|
2024-11-08 08:26:27 +00:00
|
|
|
|
2024-11-20 08:55:31 +00:00
|
|
|
property var valU: val.u
|
|
|
|
property var myU: u
|
|
|
|
property var myU2: self.u
|
|
|
|
|
|
|
|
property var huge: 4294967295
|
|
|
|
property var impossible: "impossible"
|
|
|
|
|
2024-11-08 08:26:27 +00:00
|
|
|
function twiddle() {
|
|
|
|
val.a = 55
|
2024-11-11 15:30:36 +00:00
|
|
|
val.setB(56)
|
2024-11-08 08:26:27 +00:00
|
|
|
a = 57
|
QtQml: Fix calling of method with QML_USING types
On the engine side, types made available with QML_USING are recognizable
by their QMetaType conversions. In order to actually call the right
methods, we need to slightly prefer methods to whose arguments we can
convert over ones we have not idea about. This, however, adds the
problem of converting to QString, double, QVariant and QJSValue, which
is possible for any type. Since such conversions are less specific than
manually added converters, we de-prioritize them a bit.
On the compiler side we need to transmit the knowledge about the
overload to be called from the compiler (which has already done its own
overload selection) to the lookup methods. This is easily done using the
relative method index. This way we do not need to do any run time
overload selection at all and we do not need to pass any types to the
lookup methods. We can do this without further compatibility adaptations
because the current version of those lookup methods was only introduced
in 6.9.
Excluded, of course, are shadowable calls, which are performed with only
QVariant arguments. These carry the arguments themselves and trigger the
engine's overload selection. Internally nothing changes about them.
Passing a list of QMetaType::fromType<QVariant>() to the lookup methods
for them has always been a waste.
Only the engine changes are relevant for 6.8. In 6.8, the lookup methods
defer the overload selection to the engine and take the types on every
call. We still cannot separate the engine changes from the compiler
changes in dev because the same test is run once in interpreted and once
in compiled mode.
Pick-to: 6.8
Task-number: QTBUG-127174
Change-Id: I6ab52ddf3be65dcc94547266c5dcc5ac1050c93c
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2024-11-08 16:00:38 +00:00
|
|
|
setB(58)
|
2024-11-08 08:26:27 +00:00
|
|
|
self.a = 59
|
QtQml: Fix calling of method with QML_USING types
On the engine side, types made available with QML_USING are recognizable
by their QMetaType conversions. In order to actually call the right
methods, we need to slightly prefer methods to whose arguments we can
convert over ones we have not idea about. This, however, adds the
problem of converting to QString, double, QVariant and QJSValue, which
is possible for any type. Since such conversions are less specific than
manually added converters, we de-prioritize them a bit.
On the compiler side we need to transmit the knowledge about the
overload to be called from the compiler (which has already done its own
overload selection) to the lookup methods. This is easily done using the
relative method index. This way we do not need to do any run time
overload selection at all and we do not need to pass any types to the
lookup methods. We can do this without further compatibility adaptations
because the current version of those lookup methods was only introduced
in 6.9.
Excluded, of course, are shadowable calls, which are performed with only
QVariant arguments. These carry the arguments themselves and trigger the
engine's overload selection. Internally nothing changes about them.
Passing a list of QMetaType::fromType<QVariant>() to the lookup methods
for them has always been a waste.
Only the engine changes are relevant for 6.8. In 6.8, the lookup methods
defer the overload selection to the engine and take the types on every
call. We still cannot separate the engine changes from the compiler
changes in dev because the same test is run once in interpreted and once
in compiled mode.
Pick-to: 6.8
Task-number: QTBUG-127174
Change-Id: I6ab52ddf3be65dcc94547266c5dcc5ac1050c93c
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
2024-11-08 16:00:38 +00:00
|
|
|
self.setB(60)
|
2024-11-20 08:55:31 +00:00
|
|
|
|
|
|
|
val.u = 61
|
|
|
|
u = 62
|
|
|
|
self.u = 63
|
|
|
|
}
|
|
|
|
|
|
|
|
function burn() {
|
|
|
|
val.u = huge
|
|
|
|
u = huge
|
|
|
|
u = 64
|
|
|
|
self.u = huge
|
|
|
|
}
|
|
|
|
|
|
|
|
function impossibleValA() {
|
|
|
|
val.a = impossible
|
|
|
|
}
|
|
|
|
|
|
|
|
function impossibleA() {
|
|
|
|
a = impossible
|
|
|
|
}
|
|
|
|
|
|
|
|
function impossibleSelfA() {
|
|
|
|
self.a = impossible
|
|
|
|
}
|
|
|
|
|
|
|
|
function impossibleValU() {
|
|
|
|
val.u = impossible
|
|
|
|
}
|
|
|
|
|
|
|
|
function impossibleU() {
|
|
|
|
u = impossible
|
|
|
|
}
|
|
|
|
|
|
|
|
function impossibleSelfU() {
|
|
|
|
self.u = impossible
|
2024-11-08 08:26:27 +00:00
|
|
|
}
|
|
|
|
}
|