Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

[TS] Bind lexical this when calling stored arrow functions

Đang mở
#440 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 1 ngày

Chưa có ai nhận issue này.

Đánh giá

Độ khó
4/5
Thời gian dự kiến
3-5 ngày
Mức phù hợp với người mới
48/100
Loại issue
Lỗi
Độ rõ ràng
Khá rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
kotlin, typescript
Lĩnh vực
compilers, testing-qa

Hướng nghiên cứu

Start with TsExprResolver.kt at the function-reference creation and indirect call resolution locations cited in the issue, and review the EtsIR dependency in UnitTestBot/jacodb#391. Replay lexicalThis through USVM and compare it with the TypeScript/Node.js result. Done means stored arrows return 12, ordinary stored functions retain dynamic receivers, and a focused test records both results.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

enhancement

Problem

A stored arrow function is called with the receiver of the property access instead of the this captured where the arrow was created. This is independent of the object-array symbolic-input problem that remains in #419.

Minimal TypeScript example

class Box {
  callback!: (value: number) => number;

  constructor(public offset: number) {}

  installOn(target: Box): void {
    target.callback = (value: number) => this.offset + value;
  }

  call(value: number): number {
    return this.callback(value);
  }
}

export function lexicalThis(): number {
  const source = new Box(11);
  const target = new Box(100);
  source.installOn(target);
  return target.call(1);
}

lexicalThis() returns 12 in TypeScript/Node.js. The related StoredFunctionCall test reported in #419 on the #418 head returned 101 in USVM, using the target receiver instead of the source receiver. This standalone snippet has not yet been replayed through USVM.

Dependency and source evidence

  • UnitTestBot/jacodb#391 tracks preserving the arrow/function distinction and lexical receiver in EtsIR. This issue owns the USVM call binding after that representation is available.
  • Function-reference creation constructs the reference from the lifted method and closure environment.
  • Indirect call resolution uses callee.thisInstance for the call.

The source links are pinned to USVM main 53dce8f3. The related failure was observed on the #418 head; it is not claimed as a fresh main-branch replay.

Acceptance criteria

  • A stored arrow retains its lexical this when assigned to and called through another object; the example returns 12.
  • An ordinary stored function expression still uses its dynamic call receiver.
  • A focused test checks the USVM result and confirms a concrete TypeScript/Node.js replay.
Ngôn ngữ chính
Kotlin
Star
33
Fork
27
Merge trung bình
2 ngày 20 giờ
Pull request đã merge (30 ngày)
10

Chuẩn bị môi trường

Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của UnitTestBot/usvm

Tất cả issue của UnitTestBot/usvm

Issue tương tự

Thêm issue về Kotlin

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.