35 Star 168 Fork 697

OpenHarmony / arkcompiler_ets_runtime

 / 详情

[Bug]: [ArkTs][Frontend] Cannot declare function with optional parameters (ambient declarations)

待办的
创建于  
2024-05-13 19:49

发生了什么问题?

The behaviour of the code does not algined with the language specification: ** "Ambient functions cannot have parameters with default values but can have optional parameters." **

However, current compiler outputs the error message:

TypeError: Native, Abstract and Declare methods cannot have body.

期望行为是什么?

Compiled successfully

如何复现该缺陷

declare function baz(x? : int, y?: number) : void

function main() : int {
    return 0
}

其他补充信息

版本或分支信息

  • master
  • Release 4.1
  • Release 4.0
  • Release 3.2

评论 (1)

zihan 创建了任务
zihan 添加了
 
bug
标签
展开全部操作日志

感谢提交Issue!关于Issue的交互操作,请访问OpenHarmony社区支持命令清单。如果有问题,请联系 @weng-changcheng @gonggong @孙哲 @Gargoyle.h @chuning1988 。如果需要调整订阅PR、Issue的变更状态,请访问链接

Thanks for submitting the issue. For more commands, please visit OpenHarmony Command List. If you have any questions, please refer to committer @weng-changcheng @gonggong @孙哲 @Gargoyle.h @chuning1988 for help. If you need to change the subscription of a Pull Request or Issue, please visit the link.

openharmony_ci 添加了
 
waiting_for_assign
标签
zihan 修改了标题
zihan 修改了描述

登录 后才可以发表评论

状态
负责人
项目
里程碑
Pull Requests
关联的 Pull Requests 被合并后可能会关闭此 issue
分支
开始日期   -   截止日期
-
置顶选项
优先级
预计工期 (小时)
参与者(2)
7387629 openharmony ci 1656582662
1
https://gitee.com/openharmony/arkcompiler_ets_runtime.git
git@gitee.com:openharmony/arkcompiler_ets_runtime.git
openharmony
arkcompiler_ets_runtime
arkcompiler_ets_runtime

搜索帮助

344bd9b3 5694891 D2dac590 5694891