fix(emit): replace silent emission failures with structured diagnostics - #10
Merged
Conversation
- Replace ir.Print's silent "/* unknown expr */" fallback, emit/internal's zero-value Resolver guards, and emitStmt's missing default case with structured panics (SEL4001–SEL4003) that prevent compiles reporting success while emitting wrong or empty shaders - Add internal.Recover and RecoverSplit wrappers around each backend Emit entry point so panicked *ir.EmitError values surface as normal Go error returns instead of crashing the process - Wire ir.EmitError into diagnostics.go compileError so emission failures get the same Code/Message/Hint shape as parse and lower diagnostics, with hints for the SEL4001–SEL4003 bug-report codes - Promote lower/interfaceNames collision from a bare fmt.Errorf to a structured SEL1006 diagnostic so compileError can wrap it into *CompileError for end-to-end error reporting
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
Converts backend emission failures from silent placeholders and unrecovered panics into structured ir.EmitError diagnostics. Wraps all backend Emit functions with a recovery mechanism to surface these as normal Go errors, and ensures they are correctly mapped to CompileError with SEL codes, messages, and hints.
Changes
Testing
go test ./...to verify new emission error paths and structured diagnostic mapping