Preserve expression assembly result types when recording HIR conversions
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ó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 35/100
Hướng nghiên cứu
Start at front/parser/src/verification/expression.rs, especially validate_expr_asm_block, which the issue identifies as returning Unknown. Trace how typed HIR records ordered conversions for initializers, returns, arithmetic, and casts, then check how LLVM consumes them. Done means supported typed scalar outputs preserve language conversions, unsupported contexts produce source diagnostics, and existing expression-asm regressions pass.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Problem
Expression-form assembly always validates to ExpressionType::Unknown even when its single output has a concrete scalar type. An enclosing initializer or return can therefore pass checking without the numeric conversion required by LLVM lowering. Ordinary arithmetic and explicit casts also see unknown rather than the typed result.
Starting point: validate_expr_asm_block, which returns Unknown after validating its operands.
Reproduction
Audited canonical master e1f8effd195b6339c3979b1e091e63c25f1da983 on Linux amd64 with checkout-built Wave 0.0.1-alpha-dev, matching std, Rust 1.89.0, Cargo jobs=2 and LLVM 21.1.8. The master SHA was rechecked before registration.
fun main() {
var sink: i64 = 0;
var result: bool = asm {
"mov rax, 7"
out("rax") sink
clobber("nostack")
};
}
target/debug/wavec --std-root "$PWD/std" check repro.wave
target/debug/wavec --std-root "$PWD/std" --error-format=json build repro.wave --emit=ir --out-dir .tmp/asm-type-repro
check exits 0. IR generation exits 1 with E9001:
ICE: numeric boundary conversion missing from HIR: variable 'result' initializer
compiler panic location: llvm/src/statement/variable.rs:83:13
Changing result to f64 produces the same failure. Returning the expression from a function declared -> i32 also passes check and fails with missing HIR conversion ret_cast. In a separate control, adding an integer to the expression or explicitly casting it is rejected because the result is unknown.
Scope
Determine the expression's established single-output result type in semantic analysis and preserve required ordered conversions in Typed HIR. LLVM must consume those facts rather than inventing conversions. Unsupported or incompatible contexts need a source diagnostic before code generation. Preserve the single-result output contract and one evaluation of asm and its operands.
Related: #512 is input-expression lowering and #679 is asm-initializer binding registration. Neither fixes the result-type/conversion boundary described here.
Completion criteria
- Typed scalar asm results participate in supported initializers, returns, arithmetic and casts without Unknown leaking into validated HIR.
- Supported bool/float/integer conversions follow existing language rules, widths and evaluation order.
- Unsupported contexts fail with a source diagnostic rather than E9001.
- Existing expression-asm input, output-count, binding and side-effect regressions continue to pass.
- Ngôn ngữ chính
- Rust
- Star
- 56
- Fork
- 21
- Merge trung bình
- 22 giờ 57 phút
- Pull request đã merge (30 ngày)
- 46
Chuẩn bị môi trường
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 wavefnd/Wave
-
Reject unrepresentable POSIX listener descriptors before Unix-domain acceptCó thể đã có người làm @ShahadatTest đã nhận 3 ngày trước. Đang mởbug good first issue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 84/100
wavefnd/Wave#1082 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bug help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 53/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug build help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 56/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug ci help wanted
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 48/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Prevent compiler stack overflow on long acyclic forward type-alias chainsCó thể đã có người làm @hiyouwhatsapp đã nhận 4 ngày trước. Đang mởbug
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
ScoopInstaller/Extras#19275 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
area:plugins kind:bug priority:p2 ready
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 88/100
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 85/100
Maintainer thường phản hồi trong vòng 1 ngày
-
bug priority: medium ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
storytold/gridcraft#3496 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
bip39: Mnemonic::new_from_phrase rejects phrases with extra or non-space whitespaceCó thể đã có người làm @chukwudiikeh đã nhận hôm nay. Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 90/100
Maintainer thường phản hồi trong vòng 1 ngày