You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
t27c lexer: <<= and >>= are not lexed, so shift compound assignment does not parse #7940
Part of #5980 (P1: compound assignment). The self-hosted core accepts += -= *= /= %= |= &= ^= byte-identically with gen-c (#7313), and refuses <<= and >>= because t27c cannot parse them.
Defect
The emitter maps both operators (bootstrap/src/compiler.rs, the compound-operator table: "<<=" => Some("<<"), ">>=" => Some(">>"), written there so "the next spec to use one must not pay for" a missing entry). But the lexer reads <<= as << followed by =, so a spec that uses either one fails to parse in every backend:
module m;
fn f() -> void {
var x: i64 = 1;
x <<= 1;
}
t27c gen-c fails with: parse error in fn 'f' near line 5: Unexpected token in expression: Equals ('=') at line 5:9. The same text is recorded for bootstrap/tests/fixtures/core_selfhost/refuse/e2_shift_left_assign.t27 in tools/specs_generate_baseline.txt.
Done when
The lexer reads <<= and >>= as single tokens and the four backends lower them like the other compound assignments. The core then moves e2_shift_left_assign from refuse/ to accept/, and the line in the specs-generate baseline is removed.
User Scenarios
Given a T27 source file containing x <<= 1; or x >>= 1;, when t27c gen-c compiles it, then the compilation succeeds (exit 0) and the emitted C code performs the shift compound assignment.
Given the fixture bootstrap/tests/fixtures/core_selfhost/refuse/e2_shift_left_assign.t27, when the core test suite runs, then the test moves from refuse/ to accept/ and passes.
Requirements
FR-001: The lexer specification MUST recognize <<= and >>= as single ShiftLeftAssign and ShiftRightAssign tokens (not as ShiftLeft + Equals / ShiftRight + Equals).
FR-002: All four backends (gen-c, gen-rust, gen-wasm, gen-js) MUST lower ShiftLeftAssign and ShiftRightAssign identically to the existing compound-assignment operators.
FR-003: The test fixture bootstrap/tests/fixtures/core_selfhost/refuse/e2_shift_left_assign.t27 MUST be moved to bootstrap/tests/fixtures/core_selfhost/accept/ and pass.
FR-004: The line referencing e2_shift_left_assign.t27 in tools/specs_generate_baseline.txt MUST be removed.
Activity
t27core: use between modules, byte-identical to gen-c's splice (Closes …