From 59d359fbe3ad3b6850ec1107f60e7c82feb8d665 Mon Sep 17 00:00:00 2001 From: Robert Sipka Date: Wed, 23 Jul 2025 21:09:02 +0200 Subject: [PATCH] Parse and mark 'Number' as predefined type Issue: #ICOE3P Internal issue: 25066 Change-Id: Ie41d571d7834d9c2a17166a32851bb7391cd5379 Signed-off-by: Robert Sipka --- ets2panda/lexer/scripts/keywords.yaml | 9 ++++----- ets2panda/scripts/arkui.properties | 2 +- .../ast/parser/ets/number_as_identifier.ets | 20 +++++++++++++++++++ 3 files changed, 25 insertions(+), 6 deletions(-) create mode 100644 ets2panda/test/ast/parser/ets/number_as_identifier.ets diff --git a/ets2panda/lexer/scripts/keywords.yaml b/ets2panda/lexer/scripts/keywords.yaml index 08ae6869c9..35b0d135c0 100644 --- a/ets2panda/lexer/scripts/keywords.yaml +++ b/ets2panda/lexer/scripts/keywords.yaml @@ -397,11 +397,10 @@ keywords: keyword_like: [ets, ts] flags: [definable_type_name, predefined_type] - # issue 25066 - # - name: 'Number' - # token: KEYW_BUILTIN_NUMBER - # keyword_like: [ets] - # flags: [predefined_type] + - name: 'Number' + token: KEYW_BUILTIN_NUMBER + keyword_like: [ets] + flags: [predefined_type] - name: 'object' token: KEYW_OBJECT diff --git a/ets2panda/scripts/arkui.properties b/ets2panda/scripts/arkui.properties index 988315ac84..773b5a1d13 100644 --- a/ets2panda/scripts/arkui.properties +++ b/ets2panda/scripts/arkui.properties @@ -1,3 +1,3 @@ ARKUI_DEV_REPO=https://gitee.com/rri_opensource/koala_projects.git -ARKUI_DEV_BRANCH=panda_rev_10-suggestion-rebuild +ARKUI_DEV_BRANCH=panda_rev_10-predefined-number ARKUI_DEST=koala-sig diff --git a/ets2panda/test/ast/parser/ets/number_as_identifier.ets b/ets2panda/test/ast/parser/ets/number_as_identifier.ets new file mode 100644 index 0000000000..6421a43e5b --- /dev/null +++ b/ets2panda/test/ast/parser/ets/number_as_identifier.ets @@ -0,0 +1,20 @@ +/* + * Copyright (c) 2024-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. + */ + +enum foo { + Number = 2 +} + +/* @@? 17:4 Error SyntaxError: Number is a predefined type, cannot be used as an identifier */ -- Gitee