Skip to content

Raise a source error for anonymous classes - #92

Open
OskarEichler wants to merge 1 commit into
banister:masterfrom
OskarEichler:codex/anonymous-class-source-error
Open

Raise a source error for anonymous classes#92
OskarEichler wants to merge 1 commit into
banister:masterfrom
OskarEichler:codex/anonymous-class-source-error

Conversation

@OskarEichler

Copy link
Copy Markdown

Summary

Normalize anonymous class/module source lookup failures to MethodSource::SourceNotFoundError instead of leaking NameError or TypeError from constant lookup.

Context and fix

class_comment has no constant name to pass to const_source_location for anonymous owners. Detect that boundary explicitly and raise the library error used for other unavailable source locations.

Regression coverage

  • added an anonymous-class class_comment regression
  • focused and full suites pass on Ruby 4.0.6 and 3.2.11
  • final composition: 41 examples / 0 failures on both Rubies
  • syntax, diff check, exact packaging and Rails integration pass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant