Details
-
Suggestion
-
Resolution: Out of scope
-
P4: Low
-
4.7.1
-
None
Description
Probably low prio:
If (see attachement) TestClass has the following two slots:
QString testFunction(const QString & s) QString testFunction2(const QString & s, int i)
then calling in javascript in qml "console.log(instance.testFunction2(7));" would correctly lead to an error message (too few args), but::
console.log(instance.testFunction(2)); console.log(instance.testFunction(-5, "500")); console.log(instance.testFunction(3, "300", 30)); console.log(instance.testFunction2(-8, "800")); console.log(instance.testFunction2(9, "900", 90));
leads to:
passed arg was(2) passed arg was(-5) passed arg was(3) passed args were(-8, 800) passed args were(9, 900)
=> it would be great if qml at least warned about too many arguments.
Example: imagine that you used to have function f(int, QString) and you now replace it with a one-argument function f(QString). If in a larger project you would miss one .qml file and an old call f(1, "abc") would still be there, then there would be no warning at all from qml when using this .qml file.
(additionally: maybe it would be possible to warn about implicit casts? e.g. in above examples I pass integers as arguments to a function which expects a string etc. => it would be nice to get notified about this [for example. this might indicate a wrong order of arguments in the calling javascript code etc.] but it is less important and probably mode tricky to implement than the above, i.e. a warning about wrong number of args)