diff --git a/src/qmlcompiler/qqmljsscope.cpp b/src/qmlcompiler/qqmljsscope.cpp index a43e6a8b24..3dededec9a 100644 --- a/src/qmlcompiler/qqmljsscope.cpp +++ b/src/qmlcompiler/qqmljsscope.cpp @@ -662,6 +662,7 @@ void QQmlJSScope::resolveEnums( enumScope->m_semantics = AccessSemantics::Value; enumScope->m_internalName = self->internalName() + QStringLiteral("::") + it->name(); + resolveList(enumScope, contextualTypes.arrayType()); if (QString alias = it->alias(); !alias.isEmpty() && self->m_enumerations.constFind(alias) == self->m_enumerations.constEnd()) { auto aliasScope = QQmlJSScope::clone(enumScope); diff --git a/tests/auto/qml/qmllint/data/EnumList/enumlist.qmltypes b/tests/auto/qml/qmllint/data/EnumList/enumlist.qmltypes new file mode 100644 index 0000000000..031f7406f6 --- /dev/null +++ b/tests/auto/qml/qmllint/data/EnumList/enumlist.qmltypes @@ -0,0 +1,51 @@ +import QtQuick.tooling 1.2 + +// This file describes the plugin-supplied types contained in the library. +// It is used for QML tooling purposes only. +// +// This file was auto-generated by qmltyperegistrar. + +Module { + Component { + file: "mycustomtype.h" + name: "MyCustomType" + accessSemantics: "reference" + prototype: "QObject" + exports: ["EnumProperty/MyCustomType 1.0"] + exportMetaObjectRevisions: [256] + Property { + name: "requiredConditions" + type: "Org::Company::Configuration::Condition" + isList: true + read: "getRequiredConditions" + write: "setRequiredConditions" + notify: "requiredConditionsChanged" + index: 0 + } + Property { + name: "enablerConditions" + type: "int" + isList: true + read: "getEnablerConditions" + write: "setEnablerConditions" + notify: "enablerConditionsChanged" + index: 1 + } + Signal { name: "requiredConditionsChanged" } + Signal { name: "enablerConditionsChanged" } + } + Component { + file: "conditiontypes.h" + name: "Org::Company::Configuration" + accessSemantics: "none" + exports: ["EnumProperty/Configuration 1.0"] + isCreatable: false + enforcesScopedEnums: true + exportMetaObjectRevisions: [256] + Enum { + name: "Condition" + isScoped: true + values: ["A", "B", "C", "D"] + } + } +} diff --git a/tests/auto/qml/qmllint/data/EnumList/qmldir b/tests/auto/qml/qmllint/data/EnumList/qmldir new file mode 100644 index 0000000000..fd0d54437b --- /dev/null +++ b/tests/auto/qml/qmllint/data/EnumList/qmldir @@ -0,0 +1,2 @@ +module EnumList +typeinfo enumlist.qmltypes diff --git a/tests/auto/qml/qmllint/data/enumListTest.qml b/tests/auto/qml/qmllint/data/enumListTest.qml new file mode 100644 index 0000000000..5ba6dfe4cc --- /dev/null +++ b/tests/auto/qml/qmllint/data/enumListTest.qml @@ -0,0 +1,8 @@ +import EnumList +import QtQml + +MyCustomType { + id: myType + requiredConditions: [Configuration.Condition.A, Configuration.Condition.C] +} + diff --git a/tests/auto/qml/qmllint/tst_qmllint.cpp b/tests/auto/qml/qmllint/tst_qmllint.cpp index bfc8d81c7e..12f684be67 100644 --- a/tests/auto/qml/qmllint/tst_qmllint.cpp +++ b/tests/auto/qml/qmllint/tst_qmllint.cpp @@ -1975,6 +1975,7 @@ void TestQmllint::cleanQmlCode_data() QTest::newRow("dontConfuseMemberPrintWithGlobalPrint") << QStringLiteral("findMemberPrint.qml"); QTest::newRow("duplicateQmldirImport") << QStringLiteral("qmldirImport/duplicate.qml"); QTest::newRow("enumFromQtQml") << QStringLiteral("enumFromQtQml.qml"); + QTest::newRow("enumList") << QStringLiteral("enumListTest.qml"); QTest::newRow("enumProperty") << QStringLiteral("enumProperty.qml"); QTest::newRow("enumsOfScrollBar") << QStringLiteral("enumsOfScrollBar.qml"); QTest::newRow("esmodule") << QStringLiteral("esmodule.mjs");