AttachMembers explicit constructors are skipped at call sites
メンテナーはふだん 1 日以内に返信
まだ誰も着手していません。
評価
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 初心者へのやさしさ
- 48/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 活発
- 技術スタック
- fsharp, javascript
- 領域
- compilers
調査の方向性
Start by tracing how [<AttachMembers>] explicit constructors are emitted and how constructor calls are resolved in the Fable compiler; the issue does not name source files or tests. Reproduce the example on the JS target, including the base class case, then inspect or add coverage for overloads and field initialization. Done means generated calls use the explicit constructors and overloads remain distinct.
索引モデルが issue の本文から書いたものです。
説明
With [<AttachMembers>], calls to explicit constructors skip the constructor body. .NET prints 2 5, Fable on JS prints 0 5:
[<Fable.Core.AttachMembers>]
type V =
val mutable X: int
new () = { X = 2 }
new (x: int) = { X = x }
member this.Get() = this.X
printfn "%d %d" ((V()).Get()) ((V(5)).Get())
Generated JS:
export class V {
constructor(X) {
this.X = (X | 0);
}
static ".ctor"() {
return new V(2);
}
static ".ctor"(x) {
return new V(x);
}
Get() {
const this$ = this;
return this$.X | 0;
}
}
const arg = (new V()).Get() | 0;
const arg_1 = (new V(5)).Get() | 0;
Two problems:
- The call sites use
new V(...)with the F# arguments instead of the explicit constructor, soV()never setsX = 2.V(5)is only right because its argument happens to match the field. - Every overload is emitted as
static ".ctor", so the last one replaces the others.
The same happens with a base class, for example new () = { inherit B(1); X = 2 } in an [<AttachMembers>] class.
Reproduces on main. I only checked JS.
- 主要言語
- F#
- スター
- 3.2k
- フォーク
- 335
- 平均マージ
- 19時間 39分
- マージ済み PR(30日)
- 158
環境構築
このプロジェクトの開発コンテナを、あなたの GitHub アカウントでブラウザ上に起動します。
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートなし
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
fable-compiler/Fable のほかの issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
fable-compiler/Fable#5280 ·
メンテナーはふだん 1 日以内に返信
-
agentic-workflows automation repo-assist
難易度 1/5 1時間未満 初心者へのやさしさ 78/100
fable-compiler/Fable#4531 ·
メンテナーはふだん 1 日以内に返信
-
agentic-workflows automation repo-assist
難易度 2/5 1〜3時間 初心者へのやさしさ 68/100
fable-compiler/Fable#4522 ·
メンテナーはふだん 1 日以内に返信
-
難易度 5/5 1週間以上 初心者へのやさしさ 36/100
fable-compiler/Fable#5285 ·
メンテナーはふだん 1 日以内に返信
-
難易度 4/5 3〜5日 初心者へのやさしさ 55/100
fable-compiler/Fable#5284 ·
メンテナーはふだん 1 日以内に返信
fable-compiler/Fable の issue をすべて見る
似ている issue
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 84/100
tree-sitter/tree-sitter-cpp#381 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 83/100
メンテナーはふだん 1 日以内に返信
-
new issue
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
llvm/llvm-project#240065 ·
メンテナーはふだん 1 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
メンテナーはふだん 2 日以内に返信
-
難易度 2/5 1〜3時間 初心者へのやさしさ 77/100
CanadaHonk/porffor#452 ·