已合并
instanceof+interface unexpected narrows to never #11175
ajq257257创建于 14 天前
instanceof+interface unexpected narrows to never #11175
已合并
Pull Request已成功合入, 合并人@openharmony_ci
(感谢 ajq257257 的贡献)openharmony_ci
14 天前 评论:
14 天前 评论:
该仓未配置门禁,无法触发构建。如需要检视代码请 pr作者 评论 code review


openharmony_ci
14 天前 评论:
14 天前 评论:
首次触发
门禁构建开始,包含静态检查、代码编译和测试【dayu200_xts_acts编译, ohos-host_mini_tdd编译, dayu600_7885编译, dayu200测试, dayu600_7885测试, hap_build编译, dayu200编译, mac-sdk编译, dayu200_tdd编译, master_inner_build编译, x86_64_virt编译, ohos-sdk编译, dayu200_xts编译, dayu200_xts_static编译】,预计在60分钟内完成,门禁结果会同步发送到注册邮箱。您可以通过如下链接跟踪门禁进展:http://dcp.openharmony.cn/workbench/cicd/detail/6a7ec0f364650f998b7f5b98/runlist


此处折叠了54条消息 查看更多
11 天前 关闭了关联的issue
11 天前 合入了pull request,合并节点 SHA:4acda50900c0a0b47b167a13b675476e3f2ac194
11 天前 删除了label:waiting_for_review
11 天前 添加了label:merged
关联的Issue
https://gitcode.com/openharmony/arkcompiler_ets_frontend/issues/11941
提交类型
需求背景/Description
问题现象&&分析/Reason
In ArkTS-Sta, the checker performs smart-cast (type narrowing) inside the true branch of if (x instanceof T). When the static type of x is an interface and T is an unrelated class (or vice versa), the checker incorrectly narrowed x to never. The codegen then emitted failedTypeCastInclUndefinedStub + throw inside the if-body, so when instanceof correctly returned true at runtime, the unconditional throw was triggered and caught by a surrounding try/catch, making the program take the wrong branch.
reason
Two bugs in the ETS checker, both from the same misconception: when two types have no direct supertype relationship, the checker assumed instanceof can never succeed — ignoring that an interface-typed variable can hold an object whose concrete class extends the tested type.
修改方案/Scheme
After the fix, codegen produces a normal checkcast.nonnull
测试结果(测试截图直接贴在对应测试项,主干已知问题需明确引入pr/责任人)
功能测试(除仅涉及文本外必测项)wiki
混淆测试(涉及arkguard改动时必测项)wiki
单元测试
Compiler测试套
TSC extra测试套
Test262测试套
Benchmark测试
应用自动化测试套
是否创建全局变量,若创建全局变量,是否有清空操作
兼容性测试(指令生成、文件格式修改时)
小版本兼容性测试
大版本兼容性测试
es2abc版本兼容性测试
说明:如PR涉及版本控制用例的变更,需同步检查修改对其他分支的影响,并确认是否要同步受影响的分支
是否涉及词法环境修改
说明:如PR涉及词法环境修改,需验证对应热重载场景是否兼容
性能测试 (新增语法检查等场景)
指令/abc格式修改自检,需联系下方邮箱,同步至相关领域
重要:涉及runtime_core仓abc2program、libpandafile、isa目录下的修改,必须提供一个编译helloworld项目的hap包给对应领域,并联系下方邮箱
Email: wutao185@huawei.com
是否已执行L0用例
是否已执行L0用例
Change-Id: Ib53fd18cbf4dd1efa983818d9810e59fd6a3f01e