diff --git a/ets2panda/checker/ETSAnalyzer.cpp b/ets2panda/checker/ETSAnalyzer.cpp index 1fec1bafe8b24dbdcded94cee335d42627d4ddde..4baf7a05712952ba7210ffaed38d97caa3342c10 100644 --- a/ets2panda/checker/ETSAnalyzer.cpp +++ b/ets2panda/checker/ETSAnalyzer.cpp @@ -1672,6 +1672,7 @@ checker::Type *ETSAnalyzer::Check(ir::CallExpression *expr) const checker::TypeStackElement tse(checker, expr, {{diagnostic::CYCLIC_CALLEE, {}}}, expr->Start()); if (tse.HasTypeError()) { + expr->SetTsType(checker->GlobalTypeError()); return checker->GlobalTypeError(); } diff --git a/ets2panda/test/ast/compiler/ets/fuzz_invalid_property.ets b/ets2panda/test/ast/compiler/ets/fuzz_invalid_property.ets new file mode 100644 index 0000000000000000000000000000000000000000..39746c2c669e9fcf75817c5b03e4fdc2845bf62d --- /dev/null +++ b/ets2panda/test/ast/compiler/ets/fuzz_invalid_property.ets @@ -0,0 +1,29 @@ +/* + * 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. + */ + +class D{ + strB = (new StringBuilder).append('{ ').append(strB.toString()).append(' }') +} + +/* @@? 17:12 Error TypeError: Circular call function */ +/* @@? 17:12 Error TypeError: Call to `append` is ambiguous as `2` versions of `append` are available: `append(s: String): StringBuilder` and `append(i: Boolean): StringBuilder` */ +/* @@? 17:12 Error TypeError: Call to `append` is ambiguous as `2` versions of `append` are available: `append(s: String): StringBuilder` and `append(i: Byte): StringBuilder` */ +/* @@? 17:12 Error TypeError: Call to `append` is ambiguous as `2` versions of `append` are available: `append(s: String): StringBuilder` and `append(i: Short): StringBuilder` */ +/* @@? 17:12 Error TypeError: Call to `append` is ambiguous as `2` versions of `append` are available: `append(s: String): StringBuilder` and `append(i: Char): StringBuilder` */ +/* @@? 17:12 Error TypeError: Call to `append` is ambiguous as `2` versions of `append` are available: `append(s: String): StringBuilder` and `append(i: Int): StringBuilder` */ +/* @@? 17:12 Error TypeError: Call to `append` is ambiguous as `2` versions of `append` are available: `append(s: String): StringBuilder` and `append(i: Long): StringBuilder` */ +/* @@? 17:12 Error TypeError: Call to `append` is ambiguous as `2` versions of `append` are available: `append(s: String): StringBuilder` and `append(i: Float): StringBuilder` */ +/* @@? 17:12 Error TypeError: Call to `append` is ambiguous as `2` versions of `append` are available: `append(s: String): StringBuilder` and `append(i: Double): StringBuilder` */ +/* @@? 17:52 Error TypeError: Property 'strB' must be accessed through 'this' */