0xMiden / 0xMiden/miden-vm

Unsupported @callconv forms break AST rendering round trips

Đang mở
#3,820 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
Ngôn ngữ chính
Rust
Star
772
Fork
352
Merge trung bình
1 ngày 7 giờ
Pull request đã merge (30 ngày)
84

Mô tả

The parser accepts unsupported forms of `@callconv` as generic attributes. If a procedure also has a protocol ABI attribute, the parser infers the component model calling convention and stores both forms in the AST.

For example:

```masm
namespace test::callconv

@account_procedure
@callconv("C", "fast")
pub proc foo() -> i1
push.1
end
```

The first parse succeeds. Calling `Module::to_string()` then produces two adjacent attributes:

```masm
@callconv("C", "fast")@callconv("component-model")
```

Parsing the rendered source fails with `conflicting attributes for procedure definition`.

The parser should validate every attribute named `callconv`, regardless of its form. It should reject unsupported forms during the first parse. We should also add a test that parses this input, renders the AST, and parses the result again.

This is related to #3658, which tracks other cases where AST output does not parse.

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Look for the parser's attribute validation logic, likely in a module handling procedure definitions or attributes. The test should be added to the existing test suite for parsing/rendering round trips. Start by finding where `@callconv` is currently processed and add validation to reject unsupported forms. Verify by running the new test and ensuring the original example fails to parse.

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

Đánh giá

Công nghệ
rust
Lĩnh vực
compilers
Loại issue
Lỗi
Độ khó
3/5
Thời gian dự kiến
1-2 ngày
Mức độ hoạt động
Sôi nổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
65/100

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.