Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Forbid duplicate namespace/static class members#2805

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Draft
CountBleck wants to merge2 commits intoAssemblyScript:main
base:main
Choose a base branch
Loading
fromCountBleck:forbid-duplicate-members

Conversation

CountBleck
Copy link
Member

(Barely)fixes#2793.

Changes proposed in this pull request:
⯈ Check diagnostics after initialize (VERY BAD)
⯈ Forbid duplicate namespace/static class members

Requiring the compiler to check diagnostics after initialize is VERY BAD, and ideally someone should find a way to prevent the compiler from attempting to compile the duplicate global (which it shouldn't see to begin with).

  • I've read the contributing guidelines
  • I've added my name and email to the NOTICE file

This is unfortunately necessary for the next commit. This is overall badfor DX, since fewer errors are shown to the user at once.
This isn't fully TS compatible, but refactors targeting internal names,scoping, merging, etc. are needed to become more compatible. Forinstance, if namespace members had unique separators in internal names,then a non-exported namespace member would override a static classmember, assuming the names are the same.Note that this change doesn't prevent the compiler from attempting tocompile the duplicate global, and hence the previous commit is neededfor this to work fully.BarelyfixesAssemblyScript#2793.
Copy link
Member

@HerrCai0907HerrCai0907 left a comment

Choose a reason for hiding this comment

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

I wonder why do we need to split lots of test.

@CountBleck
Copy link
MemberAuthor

I wonder why do we need to split lots of test.

Yeah, checking diagnostics after initialize is VERY BAD.

@HerrCai0907
Copy link
Member

Cannot detect this case

namespace A {
export function foo(): i32 {
return 1;
}
}

class A {
static foo(): i32 {
return 2;
}
}

export function _start(): void {
trace("", 1, A.foo());
}

@CountBleckCountBleck marked this pull request as draftNovember 22, 2023 18:56
@CountBleck
Copy link
MemberAuthor

Cannot detect this case

That's not good at all.

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@HerrCai0907HerrCai0907HerrCai0907 left review comments

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

asc crash when use same name in class and namespace
2 participants
@CountBleck@HerrCai0907

[8]ページ先頭

©2009-2025 Movatter.jp