Skip to content

Conversation

@takejohn
Copy link
Member

@takejohn takejohn commented Dec 5, 2025

What

関数の型注釈の名前が重複した場合に発生するエラーをErrorからAiScriptSyntaxErrorに変更します。
また、関数の引数や返り値の型注釈がない場合であっても型引数の名前が重複した際のエラーが発生するようにします。

Why

Fixes #997
Fixes #998

Additional info (optional)

@codecov-commenter
Copy link

codecov-commenter commented Dec 5, 2025

⚠️ Please install the 'codecov app svg image' to ensure uploads and comments are reliably processed by Codecov.

Codecov Report

✅ All modified and coverable lines are covered by tests.
❗ Your organization needs to install the Codecov GitHub app to enable full functionality.

Files with missing lines Coverage Δ
src/parser/plugins/validate-type.ts 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@poppingmoon
Copy link
Contributor

型に関するエラーは TypeSourceType に変換する部分にもあり、そこでは AiScriptSyntaxError が使われているので、 AiScriptTypeError という名前は適切ではないように思います

throw new AiScriptSyntaxError(`Unknown type: '${getTypeNameBySource(typeSource)}'`, typeSource.loc.start);

TypeParam にも loc を持たせて、問題の箇所でも AiScriptSyntaxError を投げるようにするのが親切なのではないかと思います

@takejohn
Copy link
Member Author

takejohn commented Dec 5, 2025

@poppingmoon コメントありがとうございます 🙏

型に関するエラーは TypeSourceType に変換する部分にもあり、そこでは AiScriptSyntaxError が使われているので、 AiScriptTypeError という名前は適切ではないように思います

AiScriptSyntaxErrorに変更しました。

TypeParam にも loc を持たせて、

これはバグ修正だけでなく機能追加(APIの変更)の面もあるので次のマイナーリリースで検討したいと思います。

@takejohn takejohn merged commit a3bc04a into aiscript-dev:bugfix/1.2.1 Dec 11, 2025
4 checks passed
@takejohn takejohn mentioned this pull request Dec 11, 2025
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.

4 participants