Handle type-closing chevrons adjacent to an initializer assignment

Đang mở
#992 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

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
45/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ệ
rust
Lĩnh vực
compilers

Hướng nghiên cứu

Start with type parsing in front/parser/src/parser/types.rs and storage declarations in front/parser/src/parser/decl.rs, then inspect the lexer’s compound-operator handling. Reproduce with array<i32,1>=[1] and ptr<i32>=null while comparing the spaced forms and genuine >=/>> expressions. Done means the agreed compact-or-spaced policy is consistent across the listed generic types, diagnostics identify the exact boundary when rejected, AST/HIR behavior is equivalent for accepted forms, and source spans remain accurate.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

bug help wanted

Problem

A storage declaration using array<i32,1>=[1] or ptr<i32>=null fails while the same declaration with whitespace between > and = succeeds. The diagnostic consumes past the chevron/operator boundary and says a semicolon is missing, rather than explaining the actual boundary problem.

Starting points: type parsing, storage declarations, and the lexer compound-operator handling. This differs from the error-message preservation work in #971 and nested generic comma/chevron tests in #393.

Reproduction

Audited canonical master 540728c2eb6cc12f5c69c3fb3fdb96e07ba059a4 on Linux amd64 with a checkout-built Wave 0.0.1-alpha-dev, matching checkout std, Rust 1.89.0 and LLVM 21.1.8. Both check and build --emit=ir, with --error-format=json, reject:

fun main() {
    var a: array<i32,1>=[1];
    var p: ptr<i32>=null;
}

array<i32,1> = [1] and ptr<i32> = null are accepted controls. The errors are expected ';' in storage declaration; the pointer case highlights null, after the problematic boundary.

Scope

Resolve the type/assignment token boundary in its parsing context, retaining correct spans for any split tokens. Keep actual expression >=, >> and compound shifts unchanged. If the language intentionally requires whitespace here, document that choice and issue a boundary-specific diagnostic instead of the misleading semicolon error.

Please mention @LunaStev to discuss the design before starting implementation.

Completion criteria

  • The agreed policy is consistent for pointer, array, nested generic and ordinary named generic types.
  • Accepted compact/spaced forms have equivalent AST/HIR, or intentionally rejected forms identify the exact boundary with actionable help.
  • Genuine comparison/shift operators retain maximal-munch expression behavior; human/JSON source ranges remain accurate.
Ngôn ngữ chính
Rust
Star
56
Fork
21
Merge trung bình
23 giờ 20 phút
Pull request đã merge (30 ngày)
45

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của wavefnd/Wave

Tất cả issue của wavefnd/Wave

Issue tương tự

Thêm issue về Rust

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.