Completion inside a list literal ignores the element type
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ệ
- ocaml
- Lĩnh vực
- devtools
Hướng nghiên cứu
Start by comparing the completion context path for array literals with the Type_utils.extract_type behavior described for list<'a>. The issue names no test file, and notes there are no existing completion tests for list literals, so first locate the completion tests and add coverage for typed list elements, including partially typed elements and an empty list. Done means completions use the list element type as they do for arrays.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
What is broken
Completion inside a list{…} literal doesn't use the list's element type, while the same position in an array literal does:
type kind = First | Second
let arr: array<kind> = [First, ]
// ^com First, Second
let ys: list<kind> = list{First, }
// ^com nothing
let zs: list<kind> = list{First, Se}
// ^com only `module Set`
let f = (x: list<kind>) => x
let _ = f(list{})
// ^com nothing
The completion log shows why: for the array the context path is array<Type[kind]> and then Type[kind], but for the list it is Type[list], so the element type kind is lost. A partly typed element then falls back to untyped completion (module Set for Se).
Checked on master ac7357822e. There are no completion tests for list literals, which is why it went unnoticed. It came up while fixing array spreads in #9199 (#9183), which leaves lists alone for this reason.
Possible cause (speculation only)
Type_utils.extract_type has no case for list<'a>, and looking up the built-in list type fails, so there is no element type to complete from.
A related limit: list{...xs, } with a trailing hole is parsed as the plain expression xs, because a spread in tail position is a :: chain, so no completion position remains there.
🤖 Generated with Claude Code
- Ngôn ngữ chính
- OCaml
- Star
- 7.5k
- Fork
- 484
- Merge trung bình
- 16 giờ 57 phút
- Pull request đã merge (30 ngày)
- 258
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
- Có mẫu pull request
- Đọ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 rescript-lang/rescript
-
Exception analysis does not know the Temporal `fromStringOrThrow` functionsCó thể đã có người làm @cknitt đã nhận 1 ngày trước. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
rescript-lang/rescript#9182 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
await in a functor body compiles to invalid JavaScriptCó thể đã có người làm @mununki đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 25/100
rescript-lang/rescript#9219 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
`(() :> string)` compiles, and other coercions and variant spreads treat `bool` and `unit` as variantsCó thể đã có người làm @mununki đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
rescript-lang/rescript#9216 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
A polymorphic variant argument of an external is evaluated twice, or inside a generated functionCó thể đã có người làm @mununki đã nhận hôm nay. Đang mở
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 20/100
rescript-lang/rescript#9215 ·
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
rescript-lang/rescript#9197 ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của rescript-lang/rescript
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
-
needs-area-label
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/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 78/100
gitbutlerapp/gitbutler#16982 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug
Độ 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 2 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
TransformerLensOrg/TransformerLens#1980 ·
Maintainer thường phản hồi trong vòng 1 ngày