[P2] Compiler: boxed String own methods are bypassed by direct calls
Maintainers usually reply within 1 day
A pull request for this has already been merged.
- #3329 by @nickna — merged
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 30/100
- Issue type
- Bug
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- csharp, typescript
- Domain
- compilers
Research direction
The bug lives in the compiler's boxed-string method dispatch, where direct calls on a boxed String reach the intrinsic helper before ordinary own-property lookup. Start by reproducing the three-line TypeScript snippet with --no-tsconfig --lib es2022,dom and comparing interpreted output with saved compiled output. Done means the compiled run prints true, matching Node, and the related #3457 non-string receiver defect is not regressed.
Written by the indexing model from the issue text.
Description
A compiled direct method call on a boxed String bypasses its assigned own method.
const value: any = new String("abc");
value.includes = function (s: string) { return s === "q"; };
console.log(value.includes("q"));
Strict TypeScript accepts this program. Node and SharpTS interpretation print true; saved compiled execution prints false, matching the unmodified prototype method instead of the own function. Independent whole-assembly IL verification reports no findings.
Reproduced with --no-tsconfig --lib es2022,dom. No string assertion or annotated string parameter is involved. The compiler's boxed-string dispatch reaches the intrinsic helper before ordinary method lookup, so this is distinct from the asserted non-string receiver defect in #3457.
- Dominant language
- C#
- Stars
- 156
- Forks
- 4
- Avg merge
- 14h 41m
- Merged PRs (30d)
- 43
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 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
priority: P2
Difficulty 4/5 3-5 days Newbie friendliness 38/100
Maintainers usually reply within 1 day
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
bug priority: P2
Difficulty 5/5 Over a week Newbie friendliness 35/100
Maintainers usually reply within 1 day
-
bug priority: P2
Difficulty 5/5 Over a week Newbie friendliness 30/100
Maintainers usually reply within 1 day
Similar issues
-
Add All ContributorsOpenenhancement ready-for-human
Difficulty 2/5 1-3 hours Newbie friendliness 62/100
fboucher/2d6-dungeon-app#288 · 1 comment ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 80/100
Unity-Technologies/unity-agent-plugin#118 ·
Maintainers usually reply within 1 day
-
The Recommended preset turns on Import Uno DSP, which only works with the Material themePossibly taken @agneszitte claimed this today. Open
Difficulty 1/5 Under an hour Newbie friendliness 92/100
unoplatform/uno.templates#2388 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 77/100
eyalgolan/statecraft-israel#2732 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
StratumServer/Optimum#198 ·
Maintainers usually reply within 1 day