AttachMembers explicit constructors are skipped at call sites
Maintainer thường phản hồi trong vòng 1 ngày
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 48/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Khá rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- fsharp, javascript
- Lĩnh vực
- compilers
Hướng nghiên cứu
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.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
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.
- Ngôn ngữ chính
- F#
- Star
- 3.2k
- Fork
- 335
- Merge trung bình
- 19 giờ 39 phút
- Pull request đã merge (30 ngày)
- 158
Chuẩn bị môi trường
Khởi chạy dev container của dự án ngay trên trình duyệt, bằng tài khoản GitHub của bạn.
- Không có Dockerfile hay tệp Docker Compose
- Không có mẫu pull request
- Không có hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Issue khác của fable-compiler/Fable
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
fable-compiler/Fable#5280 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agentic-workflows automation repo-assist
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 78/100
fable-compiler/Fable#4531 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
agentic-workflows automation repo-assist
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
fable-compiler/Fable#4522 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
for loop bound still differs from .NET for reassigned mutable arraysCó thể đã có người làm Có pull request liên kết đang mở hoặc đã được merge. Đang mở
Độ khó 5/5 Hơn một tuần Mức phù hợp với người mới 36/100
fable-compiler/Fable#5285 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 55/100
fable-compiler/Fable#5284 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của fable-compiler/Fable
Issue tương tự
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
tree-sitter/tree-sitter-cpp#381 ·
-
[P2] Interpreter: Array.prototype.findLastIndex starts at the wrong index for long array-likesĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
Maintainer thường phản hồi trong vòng 1 ngày
-
new issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
llvm/llvm-project#240065 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 65/100
Maintainer thường phản hồi trong vòng 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
CanadaHonk/porffor#452 ·