[P2] Compiler: absent Promise instance properties read as null instead of undefined
Maintainers usually reply within 1 day
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 78/100
- Issue type
- Bug
- Clarity
- Clearly specified
- Activity status
- Active
- Tech stack
- csharp, typescript
- Domain
- compilers
Research direction
Start in Compilation/RuntimeEmitter.Objects.Properties.cs, where the Promise property handler returns null for unknown properties. Compare that branch with the emitted undefined sentinel and check that present properties and genuine null values keep their behavior. Use the supplied Promise reproduction and controls; done when compiled execution matches Node and interpreted execution for the missing-property checks.
Written by the indexing model from the issue text.
Description
Reading an absent property on an untouched Promise returns null in compiled execution, rather than JavaScript undefined. Intrinsic and guest-subclass Promise receivers both reproduce.
const promise: any = Promise.resolve(1);
console.log(promise.missing === undefined, promise.missing === null,
typeof promise.missing, Object.hasOwn(promise, "missing"));
Strict TypeScript accepts. Node v22.23.2 and immutable checked interpretation print:
true false undefined false
The same immutable compiler saves a standalone assembly that passes full IL verification before execution, then prints:
false true object false
A separate minimal control uses new P(resolve => resolve(1)) where class P extends Promise<number> {}; it has the same compiled-only failure. The otherwise equivalent ordinary-object read from {} is correct in all paths. Neither source writes any property, installs a descriptor, awaits a value, uses a Symbol, or invokes the missing member.
Source lead: Compilation/RuntimeEmitter.Objects.Properties.cs ends its Promise property handler with the explicit // Unknown promise property - return null branch and Ldnull/Ret. An absent property must return the emitted undefined sentinel while preserving genuine null data values and present accessor behavior.
Found while fixing interpreter #2545, which concerns computed Promise writes. Fresh all-state searches for Promise missing/absent/null property reads found no focused owner. Read #2436: that report specifically owns PRESENT getterless Promise accessor descriptors and undefined getter sentinels; this source has no descriptor at all. Closed #651 is expressly limited to missing function/arrow properties, and #1778 to TypeScript namespace objects. No introducing-commit claim.
Proof: artifacts/p2-interpreter/2545-missing-promise-own-read-results.json, exact 2545-missing-promise-own-read.ts (SHA256 7BFB59CE83106A2DB04D13F37123908EF8AC48D72D77ADCB1994C45E17C81B16), 2545-missing-promise-own-read-controls.ts, and adjacent strict-TypeScript/Node/interpreted/compile/saved-execution logs. Fresh dedup and related bodies are 2545-missing-promise-read-* plus the full #2436 body in 2545-related-2436.json.
Immutable baseline CLI SHA256 B5FA2CADDEA116B83166442205B825130A663B682EDAABAA1312A26FB7909E85 was checked unchanged before and after the probes. Interpretation used --no-tsconfig --noLib; compilation additionally used --compile ... --standalone --verify. Both saved outputs executed only after compile exit zero, the complete IL verification passed. marker, and no warning or unsupported-runtime note. Every process exited zero without timing out. No project build or production edit was performed.
- Dominant language
- C#
- Stars
- 156
- Forks
- 4
- Avg merge
- 4h 14m
- Merged PRs (30d)
- 89
Getting set up
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from nickna/SharpTS
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
Maintainers usually reply within 1 day
-
bug priority: P2
Difficulty 2/5 1-3 hours Newbie friendliness 68/100
Maintainers usually reply within 1 day
-
bug priority: P2
Difficulty 2/5 1-3 hours Newbie friendliness 78/100
Maintainers usually reply within 1 day
-
bug priority: P2
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
Maintainers usually reply within 1 day
-
priority: P2
Difficulty 2/5 1-3 hours Newbie friendliness 73/100
Maintainers usually reply within 1 day
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
qew21/Genshin-Subtitles#45 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
space-wizards/RobustToolbox#7158 ·
Maintainers usually reply within 1 day
-
:watch: Not Triaged dotnet-csharp/svc fundamentals/subsvc
Difficulty 1/5 Under an hour Newbie friendliness 88/100
Maintainers usually reply within 1 day
-
Wrong values of Kernel32.FileShare.Delete and Kernel32.FileAttributes.PosixSemanticsPossibly taken @ElectLive claimed this today. Openbug good first issue help wanted
Difficulty 1/5 Under an hour Newbie friendliness 83/100
ForNeVeR/TruePath#241 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
files-community/Files#19047 ·
Maintainers usually reply within 1 day