Repository navigation
chore: pin Mago at #118, where a Set's changing methods need a place - #101
Merged
Merged
Conversation
Problem: mago-sharp #118 (90e8d64) makes a PHP# Set's add, remove and clear need a place to write back to, as a List's and a Map's changing methods do. The fixture Zend/tests/sharp/Sets.sharp called this.copy().add("copy") on a method's result, so mago compile at #118 refuses Sets.sharp, and the engine runs only compiled files. Solution: - SHARP_MAGO_COMMIT in ext/sharp/sharp_unit.h moves to 90e8d64. The header the bridge generates at that tree differs from this one only in that line. - Sets.sharp stores the copy in a local, let copy = this.copy();, and calls copy.add("copy") on it, so copied still holds add's result and the set tests print the same output. Its PHP twin Sets.inc changes the same way, line for line, so opcodes.phpt still finds the same opcodes and lines. ext/sharp/sharp_unit.h <- SHARP_MAGO_COMMIT 90e8d64 Zend/tests/sharp/ ├── Sets.sharp <- the copy changed through a local └── Sets.inc <- its PHP twin, line for line
heyJordanParker
added a commit
that referenced
this pull request
Oct 11, 2026
Problem - master took #101, which pins Mago at #118 (90e8d64) and rewrites Sets.sharp:75 and Sets.inc:75 so a Set's changing method has a place. - This branch pinned #129's head (bce91aa). Both sides changed the pin line. #129 merged as 82593a4, which did not compile, and mago-sharp #153 fixed it as 625c278. Solution - Take master's Sets.sharp and Sets.inc as they are. - SHARP_MAGO_COMMIT pins 625c278, the merge of #153, which carries both #118 and #129. The bridge sources the header is generated from are unchanged since bce91aa, so the pin is the only line the generated header changes. Zend/tests/sharp/ Sets.sharp, Sets.inc from master: the copied Set is held in a local before add ext/sharp/ sharp_unit.h conflict: SHARP_MAGO_COMMIT is 625c278, the merge of mago-sharp #153
heyJordanParker
added a commit
that referenced
this pull request
Oct 11, 2026
… to Mago fe442e9 Problem: Master gained #101, which pins Mago 90e8d64 and rewrites `Sets.sharp:75` so a `Set` that `copy()` returns is added to through a local. This branch had made the same fix on one line, so `Sets.sharp`, `Sets.inc` and the pin in `ext/sharp/sharp_unit.h` conflicted. The generics Mago branch now also holds Mago #129, which refuses an `int` raised to a negative power the checker knows. Its flow typing knows `let b = -1;`, so it refuses `Overflow.constantNegativePower` and `Overflow.zeroNegativePower`, the two fixtures that test the engine's `ArithmeticError` when opcache propagates a negative exponent. Every pin that holds #129 refuses them, on master too. Solution: - `Sets.sharp` and `Sets.inc` take master's two-line fix, which owns it. - `ext/sharp/sharp_unit.h` is the header Mago fe442e9 generates. - `Overflow.sharp` declares each exponent `int b = -1;` and `int n = -1;`. The checker then knows only `int`, and opcache still propagates the constant: the optimized `Overflow::constantNegativePower` is `T0 = POW int(2) int(-1)`, which throws. Each line keeps its line number. `sharp/bin/test --passes Zend/tests/sharp/overflow_pow.phpt` passes under every optimizer pass alone and both JITs. Zend/tests/sharp/ ├── Sets.sharp, Sets.inc <- conflict: master's fix └── Overflow.sharp <- the two negative exponents are typed int locals ext/sharp/sharp_unit.h <- conflict: pinned to Mago fe442e9
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.
Problem
mago-sharp #118 (merged as 90e8d64) makes a PHP#
Set'sadd,removeandclearneed a place to write back to, as aList's and aMap's changing methods do.Zend/tests/sharp/Sets.sharpline 75 calledthis.copy().add("copy")on a method's result, somago compileat #118 refusesSets.sharp, and the engine runs only compiled files.Solution
SHARP_MAGO_COMMITinext/sharp/sharp_unit.hmoves to 90e8d64.Sets.sharpstores the copy in a local and changes it there:copiedstill holdsadd's result, so the threeset_methods*.phpttests print the same output. Its PHP twinSets.incchanges the same way, line for line, soopcodes.phptstill finds the same opcodes and lines. The.phptfiles cite only lines 18 and 43, which do not move.Verification
mago-sharp-bridgegenerates from 90e8d64's tree differs fromext/sharp/sharp_unit.honly inSHARP_MAGO_COMMIT.php -n --ri sharpprintsMago commit => 90e8d64ee4f056e3acb7d2d252062627aa223eb0.sharp/bin/test --opcache --repeat --passeson the threeset_methods*.phptfiles andopcodes.phptpasses 4 of 4 in all 22 modes.mago compileat the pin compiles 99 fixtures and refuses none.sharp/bin/testpasses 171 of 171.