Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update error message for reserved self function argument #1737

Open
wants to merge 8 commits into
base: main
Choose a base branch
from

Conversation

Gusarich
Copy link
Member

@Gusarich Gusarich commented Feb 7, 2025

Issue

Closes #1735.

Checklist

  • I have updated CHANGELOG.md
  • I have added tests to demonstrate the contribution is correctly implemented: this usually includes both positive and negative tests, showing the happy path(s) and featuring intentionally broken cases
  • I have run all the tests locally and no test failure was reported
  • I have run the linter, formatter and spellchecker
  • I did not do unrelated and/or undiscussed refactorings

@Gusarich Gusarich added this to the v1.6.0 milestone Feb 7, 2025
@Gusarich Gusarich requested a review from a team as a code owner February 7, 2025 10:48
@Gusarich Gusarich changed the title feat: update error message feat: update error message for reserved self function argument Feb 7, 2025
i582
i582 previously approved these changes Feb 7, 2025
dev-docs/CHANGELOG.md Outdated Show resolved Hide resolved
src/types/resolveDescriptors.ts Outdated Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this will produce a confusing error message

extends fun foo(self: Int, self: String) { }

Parameter name "self" is reserved for functions with "extends" modifier

Here it is an extends function, it's just we have duplicate parameter names

Comment on lines +844 to +845
if (params.length > 0) {
const [firstParam, ...restParams] = params;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
if (params.length > 0) {
const [firstParam, ...restParams] = params;
const [head, ...restParams] = params;
if (!isUndefined(head)) { // from ../utils/array

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.

Error Parameter name "self" is reserved should suggest extends modifier for function
4 participants