Files
hakorune/test_invalid_override.nyash
Moe Charm 20c95dd997 🧪 test: デリゲーションメソッドチェック機能テスト追加
- test_override_validation.nyash: 正常なovveride検証テスト
- test_invalid_override.nyash: 無効なoverride検出テスト

 動作確認済み:
- 正常なoverride: speak/moveメソッドは問題なく動作
- 無効なoverride: nonExistentMethodで適切にエラー検出
- パース時点での早期エラー検出により安全性向上

🔍 DEBUG: Found override method 'nonExistentMethod' in 'BadDog' extending 'Animal'
 Parse error: Unexpected token OVERRIDE, expected 🚨 OVERRIDE ERROR

次のフェーズ: 実際の親Boxメソッド参照システム実装

🤖 Generated with [Claude Code](https://claude.ai/code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-08-11 10:18:01 +09:00

32 lines
801 B
Plaintext
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

// 🚨 無効なoverride検証テスト - エラーが発生すべき
// 親Box
box Animal {
init { name }
pack(animalName) {
me.name = animalName
}
speak() {
return me.name + " makes a sound"
}
}
// 子Box - 存在しないメソッドをoverrideエラーになるはず
box BadDog from Animal {
init { breed }
pack(dogName, dogBreed) {
from Animal.pack(dogName)
me.breed = dogBreed
}
// 🚨 これはエラーになるはず - nonExistentMethodは危険パターンに含まれている
override nonExistentMethod() {
return "This should fail"
}
}
// このファイルはパースエラーで実行されないはず
print("このメッセージが表示されたらテスト失敗")