[TS] Support field assignments that change the runtime value sort
維護者通常 1 天內回覆
還沒有人認領這個 Issue。
評估
- 難度
- 4/5
- 預估耗時
- 3-5 天
- 新手友好度
- 48/100
- Issue 類型
- 功能
- 描述清晰度
- 基本清楚
- 活躍度
- 活躍
- 技術堆疊
- kotlin, typescript
研究方向
Start with the unsupported path reported by PR #466 and the related context in issue #465, using the minimal TypeScript example as the reproducer. Add the focused symbolic tests described in the acceptance criteria, including the alias case, and replay generated concrete cases in Node.js; done means both branches have no unsupported paths and existing typed field operations remain correct.
由索引模型根據 Issue 內容生成。
描述
Current state (2026-10-14)
Audited against usvm main at 19866c959d.
Structural symbolic object fields can change runtime kind after #458. For concretely allocated declared class fields, WriteField still rejects incompatible value sorts; the method-reference audit also reproduced this boundary.
Remaining acceptance boundary
Represent the current allocated-field value independently of its declared sort and preserve replacement/alias reads. Re-run both Numeric/Text constructor branches with no unsupported path and native replay; preserve the existing explicit boundary until implemented.
Original report and acceptance context, retained for traceability
Problem
TypeScript permits assigning a value whose JavaScript type differs from a field's declared type when the receiver has a union type. The symbolic executor stores fields in separate regions by value sort. After selecting a concrete runtime class, a write of another sort cannot be represented by that class's declared field region. USVM #465 / PR #466 now reports that path as unsupported; it still needs a sound model.
Minimal TypeScript example
class Numeric {
value: number = 1;
numericOnly: boolean = true;
}
class Text {
value: string = "initial";
textOnly: boolean = true;
}
export function check(useNumeric: boolean): boolean {
const object = new (useNumeric ? Numeric : Text)();
object.value = "changed";
return object.value === "changed";
}
TypeScript accepts this code, and Node.js returns true for both check(true) and check(false). With PR #466, the Text branch is modeled and the Numeric branch is explicitly reported in unsupportedPaths because assigning a string changes the field's runtime value sort.
Expected support
Model the current value of an object field independently of its declared TypeScript type. A write that changes the JavaScript value type must replace the previous value; subsequent reads, including through aliases, must observe the new type and value. Branches that cannot yet be modeled should remain explicitly unsupported rather than produce a stale field value.
Acceptance criteria
- A focused symbolic test covers both branches with no unsupported paths and checks that both return
true. - The generated concrete cases replay in Node.js.
- A second test reads the changed field through an alias and confirms that the original field value is no longer visible.
- Existing typed numeric, Boolean, reference, and
anyfield operations remain correct.
Related: #465 and PR #466. This task concerns value type changes after assignment, not constructor selection.
- 主要語言
- Kotlin
- 星號
- 33
- 分支
- 27
- 平均合併
- 4 天 1 小時
- 30 天內合併 PR
- 84
環境準備
這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。
從這裡開始
- 先讀完整個 Issue,再讀專案的貢獻指南。
- 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
- Fork 儲存庫,在一個分支上完成修改。
- 送出 Pull Request,並在描述裡引用這個 Issue 編號。
UnitTestBot/usvm 的其他 Issue
-
[TS PBT] Save campaign-file artifacts before stdout publication可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 2/5 1-3 小時 新手友好度 74/100
UnitTestBot/usvm#612 ·
維護者通常 1 天內回覆
-
[TS PBT] Preserve class verification after expected PBT budget expiry可能已有人在做 關聯的 PR 仍在進行中或已合併。 未關閉
難度 5/5 一週以上 新手友好度 18/100
UnitTestBot/usvm#618 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 25/100
UnitTestBot/usvm#613 ·
維護者通常 1 天內回覆
-
難度 4/5 3-5 天 新手友好度 43/100
UnitTestBot/usvm#604 ·
維護者通常 1 天內回覆
-
難度 5/5 一週以上 新手友好度 25/100
UnitTestBot/usvm#592 ·
維護者通常 1 天內回覆
相似的 Issue
-
bug
難度 2/5 1-3 小時 新手友好度 78/100
RevenueCat/purchases-hybrid-common#2039 ·
維護者通常 1 天內回覆
-
難度 2/5 1-3 小時 新手友好度 68/100
partiql/partiql-scribe#223 ·
維護者通常 3 天內回覆
-
bug
難度 2/5 1-3 小時 新手友好度 65/100
damontecres/Wholphin#2143 ·
維護者通常 2 天內回覆
-
bug good first issue
難度 2/5 1-3 小時 新手友好度 76/100
-
enhancement needs-triage
難度 1/5 1 小時以內 新手友好度 78/100
facebook/facebook-android-sdk#1418 ·