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

No SymbolId for declare class C {} #7278

Open
overlookmotel opened this issue Nov 14, 2024 · 0 comments
Open

No SymbolId for declare class C {} #7278

overlookmotel opened this issue Nov 14, 2024 · 0 comments
Assignees
Labels
A-semantic Area - Semantic C-bug Category - Bug

Comments

@overlookmotel
Copy link
Contributor

overlookmotel commented Nov 14, 2024

Semantic does not produce a SymbolId for C in declare class C {}.

I believe it should - all BindingIdentifiers should have a SymbolId, and we do produce SymbolIds for other TS-only identifiers e.g. type N = number;.

In this example, only A gets assigned a SymbolId:

class A {}
declare class B {}
export declare class C {}

Playground

Relevant code:

fn bind(&self, builder: &mut SemanticBuilder) {
if !self.declare {
let Some(ident) = &self.id else { return };
let symbol_id = builder.declare_symbol(
ident.span,
&ident.name,
SymbolFlags::Class,
if self.is_declaration() {
SymbolFlags::ClassExcludes
} else {
SymbolFlags::empty()
},
);
ident.symbol_id.set(Some(symbol_id));
}
}

@overlookmotel overlookmotel added C-bug Category - Bug A-semantic Area - Semantic labels Nov 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-semantic Area - Semantic C-bug Category - Bug
Projects
None yet
Development

No branches or pull requests

3 participants