已关闭
Fix function types and lambda exp with receiver #10491
Fix function types and lambda exp with receiver #10491
已关闭
Fouckttt创建于 4月19日关闭于 6月22日
Fouckttt
Fouckttt
4月19日

关联的Issue

https://gitcode.com/openharmony/arkcompiler_ets_frontend/issues/9819

提交类型

需求背景/Description

Receiver-based function types and lambda expressions were not handled consistently across checker and lowering. This caused several incorrect behaviors, including unexpected compiler crashes, wrong call-shape diagnostics, and incorrect member
resolution for this inside receiver lambdas. Affected scenarios included local receiver functions, synthetic lambda bodies, interface properties of type (this: T) => R, and cases where a class method and a same-name receiver function were both
visible.

问题现象&&分析/Reason

This fix stabilizes receiver-function handling in both checker and lowering:

Binds explicit receiver this consistently in checker, including nested arrow/lambda contexts.
Re-resolves extension-style calls after desugaring a.foo(...) to foo(a, ...), and avoids self-referential lookup from the current declarator.
Lowers synthetic receiver-lambda bodies directly to final invoke* form instead of relying on reset/re-check of generated bodies.
Uses a dedicated ordinary parameter for receiver-lambda bridge methods so lambda-object this and receiver this are no longer conflated.
Treats interface-property-backed callables as field-like during call resolution, so expressions such as i.f(a) are checked as ordinary function-value calls instead of extension-method calls.
Preserves real instance member priority for this.f() / a.f() over same-name receiver-function candidates when a class member already exists.
This fix stabilizes receiver-function handling in both checker and lowering:

Binds explicit receiver this consistently in checker, including nested arrow/lambda contexts.
Re-resolves extension-style calls after desugaring a.foo(...) to foo(a, ...), and avoids self-referential lookup from the current declarator.
Lowers synthetic receiver-lambda bodies directly to final invoke* form instead of relying on reset/re-check of generated bodies.
Uses a dedicated ordinary parameter for receiver-lambda bridge methods so lambda-object this and receiver this are no longer conflated.
Treats interface-property-backed callables as field-like during call resolution, so expressions such as i.f(a) are checked as ordinary function-value calls instead of extension-method calls.
Preserves real instance member priority for this.f() / a.f() over same-name receiver-function candidates when a class member already exists.

修改方案/Scheme

This fix stabilizes receiver-function handling in both checker and lowering:

Binds explicit receiver this consistently in checker, including nested arrow/lambda contexts.
Re-resolves extension-style calls after desugaring a.foo(...) to foo(a, ...), and avoids self-referential lookup from the current declarator.
Lowers synthetic receiver-lambda bodies directly to final invoke* form instead of relying on reset/re-check of generated bodies.
Uses a dedicated ordinary parameter for receiver-lambda bridge methods so lambda-object this and receiver this are no longer conflated.
Treats interface-property-backed callables as field-like during call resolution, so expressions such as i.f(a) are checked as ordinary function-value calls instead of extension-method calls.
Preserves real instance member priority for this.f() / a.f() over same-name receiver-function candidates when a class member already exists.****

测试结果(测试截图直接贴在对应测试项,主干已知问题需明确引入pr/责任人)

功能测试(除仅涉及文本外必测项)wiki

  1. es2abc测试用例(Debug模式)
  • [ x] 已通过
  1. Verifier测试
  • [x ] 已通过
  1. 64位RK编译
  • [ x] 已通过
  1. 编译mac平台sdk
  • [ x] 已通过

混淆测试(涉及arkguard改动时必测项)wiki

  1. 单元测试

    • [] 已通过
    • [x ] 不涉及,无需验证
  2. Compiler测试套

    • [x ] 不涉及,无需验证
  3. TSC extra测试套

    • [x ] 不涉及,无需验证
  4. Test262测试套

  5. Benchmark测试

    • [ x] 不涉及,无需验证
  6. 应用自动化测试套

  7. 是否创建全局变量,若创建全局变量,是否有清空操作

兼容性测试(指令生成、文件格式修改时)

  1. 小版本兼容性测试

  2. 大版本兼容性测试

  3. es2abc版本兼容性测试
    说明:如PR涉及版本控制用例的变更,需同步检查修改对其他分支的影响,并确认是否要同步受影响的分支

  4. 是否涉及词法环境修改
    说明:如PR涉及词法环境修改,需验证对应热重载场景是否兼容

性能测试 (新增语法检查等场景)

指令/abc格式修改自检,需联系下方邮箱,同步至相关领域

重要:涉及runtime_core仓abc2program、libpandafile、isa目录下的修改,必须提供一个编译helloworld项目的hap包给对应领域,并联系下方邮箱

Email: wutao185@huawei.com

是否已执行L0用例

是否已执行L0用例

Change-Id: I98f45de7775f015258ab89605387428d254d4bf6

likedislike
当前Pull Request已关闭, 关闭人@Fouckttt
FoucktttFouckttt
4月19日 关联了issue:Fix unexpected CTEs and crashes on function types and lambda expressions with receiver
openharmony_ciopenharmony_ci成员
4月19日 添加了label:waiting_on_author
openharmony_ci
openharmony_ci成员
4月19日 评论:

感谢提交 Pull Requests!如果您提交的PR已经开发完毕,请评论 "start build" 触发门禁,更多交互操作,请访问OpenHarmony社区支持命令清单。如果需要调整订阅PR、Issue的变更状态,请访问订阅链接。


Thanks for submitting the pull request. If your Pull Request has already been developed, you can leave a "start build" comment to trigger the gated system. For more commands, please visit OpenHarmony Command List. If you need to change the subscription of a Pull Request or Issue, please visit the link.

likedislike
openharmony_ciopenharmony_ci成员
4月19日 添加了label:dco检查成功
Fouckttt
Fouckttt
4月19日 评论:

start build

likedislike
此处折叠了153条消息 查看更多
openharmony_dcp
openharmony_dcp成员
6月5日 评论:

您的PR超过一个月未合入,已经被自动关闭,如有需要您可以重新提交代码进行贡献。

likedislike
openharmony_dcp
openharmony_dcp成员
6月6日 评论:

您的PR超过一个月未合入,已经被自动关闭,如有需要您可以重新提交代码进行贡献。

likedislike
openharmony_dcp
openharmony_dcp成员
6月7日 评论:

您的PR超过一个月未合入,已经被自动关闭,如有需要您可以重新提交代码进行贡献。

likedislike
openharmony_dcp
openharmony_dcp成员
6月8日 评论:

您的PR超过一个月未合入,已经被自动关闭,如有需要您可以重新提交代码进行贡献。

likedislike
FoucktttFouckttt
6月22日 关闭了 pull request