fix: 型引数名の重複に関するエラーが適切に発生しない問題を修正
What
関数の型注釈の名前が重複した場合に発生するエラーをErrorからAiScriptSyntaxErrorに変更します。
また、関数の引数や返り値の型注釈がない場合であっても型引数の名前が重複した際のエラーが発生するようにします。
Why
Fixes #997 Fixes #998
Additional info (optional)
:warning: Please install the to ensure uploads and comments are reliably processed by Codecov.
Codecov Report
:white_check_mark: All modified and coverable lines are covered by tests. :exclamation: 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%> (ø) |
:rocket: New features to boost your workflow:
- :snowflake: Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
- :package: JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.
型に関するエラーは TypeSource を Type に変換する部分にもあり、そこでは AiScriptSyntaxError が使われているので、 AiScriptTypeError という名前は適切ではないように思います
https://github.com/aiscript-dev/aiscript/blob/2f103d2d639704b7012763503272ec9d2144f54b/src/type.ts#L202
TypeParam にも loc を持たせて、問題の箇所でも AiScriptSyntaxError を投げるようにするのが親切なのではないかと思います
@poppingmoon コメントありがとうございます 🙏
型に関するエラーは
TypeSourceをTypeに変換する部分にもあり、そこではAiScriptSyntaxErrorが使われているので、AiScriptTypeErrorという名前は適切ではないように思います
AiScriptSyntaxErrorに変更しました。
TypeParamにもlocを持たせて、
これはバグ修正だけでなく機能追加(APIの変更)の面もあるので次のマイナーリリースで検討したいと思います。