diff --git a/ets2panda/test/ast/compiler/ets/memory_leak.ets b/ets2panda/test/ast/compiler/ets/memory_leak.ets new file mode 100644 index 0000000000000000000000000000000000000000..aaadb00d6ec31d6cf1fb1dddf6f0824a9dc6c7b7 --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/memory_leak.ets @@ -0,0 +1,20 @@ +/* + * 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. + */ + +import { A } from "dynamic_import_tests" + +function main() {} + +/* @@? 16:19 Error TypeError: Cannot find import: dynamic_import_tests */ diff --git a/ets2panda/util/importPathManager.cpp b/ets2panda/util/importPathManager.cpp index 9b64cc0f4be8977b0141df578c5881374dad3050..9aec650c18392d43906e24a6a32734ed44e2fc56 100644 --- a/ets2panda/util/importPathManager.cpp +++ b/ets2panda/util/importPathManager.cpp @@ -75,7 +75,7 @@ void ImportPathManager::ProcessExternalModuleImport(ImportMetadata &importData) // process emptry "path" in dependencies, since in interop we allow imports without typecheck if (!Helpers::EndsWith(std::string(externalModuleImportData.Path()), ".abc")) { importData.importFlags |= ImportFlags::EXTERNAL_SOURCE_IMPORT; - importData.ohmUrl = externalModuleImportData.OhmUrl(); + importData.ohmUrl = UString(std::string(externalModuleImportData.OhmUrl()), allocator_).View().Utf8(); return; } diff --git a/ets2panda/util/importPathManager.h b/ets2panda/util/importPathManager.h index 04c4742836122c14d39444927a3d9a39e15a6ea5..7f3a4f5f3151d31cf3d614ace55543cceb47a169 100644 --- a/ets2panda/util/importPathManager.h +++ b/ets2panda/util/importPathManager.h @@ -83,7 +83,7 @@ public: Language::Id lang {Language::Id::COUNT}; std::string_view resolvedSource {}; std::string_view declPath {}; - std::string ohmUrl {}; + std::string_view ohmUrl {}; std::string declText {}; // NOLINTEND(misc-non-private-member-variables-in-classes)