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 · 2 comments
Open

No SymbolId for declare class C {} #7278

overlookmotel opened this issue Nov 14, 2024 · 2 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
@Boshen
Copy link
Member

Boshen commented Nov 28, 2024

I couldn't figure out where in binder.ts permits

declare class F {}
function F() {}

but not

class F {}
function F() {}

I need to debug binder.ts :-/

@Dunqing
Copy link
Member

Dunqing commented Dec 5, 2024

We need this to remove declare binding from export {}. See rolldown/rolldown#3048 (comment)

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