SC9001 "missing method function toString" when the entry exports a class whose `toString` nothing calls
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 55/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- typescript
- 領域
- compilers
調査の方向性
Start by tracing the compiler path that handles exported classes and the %util.clsString call; the issue also points to the related %dyn.class.protocol report in #3503. Reproduce with the provided index.ts and npx [email protected] build index.ts, then compare the exported class case with the listed variants that compile. Done means the entry compiles without either SC9001 error.
索引モデルが issue の本文から書いたものです。
説明
scriptc 0.4.14 crashes on an entry module that exports a class with its own toString when the program never calls that method.
Reproduction
package.json:
{ "type": "module" }
index.ts:
export class U {
toString(): string {
return 'u';
}
}
npx [email protected] build index.ts
Observed
index.ts:1:1 - error SC9001: internal compiler error: class U: missing method function "toString" — please report this
index.ts:1:1 - error SC9001: internal compiler error: in %util.clsString.5f569930a64f: call to undeclared function "%U.toString" — please report this
2 errors.
The same errors appear with export default class U, with an unexported class returned from an exported factory (export const make = () => new U();), and with --emit obj.
Expected
The module compiles.
These variants compile:
- The program calls the method:
export class U { ... }followed byconsole.log(new U().toString());. - The class is not exported and the entry uses it locally, for example
console.log(new U() instanceof U);. - The method has another name, such as
describe(), or isvalueOf(). - The entry exports an instance:
export const u = new U();. - Another module imports
Uand the entry exports nothing from it.
#3503 reported an SC9001 for toString reached through %dyn.class.protocol in 0.4.10. This one goes through %util.clsString and needs no interface.
Context
JSPrismarine hits this when building a package entry on its own: UUID in @jsprismarine/protocol and ServerName in @jsprismarine/raknet export classes like this (https://github.com/JSPrismarine/JSPrismarine/issues/3323).
Environment
- scriptc 0.4.14 from npm
- Linux x86_64, glibc 2.43
- Node.js 26.13.0
- 主要言語
- TypeScript
- スター
- 6.7k
- フォーク
- 229
- 平均マージ
- 14時間 29分
- マージ済み PR(30日)
- 787
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドを読む
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
vercel-labs/scriptc のほかの issue
-
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
vercel-labs/scriptc#4865 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 58/100
vercel-labs/scriptc#4864 ·
メンテナーはふだん 1 日以内に返信
-
Windows ARM64 as a cross-compile target対応中かも @hum-n が 1 日前に担当しました。 オープン
難易度 4/5 3〜5日 初心者へのやさしさ 35/100
vercel-labs/scriptc#4858 ·
メンテナーはふだん 1 日以内に返信
-
post-merge-bisect-unresolved
難易度 3/5 1〜2日 初心者へのやさしさ 43/100
vercel-labs/scriptc#4791 ·
メンテナーはふだん 1 日以内に返信
-
post-merge-bisect-unconfirmed
難易度 5/5 1週間以上 初心者へのやさしさ 12/100
vercel-labs/scriptc#4755 · コメント 1 件 ·
メンテナーはふだん 1 日以内に返信
vercel-labs/scriptc の issue をすべて見る
似ている issue
-
bug data-types
難易度 2/5 1〜3時間 初心者へのやさしさ 88/100
ClickHouse/clickhouse-js#1293 ·
メンテナーはふだん 1 日以内に返信
-
area: middleware enhancement good first issue
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
-
agent/quality testing
難易度 1/5 1時間未満 初心者へのやさしさ 95/100
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 92/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 78/100
juspay/agent-distro#203 ·
メンテナーはふだん 1 日以内に返信