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

Add baseline file based Symbol tester #7428

Open
ShuiRuTian opened this issue Nov 22, 2024 · 0 comments
Open

Add baseline file based Symbol tester #7428

ShuiRuTian opened this issue Nov 22, 2024 · 0 comments
Labels
C-enhancement Category - New feature or request

Comments

@ShuiRuTian
Copy link
Contributor

There is already a symbol_tester.rs, however, I think there are some flaws:

  1. it could not distinguish different symbol with same name.
function foo(){
const foo = 123;
}

For this example, I think there is no way to assert that there are 2 symbols called "foo" and assert the status of inner "foo" symbol

  1. it checkes implementation details. This might be good for some situations, but always arguable
  2. Not pretty easy to use.

So, I suggest to add another tester, which refer typescript's design:
For one input file, typescirpt will generate 4 output file

  • js
  • type
  • symbols
  • errors.txt

I believe there is already a js files output tester. So it's kind of natural to have another one for symbol.

In the symbol baseline file, for each appeared identifier, it's needed to record its the symbol, which could be done thorugh the span of declaration symbol.

this is an example from typescript repo:

function foo(foo: number, y: number, ...z: string[]) {
>foo : Symbol(foo, Decl(callWithSpread.ts, 2, 1))
>foo : Symbol(foo, Decl(callWithSpread.ts, 4, 13))
>y : Symbol(y, Decl(callWithSpread.ts, 4, 25))
>z : Symbol(z, Decl(callWithSpread.ts, 4, 36))

    foo
>foo : Symbol(foo, Decl(callWithSpread.ts, 4, 13))
}

@ShuiRuTian ShuiRuTian added the C-enhancement Category - New feature or request label Nov 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-enhancement Category - New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant