-
-
Notifications
You must be signed in to change notification settings - Fork 144
refactor(parser): emit temporal delayed triggers as native ir #6807
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Closed
Closed
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
9ca1916
refactor(parser): emit temporal delayed triggers as native ir
matthewevans 4c46fcf
test(parser): cover whenever temporal trigger ir
matthewevans e1c6890
test(parser): cover copy-next temporal ir helper
matthewevans 6117828
test(parser): isolate copy-next temporal helper clause
matthewevans File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
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
154 changes: 154 additions & 0 deletions
154
...arser__oracle_ir__snapshot_tests__temporal_delayed_trigger@full_throttle_temporal_ir.snap
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,154 @@ | ||
| --- | ||
| source: crates/engine/src/parser/oracle_ir/snapshot_tests.rs | ||
| expression: "&ir" | ||
| --- | ||
| { | ||
| "items": [ | ||
| { | ||
| "id": 0, | ||
| "source": { | ||
| "id": { | ||
| "item": 0, | ||
| "ordinal": 0 | ||
| }, | ||
| "span": { | ||
| "first_line": 0, | ||
| "last_line": 0, | ||
| "start_byte": 0, | ||
| "end_byte": 87, | ||
| "precision": "Exact", | ||
| "ordinal_within_span": 0 | ||
| }, | ||
| "fragment": "At the beginning of each combat this turn, untap all creatures that attacked this turn." | ||
| }, | ||
| "node": { | ||
| "Spell": { | ||
| "source_text": "At the beginning of each combat this turn, untap all creatures that attacked this turn.", | ||
| "body": { | ||
| "clauses": [ | ||
| { | ||
| "id": 0, | ||
| "source": { | ||
| "id": { | ||
| "item": 0, | ||
| "ordinal": 1 | ||
| }, | ||
| "span": { | ||
| "first_line": 0, | ||
| "last_line": 0, | ||
| "start_byte": 0, | ||
| "end_byte": 87, | ||
| "precision": "ChainRelative", | ||
| "ordinal_within_span": 0 | ||
| }, | ||
| "fragment": "At the beginning of each combat this turn, untap all creatures that attacked this turn." | ||
| }, | ||
| "disposition": { | ||
| "Emit": { | ||
| "followup": null, | ||
| "intrinsic": null | ||
| } | ||
| }, | ||
| "parsed": { | ||
| "effect": { | ||
| "type": "CreateDelayedTrigger", | ||
| "condition": { | ||
| "type": "WheneverEvent", | ||
| "trigger": { | ||
| "mode": "Phase", | ||
| "execute": null, | ||
| "valid_card": null, | ||
| "origin": null, | ||
| "destination": null, | ||
| "trigger_zones": [ | ||
| "Battlefield" | ||
| ], | ||
| "phase": "BeginCombat", | ||
| "optional": false, | ||
| "damage_kind": "Any", | ||
| "secondary": false, | ||
| "valid_target": null, | ||
| "valid_source": null, | ||
| "description": null, | ||
| "constraint": null, | ||
| "condition": null, | ||
| "batched": false | ||
| } | ||
| }, | ||
| "effect": { | ||
| "kind": "Spell", | ||
| "effect": { | ||
| "type": "SetTapState", | ||
| "target": { | ||
| "type": "Typed", | ||
| "type_filters": [ | ||
| "Creature" | ||
| ], | ||
| "controller": null, | ||
| "properties": [ | ||
| { | ||
| "type": "AttackedThisTurn" | ||
| } | ||
| ] | ||
| }, | ||
| "scope": { | ||
| "type": "All" | ||
| }, | ||
| "state": { | ||
| "type": "Untap" | ||
| } | ||
| }, | ||
| "cost": null, | ||
| "sub_ability": null, | ||
| "duration": null, | ||
| "description": null, | ||
| "target_prompt": null, | ||
| "condition": null, | ||
| "optional_targeting": false, | ||
| "optional": false, | ||
| "forward_result": false | ||
| }, | ||
| "uses_tracked_set": false | ||
| }, | ||
| "duration": null, | ||
| "sub_ability": null, | ||
| "distribute": null, | ||
| "multi_target": null, | ||
| "condition": null, | ||
| "optional": false, | ||
| "unless_pay": null | ||
| }, | ||
| "boundary": null, | ||
| "condition": null, | ||
| "is_optional": false, | ||
| "opponent_may_scope": null, | ||
| "repeat_for": null, | ||
| "player_scope": null, | ||
| "starting_with": null, | ||
| "delayed_condition": null, | ||
| "prefix_delayed_condition": null, | ||
| "multi_target": null, | ||
| "where_x_expression": null, | ||
| "unless_pay": null | ||
| } | ||
| ], | ||
| "kind": "Spell", | ||
| "continuation_kind": null, | ||
| "player_scope_rewrite": "Apply", | ||
| "chain_rounding": null, | ||
| "actor": null, | ||
| "in_trigger": false, | ||
| "repeat_until": null | ||
| }, | ||
| "shell": { | ||
| "sub_link": null | ||
| }, | ||
| "die_results": [], | ||
| "root_transforms": [] | ||
| } | ||
| } | ||
| } | ||
| ], | ||
| "source_text": "At the beginning of each combat this turn, untap all creatures that attacked this turn.", | ||
| "card_name": "Full Throttle" | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Verify the fourth recognizer arm semantically.
The
Glimpse of Naturecase usesNonefor snapshots and therefore only reaches the genericCreateDelayedTriggershape checks. A regression in its condition, draw payload, lowering, or arm dispatch could still pass. Add a two-layer snapshot pair or assert the expected condition and payload explicitly.As per path instructions, test the reusable parser building block across its parameter range rather than leaving one recognizer arm with only a generic wrapper check.
🤖 Prompt for AI Agents
Source: Path instructions