Repository navigation
fix: convert Prism::ErrorRecoveryNode, which replaced MissingNode - #4
Merged
joeldrapper merged 1 commit intoOct 13, 2026
Merged
Conversation
ruby/ruby@708656c73 ("[PRISM] Replace MissingNode with ErrorRecoveryNode") removed Prism::MissingNode, and the converter referenced it at class-body time, so `require "refract"` raised NameError on ruby-head and on prism's main branch. The converter now visits whichever of the two Prism defines. Both become Refract::MissingNode: ErrorRecoveryNode only adds an optional `unexpected` child (the stray node found in place of the missing one), and like Prism's own translators the node stays a leaf, since source with a syntax error can't be emitted either way.
7 tasks done
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.
Summary
ruby/ruby@708656c73 ("[PRISM] Replace MissingNode with ErrorRecoveryNode") removed
Prism::MissingNode.Refract::Converterreferences it at class-body time (visit Prism::MissingNode), so on ruby-head, and on prism'smainbranch,require "refract"raises:That is what fails Phlex's
headCI lanes: about 87 compiler tests in yippee-fun/phlex#1055. Phlex doesn't commit its lockfile, so its CI resolves refractmainfresh, and merging this turns those lanes green with no Phlex change.The converter now visits whichever of
Prism::ErrorRecoveryNode/Prism::MissingNodeis defined. Both convert toRefract::MissingNode.ErrorRecoveryNodeadds only an optionalunexpectedchild, the stray node found where the missing one should be. Prism's own translators (parser, ruby_parser) also map it to a childless "missing" node in that commit, and refract does the same: source with a syntax error can't be emitted either way, and the original node is still kept asprism_node.No released prism has
ErrorRecoveryNodeyet (1.9.0 is the latest and still shipsMissingNode), so both branches are needed.Test plan
New tests:
"x = "converts toLocalVariableWriteNode(value: Refract::MissingNode)on both prism generations.visit_missing_node/visit_error_recovery_nodeexactly when Prism defines the matching node.Results,
qt -t 1(passed / failed):mainmain(302790a, hasErrorRecoveryNode, noMissingNode)NameError: uninitialized constant Prism::MissingNodeThe one failure everywhere is
test/refract.test.rb:1445. It compares a subprocess's output, and my machine prints Bundler "missing extensions" warnings into it, so it is local noise and identical onmain.bundle exec rubocop: only the two offensesmainalready has (formatter.rb:16,refract.gemspec:24). TheErrorRecoveryNodeblock sits in the order theRefract/OrderedVisitMethodscop expects.Note: refract's own CI is red on
mainindependently of this change. It tracks quickdraw unpinned, and quickdraw droppedqt -tand the top-leveltestDSL on 2026-01-24 (yippee-fun/quickdraw@2e72ea1, @1334398). The results above use quickdraw06615ef2554d, the last revision before those changes, via a scratch Gemfile that isn't committed here.