| Commit message (Collapse) | Author | Age | Files | Lines |
| ... | |
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
If a type with required properties is accessed via a grouped scope, we
can't know whether the object already exists, or whether it would need
to be created.
Avoid false positives and don't emit a warning when we encounter a
grouped property scope, or any non-QML scope. Non-grouped, non-QML
scopes should not trigger the issue, but don't need to be checked
either, avoiding some needless work.
As a drive-by change, don't put spaces into a data test tag (which does
not play nice with running the test separately).
Amends daf57e29de918b7b4be7bb0d469db0c51d41bb07
Pick-to: 6.8 6.9 6.5
Fixes: QTBUG-134887
Change-Id: I747239c5d72993cf9a1563c875cefaf89c8e52a2
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
| |
Complain about ids in qmllint that start with an upper case letter.
Task-number: QTBUG-129307
Change-Id: I4cee3201d369692ead60cfcdebacf587b6d73491
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
| |
Warn for assignments inside of if-statement conditions.
Task-number: QTBUG-129307
Change-Id: If1e4d85b6cdbf4f076d91dcf8d7600988f51d6a1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
Implement the ErrInvalidEnumValue complaining about enum keys being
lowercased or duplicated. Change the warning message as the Qt Creator
code has a comment indicating that the message should be changed.
Task-number: QTBUG-129307
Change-Id: If0b72eab38124453f90eb9a52e126bf9f24c83b7
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
| |
Change-Id: Ib83c8d3452d5a0521295750f068f429b414da6ff
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
Add a warning about variable redeclaration for 'let' and 'const'
variables: they are not allowed in JS.
Fixes: QTBUG-127107
Pick-to: 6.8 6.9
Change-Id: I44ba50e436b0b396a089bc8aedcef31d5455e48a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Fix QQmlJSImportVisitor to register the scope into its QQmlJSImporter.
This is important to avoid scope duplication.
Before this patch, the implicit directory import that
QQmlJSImportVisitor processes via QQmlJSImporter would create a
duplicate "lazy" scope that reads from the file on disk during
population.
With this patch, QQmlJSImporter will know the current scope and
therefore won't duplicate it during the implicit directory import.
Add a test to qmlls to make sure that it can lint enums correctly, even
if the enum declaration does not exist on the on-disk version.
Avoid warnings while resolving scopes by marking the currently to be
populated scope with the '$InProcess$' baseTypeName. It will be
populated (including with its real base type name) after the import
were processed.
Pick-to: 6.9 6.8
Fixes: QTBUG-134781
Change-Id: I05cc8f8cab9279ee07c4a48a1b467738354e11dd
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
It is currently not possilbe to have both type annotations and default
parameters.
As long as we don't implement support for them, qmllint should warn
about them.
Pick-to: 6.8 6.9
Task-number: QTBUG-104751
Change-Id: Ibec6f07f3ddb49f60ac20441a023e0c77d831422
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
| |
This works the same as the FINAL attribute to Q_PROPERTY.
Task-number: QTBUG-98320
Change-Id: Icc2cf1afb5354fd711770f7147ded853b74cd1da
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When a property is declared as required, it needs to be bound when
creating the component containing that type.
Required properties can be aliased just like any other property. Before
this patch, aliases targeting required properties would themselves be
marked as required. This is incorrect as this forces the aliased
required property to be set through the alias. It should be legal to
alias a required property and not set required value through the alias.
Therefore, stop marking the alias as required and instead check directly
that the required property is bound in some scope for each object
creation or that it is forwarded through a root-level alias. A required
property will now also be satisfied if it is set through an alias.
For this to work, a property alias now also stores its target scope and
target property name.
This change also adds checking for object definition bindings of the
following form. These weren't checked before but really should be.
```
QtObject {
property QtObject o: QtObject {
required property int i // was not checked
}
}
```
These changes affect the way qmltc enforces setting required properties.
Because it relied on aliases to required properties to be required
themselves, it will now fail to enforce certain required properties.
Created QTBUG-131777 and marked affected tests as QEXPECT_FAIL.
Fixes: QTBUG-127098
Pick-to: 6.9 6.8 6.5
Change-Id: Ib36a43fbf3cc9c79eba6db39cbaf8769f85e2b31
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
| |
While those properties may be of type Component, they don't have to. We
can in fact not resolve anything resembling an ID while inside one of
those objects because we cannot determine the component boundaries.
Amends commit dea8e38d95508acd67da997d0c2a9c91ef1bc887
Pick-to: 6.9 6.8
Fixes: QTBUG-133460
Change-Id: Iac7294166d38ce591c45c0d31b139a52eda70fc1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
At run time, not all the builtins are always available, but only those
hardcoded into the parser. If we always import all the builtins at
compile time, we introduce subtle errors when they shadow parts of the
JavaScript global object.
Now the builtins need to be actually imported. We cannot rely on the
magic that adds them to the root scope of each document anymore. To this
end, they need to become a regular module.
The builtins are now loaded using a qmldir, just like any other module.
The only thing special about is its "system" attribute which we now
take to mean "read jsroot.qmltypes". Furthermore, the builtins get a
"static" attribute so that we don't warn about them being unused. Even
though they can now technically be unused, we really want people to
still import them.
Pick-to: 6.9 6.8
Fixes: QTBUG-133461
Change-Id: I322e14ba85c939773d36143ca24e88a7c9db23f5
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add a new disabled mode to qqmljslogger that is used when warnings
emitted by qqmljsimportvisitor are actually not shown to the user. Add a
comment explaining the difference to a silenced logger (that still
processes warnings and can be used to generate a JSON representation of
the warnings) and a disabled logger (that does not contain any warning).
Disable the logger in QQmlJSTypeReader that is only used for the (lazy
file creation.
This avoids expensive didYouMean() calls that slow down the linter and
only create warnings that are ignored by the linter.
Also add some ifs to qqmljslogger to avoid any useless computations when
the logger is disabled anyway.
This commit makes the runtime of tst_qmllint_benchmark:onlyQdsLintPlugin
on qtdesign-studio/examples/DesignEffectsDemo/content/Gallery.ui.qml go
from 500ms to 135ms (mean over 3 iterations) when the QtDesign studio
modules import paths are unavailable.
Task-number: QTBUG-133349
Change-Id: I5abaa5e6776e39f2dee7f1a92577a240dd5c61c1
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
| |
Add the sourcelocation of the id to the qqmljsscope such that qmllint
plugins can emit warnings on the id of an QQmlSA::Element.
Task-number: QTBUG-129308
Change-Id: I166cf6dd63cec6bc59f29936ed65ad6ebf0505e3
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
This avoids a Q_ASSERT in the relation chain where we try to set the
sourcelocation of an id on a QQmlJSScope of type grouped property.
Task-number: QTBUG-129308
Change-Id: I3aab9bdef1b0aa6441e834426cedcc7eb0fafc3f
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
If we've warned about an import before, we probably can't properly
analyze its types and therefore won't find any usages for it. We should
then not warn about it being "unused".
Pick-to: 6.9 6.8
Task-number: QTBUG-124913
Change-Id: I83fd0b325e362b4f85f6fd22a86fb7c91ae54cf0
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
If a property cannot be found, we don't need to check its type or even
try to compile a binding for it. We also shouldn't claim a property
doesn't exist if we cannot find it. We may have failed to resolve the
type after all.
Pick-to: 6.9 6.8
Task-number: QTBUG-124913
Change-Id: I93ef12e888762ae03f8fa6b1bef2e8d04ba3d4b2
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Track the unresolved types in a central place and only warn once for
each of them. Make sure that we still mark them as wrapped in implicit
components even if we don't warn, though.
Realize that custom parser parents potentially obfuscate any types
defined inside their scope, not only the ones we look for when
setting bindings.
Pick-to: 6.9 6.8
Task-number: QTBUG-124913
Change-Id: I30d911dc92d1e4359db66671bf62393f2f852b6c
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
| |
... rather than once per binding.
Pick-to: 6.9 6.8
Task-number: QTBUG-127691
Change-Id: I632d3001138db1452119e5b97993c31c9a49638c
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
|
| |
|
|
|
|
|
|
|
| |
Instead of passing them around everywhere, use the ones we statically
know and only validate them when creating a new engine.
Task-number: QTBUG-131721
Change-Id: I7fb93d15eb6e4194c46249727bcf7a48f5dce730
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
| |
These are the actual global names as present in the global object. We
should use the same ones everywhere.
Change-Id: I4fb42f609b656019db5169fd4ea2b243feab18d6
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
In qmllint, the import warnings are printed right after the "warnings
occurred while importing" warning despite them having no sourcelocation.
This warning gets a default sourcelocation when used in qmlls which
points to the first line of the file, so the "Failed to import" warning
ends up an the first line of a file, and not on the same line as the
"warnings occurred while importing" warning. This is confusing for users.
Modify a test to expect that the "Failed to import" warning has a valid
sourcelocation, so that it is shown on the correct line in qmlls.
Fixes: QTBUG-131958
Pick-to: 6.8 6.9
Change-Id: Ia0c327b82e89cd0a003d05b4c3efe693fb3b3ed7
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
They are mostly the same. We only need to search the local properties
rather than the IDs for the regular group properties. This allows us to
resolve group properties on aliases since aliases get resolved before
group properties.
Pick-to: 6.8
Fixes: QTBUG-128632
Change-Id: I6f77a65499dd6bec29269f7b0974180fa76a749e
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Previously, it would hold the location of the copy in the build
directory or in the resource file system.
This should improve the accuracy of the information that we can report
back. For example, the file location of files reported in aotstats will
now be those in the source folder.
The changes necessary for this patch were found through trial and error
by asserting that the filePath respect a certain form and fixing what I
could. There remain cases where the filePath still contains a location
in the build directory. We would need some other change to report those
accurately as well.
Finally, sometimes the filePath is empty or does not contain a valid
path at all but instead what seems to be the location of an included
file. It can have the form "private/..._p.h" for example.
Pick-to: 6.8
Change-Id: I77a2596f6c4a179580d924a6e9324e43dbb86c0c
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
| |
This is done in prepartion for the following patch in the chain.
Pick-to: 6.8
Change-Id: If8ce75be8ba00e7e4cdd5a0f5e66319ab0d36755
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Add a flag to tell whether the QQmlJSScope is the root QML scope. This
can be then used in user-written QQmlSA passes to apply special checks
on root items, which is needed in the QDS warnings for .ui.qml file,
for example.
Task-number: QTBUG-129308
Change-Id: Ie67294b0ee2b813da3a80a0bd8002ebae618ee1c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Add sourcelocation to properties defined in QML, such that tools like
qmllint have a valid sourcelocation they can issue warnings on.
Fix the warnings:
* "Cannot deduce type of alias",
* "Cannot resolve alias"
* "Alias is part of an alias cycle"
to use the new sourcelocation.
Also adapt the tests to the new sourcelocations.
Fixes: QTBUG-128932
Pick-to: 6.8
Change-Id: Iec434324af1244c6952f0d5afc8a42f569a750e4
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
| |
Amends commit ebd8b856d9d342562dedff26b2bef4bd1bca699a
Pick-to: 6.8
Change-Id: I62bb78e75ab98129ca317a2cb741b246c5d1cf20
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
If we cannot resolve a type, we need to assume that all its properties
are components and assign separate contexts to all inner objects.
Otherwise, if one of them actually is, the attempt to resolve it at run
time will crash.
Pick-to: 6.8
Fixes: QTBUG-129281
Change-Id: Ic34b5308accdd93f6797ee39fcd56040cf86b1ce
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
Amends 56c16d0e9770b39df142ba946357562be6b9731c that only ignores
"normal" bindings from warnings in custom parsed contexts, and also
ignore list bindings from custom parsed contexts.
Pick-to: 6.8 6.7 6.5
Change-Id: I66538ddaac49686a5ad6b6560ddbdbd50bebb717
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
We want to replay the warnings when we import the same module again.
This happens if we lint multiple files with different imports, some
direct and some indirect.
Pick-to: 6.8
Fixes: QTBUG-118588
Change-Id: I75da4e62acea675342ce8f86f9609f1786ffbdd0
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
|
| |
Usually, if some type is not found, that's due to a dependency or an
import missing. A missing import path is much less common.
Pick-to: 6.8
Change-Id: I33e797b037315b44b9d573f221b4d16bdc88ce17
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
Append to m_seenModuleQualifiers right after the prefix check.
Otherwise, the method can early return before having chance to
insert prefix to m_seenModuleQualifiers.
Amends c126ac9a08564e3ed3b08f72a0aab74687034882
Pick-to: 6.8
Change-Id: I11de1dadfae55dd5a2f826c6b3ee8bcbaf58df7d
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
| |
Change-Id: Ia5f5e99fae8a297264a3d3bb84594cb0fc0063c7
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Currently, there are two different warning formulations when binding
something to a property that does not exist. Unify them so that they
don't need to be documented twice by replacing
```
Binding assigned to XXX, but no property XXX exists in the current
element.
```
with the warning
```
Property X does not exist
```
Also, from a user perspective it does not make sense to have different
warnings for "assigning an object to a property that does not exist" and
"assigning a script expression to a property that does not exist".
Pick-to: 6.7 6.8
Task-number: QTBUG-118112
Change-Id: Iec2b5717709239d4b8fa45793ee16c6e1cc39a24
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
An unresolvable default property type is not a missing-property (which
is about using non-existing properties), but an unresolved-type.
This avoids having to write weird documentation about a missing-property
warning actually being an unresolved-type warning.
Pick-to: 6.7 6.8
Fixes: QTBUG-127309
Change-Id: I1dd35d9b8b5f2e625b789e118f0f614c9da648e2
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
The change introducing the checking of unresolved type annotations had a
problem where the annotation and its corresponding argument could be
mismatched. This would lead to warnings for unresolved type annotations
being correct but being shown in the wrong location.
This patch keeps an array of source locations for annotations for
argument and the return type. These are kept in order. If an argument
doesn't have a type annotation, its corresponding source location is
invalid. This ensures a consistent mapping between arguments/return type
and their annotation.
Amends 4aa1deee1be966a6491ab5a1c1de09707a5e8215
Fixes: QTBUG-125146
Pick-to: 6.7 6.8
Change-Id: I012d2cb261244d625b6b9126e0d362e6a4e5cb7b
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
| |
The resourceFileMapper doesn't expect ':' in front of its paths.
Amends 5860c9c12c1c948ce1498da30581bfd5b9c05988
Fixes: QTBUG-124498
Pick-to: 6.8 6.7 6.5
Change-Id: Icf837708ff6fc5153009bafbf1b98a75a3cfba8e
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
| |
Remove the fix-it as it is currently not possible to create a proper
fix-it replacement without breaking user code. Tracking in
QTBUG-127535 on how to solve it in the future by using the Dom.
Fixes: QTBUG-127474
Task-number: QTBUG-127535
Pick-to: 6.8 6.7
Change-Id: Ifb335545aa6af1f731281bdcce2ca24062b2c747
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Replace the "Property %1 of type %2 is assigned an incompatible type %3"
warning with the
"Cannot assign object of type %1 to %2" warning.
From a user perspective, it does not really make sense to have
different warnings for these scenarios:
```
property int xxx: "asdf" // Cannot assign literal ...
property int xxx2: Item {} // old: Property xxx2 of type int ...
property date xxx3: 1 + 1 // Cannot assign binding ...
```
because all are complaining about the exact same thing. Therefore, use
the same warning for all three:
```
property int xxx: "asdf" // Cannot assign literal ...
property int xxx2: Item {} // new: Cannot assign object ...
property date xxx3: 1 + 1 // Cannot assign binding ...
```
Task-number: QTBUG-118112
Pick-to: 6.7 6.8
Change-Id: Ieaf8ca39685b3d03a1fb9238a832e9413c2c1567
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Don't resolve component names as attached types. Instead, check whether
the component name has a field member access to a property name, that
is, whether the type name is followed by a dot and a lowercase name,
like in "MyApplicationWindow.header" where MyApplicationWindow is
an attached type because header starts with a lower case letter, or in
"MyApplicationWindow.Kitty" and "MyApplicationWindow.Hello.World" where
MyApplicationWindow is a component because "Hello" and "World" start
with an upper-case letter, for example.
With the improved handling in resolveExpressionType, fix the
findDefinitionFromLocation logic to also work on attached types.
Implement support for qualified module names in resolveExpressionType
and ignore unqualified modules names for now, so that component types
from qualified module names can be resolved correctly too. Collect the
used qualified module names in the qqmljsimportvisitor and pass them on
via the typeresolver to resolveExpressionType to recognize qualified
module names. Those do not have a qqmljsscope but still can be resolved
when used in a fieldmemberexpression.
Pick-to: 6.8
Fixes: QTBUG-126711
Change-Id: I274c644d25cd6f9728bc56f19ec96983ad217df8
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
qmltyperegistrar leaves out "void" return types when generating methods
and signals. Add those back when reading the files so that we don't have
to special-case "void" in the compilers.
Also, explicitly set the return type of QML signals to "void", for the
same reason.
Change-Id: I94cd9d005c458fe37160eccf5c14f02c53fc300a
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Allow qqmljsscopes of QML components to have "own" module names, and
add a helper method moduleName() that helps retrieve the module name
of some (possibly non QML component) qqmljsscope by iterating over its
parents.
That is required for the renaming of qmlcomponents and allows to check
if the qml element to be renamed is defined in the same module as the
current module. (It is not allowed to rename a QML component from
another module).
Task-number: QTBUG-114993
Change-Id: I09d57ec87cfc64de31859b2af6334264c4fa6912
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Olivier De Cannière <olivier.decanniere@qt.io>
|
| |
|
|
|
|
|
|
|
| |
This is useful for tooling like Axivion and can help with better error
messages.
Change-Id: Ic63afd2eeb4ee3627d05303c2518fa90282fb7ab
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
* Make things const where we can
* Avoid copies where we can
* Clarify some types
* Remove dead code
Coverity-Id: 454277
Coverity-Id: 454278
Coverity-Id: 454287
Coverity-Id: 454288
Coverity-Id: 454291
Coverity-Id: 454292
Coverity-Id: 454294
Coverity-Id: 454295
Change-Id: I56150aea78ea2b188083f99bf83816b121ef867a
Reviewed-by: Semih Yavuz <semih.yavuz@qt.io>
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
When `QQmlJSImportVisitor` visits a program, it marks properties as
required in their scope when it encounters them or it encounters a
`required` statement.
For aliases, an additional step is performed at the end of a visit, when
the aliases are resolved.
After an alias is resolved to a target property, is "requiredness", is
set based on the required of the target property in its scope.
Due to the specific implementation, the alias will be set to required in
its scope if the target property is required in its scope and will be
set to be non-required otherwise, independently of its previous required
state.
When we have an alias that is itself required pointing to a property
that isn't required, for example:
```
Item {
id: self
property int foo
property alias alias: self.foo
required alias
}
```
The alias will always be marked as not required, as it always inherits
the required state of the target property, losing the required status
that was applied by the "required" statement.
To respect "required" statements in relation to aliases,
`QQmlJSImportVisitor::resolveAliasesAndIds` will now inherit the
"requiredness" of the target property only when the alias is not already
marked as required in its scope.
Fixes: QTBUG-123837
Change-Id: I7b0f6958287625f3f3a5d736d4c45a3e050d4502
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
|
| |
|
|
|
|
|
|
| |
Without this gcc 12 produces bogus warnings with the latest hardening
changes.
Change-Id: I35b505b2a53d1d88dff72cf2ddc6707059183b71
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
| |
Unlike gcc, clang warns about implicit fallthrough even if the following
label only contains a `break` statement
Pick-to: 6.7
Change-Id: If7fb15b5e2e1a8fb80668087e4497efb8d3d30d4
Reviewed-by: Sami Shalayel <sami.shalayel@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Correctly propagate the isClass and RegisterEnumClassesUnscoped
information from metatypes to qmltypes, then read it correctly, and
don't try to resolve unscoped values of scoped enums when resolving
types. Neither try to resolve the names of unscoped enums.
For historical reasons, enums are unscoped by default, even if they are
declared as "enum class".
Furthermore, QML enums can be accessed in both scoped and unscoped way.
Scoped C++ enums can only be accessed by explicitly stating the scope,
and unscoped C++ enums can only be accessed without scope. Since qmllint
now correctly analyzes this, we need to adapt the tests accordingly.
Finally, also fix the logic around populating the error message for
qmllint. We want to warn about the enum itself, not one of its values.
And we always want to setError() if something is wrong so that the
compilers don't try to continue from there.
Pick-to: 6.7 6.6 6.5 6.2
Fixes: QTBUG-107143
Change-Id: If1ee9a10479cffb46067ccb5e683906905c24160
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|
| |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Warn when the types in method type annotations can't be resolved. This
hinders qmltc from crashing when trying to compile a QML file with an
invalid type annotation like `Qt.point`.
To avoid copying and replacing lists, add helpers like
mutableOwnMethodsRange() or mutableParametersRange() to obtain mutable
iterators to the ownMethods of QQmlJSScope or the parameters
of QQmlJSMetaMethod.
Pick-to: 6.6 6.7
Fixes: QTBUG-122251
Change-Id: Iffc6ff712fbeaa2fe8b83f94b0bc5a8c278d186c
Reviewed-by: Fabian Kosmale <fabian.kosmale@qt.io>
|