Repository navigation
lowering: native ladders reach async return! matches - #161
Merged
Merged
Conversation
return! (match ...) in an async block lowers through lower_async_bang_return, which built its own match and so kept every one of them in native output. It now tries the native ladder first (arm bodies returned awaited), Option and Result shapes included since that path never tries their ladder. The self tail call loop rewrite still fires on the cookbook agent. On a real 11-module program the native output now has no match statement at all, and its recorded game replays print the same in both modes.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow-up to the native series.
return! (match …)in anasync { }block lowers throughlower_async_bang_return, which builds its ownmatch(onereturn awaitper arm, so a self tail call stays visible for #119's loop rewrite). Native mode never reached it, so every such match stayed amatch.try_lower_native_matchtakes a body mode (NativeArmBody::{Return, Assign, AwaitReturn}) instead ofOption<&str>;lower_async_bang_returntries it first withAwaitReturn.Option/Resultshapes, since the async path never tries their ladder.structured_concurrency) still gets itswhile Trueloop natively, with no recursiveawaitleft.Real-program check (local only; the private dogfood game isn't touched or published): I copied the 11-module Scrabble game to a temp dir, applied the 4-line
Taskmigration from #147, and compiled it both ways. The native build now has 0matchstatements (the default has 63; 15 remained before this PR), and all 5 recorded replays (up to 2,343 lines of output) print identically.Test:
native_ladders_reach_async_return_bang_matches. DESIGN §5.6 updated.