-
Bug
-
Resolution: Unresolved
-
P2: Important
-
6.10.0
-
None
I noticed some weird behaviour when annotating functions inside an Item and inside a another function. I wasn't find any reference in the wiki mentioning this behaviour. When annotating a parameter without also annotating the return type following error is logged:
Error: $FILENAME $VALUE should be coerced to void because the function called is insufficiently annotated. The original value is retained. This will change in a future version of Qt.
However if a function declaration inside a function annotates a function parameter annotating the return type does not resolve this issue. Below is an example that illustrates the behaviour:
Item
{
function test0(layerIndex) // fine
{ return 0; }
function test1(layerIndex : int) // not fine
{ return 0; }
function test2(layerIndex) : int // fine
{ return 0; }
function test3(layerIndex : int) : int // fine
{ return 0; }
Component.onCompleted: {
function test4(layerIndex) // fine
{ return 0; }
function test5(layerIndex) : int // fine
{ return 0; }
function test6(layerIndex : int) // not fine
{ return 0; }
function test7(layerIndex : int) : int // not fine
{ return 0; }
var x = 0;
x = test0();
x = test1(); // fail
x = test2();
x = test3();
x = test4();
x = test5();
x = test6(); // fail
x = test7(); // fail
}
}
- relates to
-
QTBUG-138845 [REG 6.2 → 6.3] qmllint ignores lambda
-
- Closed
-