Fixed na issue with evaluator using binding element initializers as const values#55910
Conversation
src/compiler/checker.ts
Outdated
| if (isConstantVariable(symbol)) { | ||
| const declaration = symbol.valueDeclaration as VariableDeclaration | undefined; | ||
| if (declaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) { | ||
| if (declaration?.kind === SyntaxKind.VariableDeclaration && !declaration.type && declaration.initializer && (!location || declaration !== location && isBlockScopedNameDeclaredBeforeUse(declaration, location))) { |
There was a problem hiding this comment.
alternatively, I could check if the parent is not a BindingElement
There was a problem hiding this comment.
Would that break on parameters? I guess not, since isConstantVariable won't be true.
There was a problem hiding this comment.
I'll also note that this feels weird because declaration is VariableDeclaration which must have kind === SyntaxKind.VariableDeclaration.
There was a problem hiding this comment.
I'll also note that this feels weird because declaration is VariableDeclaration which must have kind === SyntaxKind.VariableDeclaration.
Good catch! I didn't notice it. It is VariableDeclaration just because of the cast - so I'll make that cast more accurate in a second :)
|
@typescript-bot test top100 |
|
Heya @jakebailey, I've started to run the diff-based user code test suite on this PR at 8cd9111. You can monitor the build here. Update: The results are in! |
|
Heya @jakebailey, I've started to run the regular perf test suite on this PR at 8cd9111. You can monitor the build here. Update: The results are in! |
|
Heya @jakebailey, I've started to run the diff-based top-repos suite on this PR at 8cd9111. You can monitor the build here. Update: The results are in! |
|
Heya @jakebailey, I've started to run the parallelized Definitely Typed test suite on this PR at 8cd9111. You can monitor the build here. Update: The results are in! |
|
@jakebailey Here are the results of running the user test suite comparing There were infrastructure failures potentially unrelated to your change:
Otherwise... Everything looks good! |
|
@jakebailey Here they are:
CompilerComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
tsserverComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
StartupComparison Report - baseline..pr
System info unknown
Hosts
Scenarios
Developer Information: |
|||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||||
|
@jakebailey Here are the results of running the top-repos suite comparing Everything looks good! |
|
Hey @jakebailey, the results of running the DT tests are ready. |
fixes #55907