diff --git a/ets2panda/checker/ets/helpers.cpp b/ets2panda/checker/ets/helpers.cpp index ac3b09f01e653925b66a40194073afd17464fb49..72b9c72aaf61110b2e5e5677712843da81e2a5ac 100644 --- a/ets2panda/checker/ets/helpers.cpp +++ b/ets2panda/checker/ets/helpers.cpp @@ -2038,18 +2038,7 @@ std::string ETSChecker::GetStringFromLiteral(ir::Expression *caseTest) const bool ETSChecker::IsSameDeclarationType(varbinder::LocalVariable *target, varbinder::LocalVariable *compare) { - if (target->Declaration()->Type() != compare->Declaration()->Type()) { - return false; - } - - if ((target->HasFlag(varbinder::VariableFlags::METHOD_REFERENCE) && - !compare->HasFlag(varbinder::VariableFlags::METHOD_REFERENCE)) || - (!target->HasFlag(varbinder::VariableFlags::METHOD_REFERENCE) && - compare->HasFlag(varbinder::VariableFlags::METHOD_REFERENCE))) { - return false; - } - - return true; + return target->Declaration()->Type() == compare->Declaration()->Type(); } void ETSChecker::AddBoxingFlagToPrimitiveType(TypeRelation *relation, Type *target) diff --git a/ets2panda/checker/ets/object.cpp b/ets2panda/checker/ets/object.cpp index 4e3c59a4b53880a966cab6b01aebb15b93a8a32b..7dd15d730f05a892148345f1ff88e295ac74fa66 100644 --- a/ets2panda/checker/ets/object.cpp +++ b/ets2panda/checker/ets/object.cpp @@ -382,17 +382,6 @@ static void ResolveDeclaredFieldsOfObject(ETSChecker *checker, const ETSObjectTy auto *classProp = it->Declaration()->Node()->AsClassProperty(); it->AddFlag(checker->GetAccessFlagFromNode(classProp)); type->AddProperty(it->AsLocalVariable()); - - if (classProp->TypeAnnotation() != nullptr && classProp->TypeAnnotation()->IsETSFunctionType()) { - type->AddProperty(it->AsLocalVariable()); - it->AddFlag(varbinder::VariableFlags::METHOD_REFERENCE); - } else if (classProp->TypeAnnotation() != nullptr && classProp->TypeAnnotation()->IsETSTypeReference()) { - bool hasFunctionType = checker->HasETSFunctionType(classProp->TypeAnnotation()); - if (hasFunctionType) { - type->AddProperty(it->AsLocalVariable()); - it->AddFlag(varbinder::VariableFlags::METHOD_REFERENCE); - } - } } for (auto &[_, it] : scope->StaticFieldScope()->Bindings()) { @@ -401,17 +390,6 @@ static void ResolveDeclaredFieldsOfObject(ETSChecker *checker, const ETSObjectTy auto *classProp = it->Declaration()->Node()->AsClassProperty(); it->AddFlag(checker->GetAccessFlagFromNode(classProp)); type->AddProperty(it->AsLocalVariable()); - - if (classProp->TypeAnnotation() != nullptr && classProp->TypeAnnotation()->IsETSFunctionType()) { - type->AddProperty(it->AsLocalVariable()); - it->AddFlag(varbinder::VariableFlags::METHOD_REFERENCE); - } else if (classProp->TypeAnnotation() != nullptr && classProp->TypeAnnotation()->IsETSTypeReference()) { - bool hasFunctionType = checker->HasETSFunctionType(classProp->TypeAnnotation()); - if (hasFunctionType) { - type->AddProperty(it->AsLocalVariable()); - it->AddFlag(varbinder::VariableFlags::METHOD_REFERENCE); - } - } } } @@ -1215,7 +1193,8 @@ varbinder::Variable *ETSChecker::ResolveInstanceExtension(const ir::MemberExpres PropertySearchFlags ETSChecker::GetInitialSearchFlags(const ir::MemberExpression *const memberExpr) { - constexpr auto FUNCTIONAL_FLAGS = PropertySearchFlags::SEARCH_METHOD | PropertySearchFlags::IS_FUNCTIONAL; + constexpr auto FUNCTIONAL_FLAGS = + PropertySearchFlags::SEARCH_METHOD | PropertySearchFlags::IS_FUNCTIONAL | PropertySearchFlags::SEARCH_FIELD; constexpr auto GETTER_FLAGS = PropertySearchFlags::SEARCH_METHOD | PropertySearchFlags::IS_GETTER; constexpr auto SETTER_FLAGS = PropertySearchFlags::SEARCH_METHOD | PropertySearchFlags::IS_SETTER; diff --git a/ets2panda/checker/types/ets/etsObjectType.cpp b/ets2panda/checker/types/ets/etsObjectType.cpp index 8368bd2f7e12a9f3871e82658d8bf592f31e245b..4bc113218ad2d9dca6a41facce215ad319f8cfec 100644 --- a/ets2panda/checker/types/ets/etsObjectType.cpp +++ b/ets2panda/checker/types/ets/etsObjectType.cpp @@ -41,7 +41,8 @@ void ETSObjectType::Iterate(const PropertyTraverser &cb) const } } -varbinder::LocalVariable *ETSObjectType::GetProperty(const util::StringView &name, PropertySearchFlags flags) const +varbinder::LocalVariable *ETSObjectType::SearchFieldsDecls(const util::StringView &name, + PropertySearchFlags flags) const { varbinder::LocalVariable *res {}; if ((flags & PropertySearchFlags::SEARCH_INSTANCE_FIELD) != 0) { @@ -59,13 +60,13 @@ varbinder::LocalVariable *ETSObjectType::GetProperty(const util::StringView &nam if (res == nullptr && ((flags & PropertySearchFlags::SEARCH_STATIC_DECL) != 0)) { res = GetOwnProperty(name); } + return res; +} +varbinder::LocalVariable *ETSObjectType::GetProperty(const util::StringView &name, PropertySearchFlags flags) const +{ + varbinder::LocalVariable *res = SearchFieldsDecls(name, flags); if (res == nullptr && (flags & PropertySearchFlags::SEARCH_METHOD) != 0) { - res = GetOwnProperty(name); - if (res != nullptr && res->TsType() != nullptr && res->TsType()->IsETSDynamicType()) { - return res; - } - res = nullptr; if ((flags & PropertySearchFlags::DISALLOW_SYNTHETIC_METHOD_CREATION) != 0) { if ((flags & PropertySearchFlags::SEARCH_INSTANCE_METHOD) != 0) { res = GetOwnProperty(name); @@ -79,15 +80,7 @@ varbinder::LocalVariable *ETSObjectType::GetProperty(const util::StringView &nam } } - if ((flags & (PropertySearchFlags::SEARCH_IN_INTERFACES | PropertySearchFlags::SEARCH_IN_BASE)) == 0) { - return res; - } - - if (res != nullptr) { - return res; - } - - if ((flags & PropertySearchFlags::SEARCH_IN_INTERFACES) != 0) { + if (res == nullptr && (flags & PropertySearchFlags::SEARCH_IN_INTERFACES) != 0) { for (auto *interface : interfaces_) { res = interface->GetProperty(name, flags); if (res != nullptr) { @@ -96,7 +89,7 @@ varbinder::LocalVariable *ETSObjectType::GetProperty(const util::StringView &nam } } - if (superType_ != nullptr && ((flags & PropertySearchFlags::SEARCH_IN_BASE) != 0)) { + if (res == nullptr && superType_ != nullptr && ((flags & PropertySearchFlags::SEARCH_IN_BASE) != 0)) { res = superType_->GetProperty(name, flags); } @@ -146,18 +139,8 @@ varbinder::LocalVariable *ETSObjectType::CollectSignaturesForSyntheticType(ETSFu } }; - // During function reference resolution, if the found properties type is not a function type, then it is a - // functional interface, because no other property can be found in the methods of the class. We have to - // return the found property, because we doesn't need to create a synthetic variable for functional - // interfaces due to the fact, that by nature they behave as fields, and can't have overloads, and they are - // subjected to hiding if ((flags & PropertySearchFlags::SEARCH_STATIC_METHOD) != 0) { if (auto *found = GetOwnProperty(name); found != nullptr) { - if (found->HasFlag(varbinder::VariableFlags::METHOD_REFERENCE)) { - // Functional interface found - return found; - } - ASSERT(found->TsType()->IsETSFunctionType()); addSignature(found); } @@ -165,11 +148,6 @@ varbinder::LocalVariable *ETSObjectType::CollectSignaturesForSyntheticType(ETSFu if ((flags & PropertySearchFlags::SEARCH_INSTANCE_METHOD) != 0) { if (auto *found = GetOwnProperty(name); found != nullptr) { - if (found->HasFlag(varbinder::VariableFlags::METHOD_REFERENCE)) { - // Functional interface found - return found; - } - ASSERT(found->TsType()->IsETSFunctionType()); addSignature(found); } diff --git a/ets2panda/checker/types/ets/etsObjectType.h b/ets2panda/checker/types/ets/etsObjectType.h index 24d5b1b0190073b18328875d74468c76e9852a08..7ecf3b997deafb6ca0892b7b02070fb11fdb747c 100644 --- a/ets2panda/checker/types/ets/etsObjectType.h +++ b/ets2panda/checker/types/ets/etsObjectType.h @@ -594,6 +594,7 @@ private: ASSERT(declNode_->IsTSInterfaceDeclaration() && declNode_->AsTSInterfaceDeclaration()->TypeParams()); return declNode_->AsTSInterfaceDeclaration()->TypeParams(); } + varbinder::LocalVariable *SearchFieldsDecls(const util::StringView &name, PropertySearchFlags flags) const; ArenaAllocator *allocator_; util::StringView name_; diff --git a/ets2panda/ir/expressions/memberExpression.cpp b/ets2panda/ir/expressions/memberExpression.cpp index 8fcfd8a0cd71f869c0dcca76b8ebedf5bf66e32a..e2c07a3c26dcdeb378ce35016e0b2a8474eb1e67 100644 --- a/ets2panda/ir/expressions/memberExpression.cpp +++ b/ets2panda/ir/expressions/memberExpression.cpp @@ -171,10 +171,14 @@ std::pair MemberExpression::Resolve return {checker->GetTypeOfVariable(resolveRes[0]->Variable()), nullptr}; } case 2U: { - // ETSExtensionFuncHelperType(class_method_type, extension_method_type) - auto *resolvedType = checker->CreateETSExtensionFuncHelperType( - checker->GetTypeOfVariable(resolveRes[1]->Variable())->AsETSFunctionType(), - checker->GetTypeOfVariable(resolveRes[0]->Variable())->AsETSFunctionType()); + auto classMethodType = checker->GetTypeOfVariable(resolveRes[1]->Variable()); + auto extensionMethodType = checker->GetTypeOfVariable(resolveRes[0]->Variable()); + auto *resolvedType = extensionMethodType; + if (classMethodType->IsETSFunctionType()) { + ASSERT(extensionMethodType->IsETSFunctionType()); + resolvedType = checker->CreateETSExtensionFuncHelperType(classMethodType->AsETSFunctionType(), + extensionMethodType->AsETSFunctionType()); + } return {resolvedType, nullptr}; } default: { diff --git a/ets2panda/test/compiler/ets/identifierReference12-expected.txt b/ets2panda/test/compiler/ets/identifierReference12-expected.txt index c41ed2bceb102471cca4d21074d66d858b42c362..f568a39d0b9a1f1e32a5f47ad5034bb63004602b 100644 --- a/ets2panda/test/compiler/ets/identifierReference12-expected.txt +++ b/ets2panda/test/compiler/ets/identifierReference12-expected.txt @@ -888,4 +888,4 @@ } } } -TypeError: Property 'foo' does not exist on type 'B' [identifierReference12.ets:24:20] +TypeError: This expression is not callable. [identifierReference12.ets:24:13] diff --git a/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromClass-expected.txt b/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromClass-expected.txt index 33cb453b9b69a2b1560988acc467f849141d69cb..115f9f817068e23d1062207e39f2f5d739d1851a 100644 --- a/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromClass-expected.txt +++ b/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromClass-expected.txt @@ -1383,4 +1383,4 @@ } } } -TypeError: Cannot inherit from class C, because field x is inherited with a different declaration type [invalidIndirectInheritanceFromClass.ets:25:17] +TypeError: This expression is not callable. [invalidIndirectInheritanceFromClass.ets:28:15] diff --git a/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromInterface-expected.txt b/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromInterface-expected.txt index e6a9aa7fd9c36793eaaefd3f0f061ae9db09c3be..7b2e3b54d9f7e76bb654567b107d3abde416a3e2 100644 --- a/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromInterface-expected.txt +++ b/ets2panda/test/compiler/ets/invalidIndirectInheritanceFromInterface-expected.txt @@ -1306,4 +1306,4 @@ } } } -TypeError: Cannot inherit from class C, because field x is inherited with a different declaration type [invalidIndirectInheritanceFromInterface.ets:25:17] +TypeError: This expression is not callable. [invalidIndirectInheritanceFromInterface.ets:28:15] diff --git a/ets2panda/test/compiler/ets/invalidInheritance3-expected.txt b/ets2panda/test/compiler/ets/invalidInheritance3-expected.txt index bb1005989a0af56b8f0cdd76857e7d4a8184ac95..4d61cbfbaa24178ee0ce247ba561dc3b80b71df1 100644 --- a/ets2panda/test/compiler/ets/invalidInheritance3-expected.txt +++ b/ets2panda/test/compiler/ets/invalidInheritance3-expected.txt @@ -702,4 +702,3 @@ } } } -TypeError: Cannot inherit from class A, because field a is inherited with a different declaration type [invalidInheritance3.ets:20:17] diff --git a/ets2panda/test/compiler/ets/invalidInheritance4-expected.txt b/ets2panda/test/compiler/ets/invalidInheritance4-expected.txt new file mode 100644 index 0000000000000000000000000000000000000000..81bc20a805ca4c3d38b955064f375c4c0efb0563 --- /dev/null +++ b/ets2panda/test/compiler/ets/invalidInheritance4-expected.txt @@ -0,0 +1,666 @@ +{ + "type": "Program", + "statements": [ + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "A", + "decorators": [], + "loc": { + "start": { + "line": 16, + "column": 7 + }, + "end": { + "line": 16, + "column": 8 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "ClassProperty", + "key": { + "type": "Identifier", + "name": "name", + "decorators": [], + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 17, + "column": 9 + } + } + }, + "accessibility": "public", + "static": false, + "readonly": false, + "declare": false, + "optional": false, + "computed": false, + "typeAnnotation": { + "type": "ETSFunctionType", + "params": [], + "returnType": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "String", + "decorators": [], + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 17, + "column": 23 + } + } + }, + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 17, + "column": 17 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 17, + "column": 11 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + "definite": false, + "decorators": [], + "loc": { + "start": { + "line": 17, + "column": 5 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "constructor", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 18, + "column": 2 + }, + "end": { + "line": 18, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 16, + "column": 9 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 16, + "column": 1 + }, + "end": { + "line": 18, + "column": 2 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "B", + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 7 + }, + "end": { + "line": 20, + "column": 8 + } + } + }, + "superClass": { + "type": "ETSTypeReference", + "part": { + "type": "ETSTypeReferencePart", + "name": { + "type": "Identifier", + "name": "A", + "decorators": [], + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 18 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 20 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 17 + }, + "end": { + "line": 20, + "column": 20 + } + } + }, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "name", + "decorators": [], + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + "kind": "method", + "accessibility": "public", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "name", + "decorators": [], + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 9 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "returnType": { + "type": "ETSPrimitiveType", + "loc": { + "start": { + "line": 21, + "column": 13 + }, + "end": { + "line": 21, + "column": 16 + } + } + }, + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 21, + "column": 17 + }, + "end": { + "line": 21, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 19 + } + } + }, + "loc": { + "start": { + "line": 21, + "column": 9 + }, + "end": { + "line": 21, + "column": 19 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 21, + "column": 5 + }, + "end": { + "line": 21, + "column": 19 + } + } + }, + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "constructor", + "static": false, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "constructor", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 22, + "column": 2 + }, + "end": { + "line": 22, + "column": 2 + } + } + } + ], + "loc": { + "start": { + "line": 20, + "column": 19 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + "loc": { + "start": { + "line": 20, + "column": 1 + }, + "end": { + "line": 22, + "column": 2 + } + } + }, + { + "type": "ClassDeclaration", + "definition": { + "id": { + "type": "Identifier", + "name": "ETSGLOBAL", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "superClass": null, + "implements": [], + "body": [ + { + "type": "MethodDefinition", + "key": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "kind": "method", + "accessibility": "public", + "static": true, + "optional": false, + "computed": false, + "value": { + "type": "FunctionExpression", + "function": { + "type": "ScriptFunction", + "id": { + "type": "Identifier", + "name": "_$init$_", + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "generator": false, + "async": false, + "expression": false, + "params": [], + "body": { + "type": "BlockStatement", + "statements": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "overloads": [], + "decorators": [], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + }, + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 1, + "column": 1 + } + } + } + ], + "loc": { + "start": { + "line": 1, + "column": 1 + }, + "end": { + "line": 23, + "column": 1 + } + } +} +TypeError: Cannot inherit from class A, because method name is inherited with a different declaration type [invalidInheritance4.ets:20:17] diff --git a/ets2panda/test/compiler/ets/invalidInheritance4.ets b/ets2panda/test/compiler/ets/invalidInheritance4.ets new file mode 100644 index 0000000000000000000000000000000000000000..9da1a110da4fcdd45cf1ed77ae0bd70424752595 --- /dev/null +++ b/ets2panda/test/compiler/ets/invalidInheritance4.ets @@ -0,0 +1,22 @@ +/* + * Copyright (c) 2021-2024 Huawei Device Co., Ltd. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +class A { + name: () => String +} + +class B extends A { + name(): int {} +} diff --git a/ets2panda/test/compiler/ets/invalidInheritanceFromClass-expected.txt b/ets2panda/test/compiler/ets/invalidInheritanceFromClass-expected.txt index 13e1ac543f428998ece0991270af1ddc2c0a2fbf..9ec98d345b1535a5d395935d90dfcdd3163fe561 100644 --- a/ets2panda/test/compiler/ets/invalidInheritanceFromClass-expected.txt +++ b/ets2panda/test/compiler/ets/invalidInheritanceFromClass-expected.txt @@ -1206,4 +1206,4 @@ } } } -TypeError: Cannot inherit from class A, because field x is inherited with a different declaration type [invalidInheritanceFromClass.ets:22:17] +TypeError: This expression is not callable. [invalidInheritanceFromClass.ets:25:15] diff --git a/ets2panda/test/compiler/ets/invalidInheritanceFromInterface-expected.txt b/ets2panda/test/compiler/ets/invalidInheritanceFromInterface-expected.txt index e91b4302b347de3d236b185a98fda9500ef65606..09abd0fd65ccf0527da82332987581d45771b6ec 100644 --- a/ets2panda/test/compiler/ets/invalidInheritanceFromInterface-expected.txt +++ b/ets2panda/test/compiler/ets/invalidInheritanceFromInterface-expected.txt @@ -1129,4 +1129,4 @@ } } } -TypeError: Cannot inherit from interface A because field x is inherited with a different declaration type [invalidInheritanceFromInterface.ets:16:1] +TypeError: This expression is not callable. [invalidInheritanceFromInterface.ets:25:15] diff --git a/ets2panda/varbinder/variableFlags.h b/ets2panda/varbinder/variableFlags.h index 6cbe8917f1598043d490b3f3b7c6ec4a3224d9a4..dd152b2ea6d64527dec798ff010c5494c951f5b7 100644 --- a/ets2panda/varbinder/variableFlags.h +++ b/ets2panda/varbinder/variableFlags.h @@ -137,22 +137,21 @@ enum class VariableFlags : uint64_t { PROTECTED = 1U << 19U, PRIVATE = 1U << 20U, SYNTHETIC = 1U << 21U, - METHOD_REFERENCE = 1U << 22U, - LOCAL = 1U << 23U, - - LEXICAL = 1U << 24U, - LOOP_DECL = 1U << 25U, - PER_ITERATION = 1U << 26U, - LEXICAL_VAR = 1U << 27U, - HOIST = 1U << 28U, - VAR = 1U << 29U, - INITIALIZED = 1U << 30U, - LEXICAL_BOUND = 1U << 31U, - - BUILTIN_TYPE = 1ULL << 32ULL, - - BOXED = 1ULL << 33ULL, - GETTER_SETTER = 1ULL << 34ULL, + LOCAL = 1U << 22U, + + LEXICAL = 1U << 23U, + LOOP_DECL = 1U << 24U, + PER_ITERATION = 1U << 25U, + LEXICAL_VAR = 1U << 26U, + HOIST = 1U << 27U, + VAR = 1U << 28U, + INITIALIZED = 1U << 29U, + LEXICAL_BOUND = 1U << 30U, + + BUILTIN_TYPE = 1ULL << 31ULL, + + BOXED = 1ULL << 32ULL, + GETTER_SETTER = 1ULL << 33ULL, HOIST_VAR = HOIST | VAR, CLASS_OR_INTERFACE = CLASS | INTERFACE,