[TS] Support field assignments that change the runtime value sort
Les mainteneurs répondent en général sous 1 jour
Personne n'a encore pris cette issue.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 48/100
- Type d'issue
- Fonctionnalité
- Clarté
- Plutôt claire
- Activité
- Active
- Stack technique
- kotlin, typescript
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- Kotlin
- Étoiles
- 33
- Forks
- 27
- Merge moyen
- 3 j 21 h
- PR mergées (30 j)
- 88
Préparer son environnement
Ce projet ne fournit ni conteneur de développement, ni Dockerfile, ni guide de contribution : l'installation est à votre charge. Commencez par son README, et consultez notre guide de la première contribution pour les étapes générales.
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de UnitTestBot/usvm
-
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
UnitTestBot/usvm#612 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 18/100
UnitTestBot/usvm#618 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 25/100
UnitTestBot/usvm#613 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 4/5 3-5 jours Accessibilité débutants 43/100
UnitTestBot/usvm#604 ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 5/5 Plus d'une semaine Accessibilité débutants 25/100
UnitTestBot/usvm#592 ·
Les mainteneurs répondent en général sous 1 jour
Toutes les issues de UnitTestBot/usvm
Issues similaires
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 67/100
Les mainteneurs répondent en général sous 1 jour
-
afk-ok area:agents size:S
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
enorm-labs/event-junkie#3523 ·
Les mainteneurs répondent en général sous 1 jour
-
[Submission] WeChat KidsOuvertesubmit-adaption submit-adaption-pre
Difficulté 1/5 Moins d'une heure Accessibilité débutants 82/100
BetterAndroid/android-notification-icon-project#750 · 1 commentaire ·
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
lysine-dev/okhttp#9797 ·
Les mainteneurs répondent en général sous 1 jour
-
bug
Difficulté 2/5 1-3 heures Accessibilité débutants 70/100
openbase/planetsudo.engine#107 ·
Les mainteneurs répondent en général sous 1 jour