[TS] Bind lexical this when calling stored arrow functions
Mantenedores costumam responder em até 1 dia
Ninguém assumiu esta issue ainda.
Avaliação
- Dificuldade
- 4/5
- Tempo estimado
- 3-5 dias
- Facilidade para iniciantes
- 48/100
- Tipo de issue
- Bug
- Clareza
- Razoavelmente clara
- Status de atividade
- Ativa
- Stack de tecnologia
- kotlin, typescript
- Domínio
- compilers, testing-qa
Direção de pesquisa
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.
Escrita pelo modelo de indexação a partir do texto da issue.
Descrição
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.thisInstancefor 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
thiswhen assigned to and called through another object; the example returns12. - 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.
- Linguagem predominante
- Kotlin
- Estrelas
- 33
- Forks
- 27
- Merge médio
- 2d 20h
- PRs com merge (30d)
- 10
Preparar o ambiente
Este projeto não oferece contêiner de desenvolvimento, Dockerfile nem guia de contribuição, então a configuração fica por sua conta: comece pelo README e veja nosso guia da primeira contribuição para os passos gerais.
Primeiros passos
- Leia a issue inteira e depois o guia de contribuição do projeto.
- Comente na issue dizendo que vai assumir — evita que duas pessoas façam o mesmo trabalho.
- Faça um fork do repositório e trabalhe em uma branch.
- Abra um pull request que referencie o número da issue.
Mais de UnitTestBot/usvm
-
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 48/100
UnitTestBot/usvm#467 ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 5/5 Mais de uma semana Facilidade para iniciantes 38/100
UnitTestBot/usvm#465 ·
Mantenedores costumam responder em até 1 dia
-
enhancement
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
UnitTestBot/usvm#462 ·
Mantenedores costumam responder em até 1 dia
-
enhancement
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 45/100
UnitTestBot/usvm#457 ·
Mantenedores costumam responder em até 1 dia
-
enhancement
Dificuldade 4/5 3-5 dias Facilidade para iniciantes 55/100
UnitTestBot/usvm#439 ·
Mantenedores costumam responder em até 1 dia
Todas as issues de UnitTestBot/usvm
Issues semelhantes
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 85/100
-
Dificuldade 1/5 Menos de uma hora Facilidade para iniciantes 85/100
nightscout/AndroidAPS#5211 ·
Mantenedores costumam responder em até 1 dia
-
bug
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 75/100
-
enhancement
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
jellyfin/jellyfin-android#2231 · 2 comentários ·
Mantenedores costumam responder em até 1 dia
-
Dificuldade 2/5 1-3 horas Facilidade para iniciantes 65/100
commons-app/apps-android-commons#6984 ·
Mantenedores costumam responder em até 2 dias