Merged
Conversation
子クラスで定義されているクラス変数を親クラスで再定義した場合に、子クラスがそのクラス変数を参照すると例外が発生するように変更された。 上記の挙動の変更により、クラス変数の説明文と実際の挙動に差異があったため、サンプルコードと説明文を更新した。 ref: 上記の挙動変更のチケット https://bugs.ruby-lang.org/issues/14541
znz
reviewed
Sep 21, 2021
| end | ||
|
|
||
| class Bar | ||
| p @@v #=> RuntimeError になります。 |
Member
There was a problem hiding this comment.
他のところの実行例のように、具体的な例外のメッセージも入っていると良さそうです。
Author
rurema#2581 (comment) のコメントを受けて、具体的なエラーメッセージを記述するようにした。
znz
approved these changes
Oct 31, 2021
Member
|
ありがとうございます。 |
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.
PR の概要
3.0.0にて、子クラスで定義されているクラス変数を親クラスで再定義した場合に、子クラスがそのクラス変数を参照すると例外が発生するように変更されました。
下記のスクリーンショットの「修正前」にあるように、上記の挙動について言及されていなかったため、説明文とサンプルコードを更新しました。
(加えて、不要な空白を削除しました)
スクリーンショット
修正前
修正後
参考
手元でリファレンスマニュアルに記載されているサンプルコードを実行した時のログ
環境: Ruby 3.0.0