Files
hakorune/tests/development/test_invalid_override.nyash

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("このメッセージが表示されたらテスト失敗")