diff --git a/ets2panda/checker/ets/helpers.cpp b/ets2panda/checker/ets/helpers.cpp index 0dd0f3a06717bf76eba47c86387216f107af6f68..1c32a0d2a05d6d6ec745c099041e46488ddd84c8 100644 --- a/ets2panda/checker/ets/helpers.cpp +++ b/ets2panda/checker/ets/helpers.cpp @@ -2745,6 +2745,7 @@ ir::ClassProperty *ETSChecker::ClassPropToImplementationProp(ir::ClassProperty * auto classCtx = varbinder::LexicalScope::Enter(VarBinder(), scope); ReInitScopesForTypeAnnotation(this, classProp->TypeAnnotation(), scope); compiler::InitScopesPhaseETS::RunExternalNode(classProp->Value(), VarBinder()); + VarBinder()->AsETSBinder()->ResolveReferencesForScopeWithContext(classProp, scope); return classProp; } diff --git a/ets2panda/test/runtime/ets/not_init.ets b/ets2panda/test/runtime/ets/not_init.ets new file mode 100644 index 0000000000000000000000000000000000000000..1ebdf625f0d2e18b9f6d756214bf3b344b63b068 --- /dev/null +++ b/ets2panda/test/runtime/ets/not_init.ets @@ -0,0 +1,33 @@ +/* + * Copyright (c) 2025 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. + */ + +export interface Inter { + intercept: () => Record +} + + +class foo implements Inter { + intercept: () => Record = () => { + let a : Record = {} + a['key'] = 'value'; + return a; + } +} + +function main() { + let f = new foo(); + let a = f.intercept(); + arktest.assertEQ(a['key'], 'value'); +} \ No newline at end of file