Skip to content

JS: Use local name resolution in TypeAnnotation.hasQualifiedName#3873

Merged
codeql-ci merged 6 commits into
github:mainfrom
asger-semmle:js/type-qualified-name-fallback
Sep 7, 2020
Merged

JS: Use local name resolution in TypeAnnotation.hasQualifiedName#3873
codeql-ci merged 6 commits into
github:mainfrom
asger-semmle:js/type-qualified-name-fallback

Conversation

@asgerf
Copy link
Copy Markdown
Contributor

@asgerf asgerf commented Jul 2, 2020

Recognizing type annotations by name can be a bit painful in cases where the type system fails to resolve it for some reason (mainly missing dependencies).

This makes TypeAnnotation.hasQualifiedName include names found through local name resolution, in addition to consulting the type system.

There are not many cases where we get results from both the type system and from local resolution, but there is an example in kibana. Here it happens because the file is part of a package (kibana is a monorepo), so we get both the snapshot-relative path and the package-relative path, which I think is fine, as hasQualifiedName does not imply uniqueness.

@asgerf asgerf added JS Awaiting evaluation Do not merge yet, this PR is waiting for an evaluation to finish labels Jul 2, 2020
@asgerf asgerf requested a review from a team as a code owner July 2, 2020 12:17
Copy link
Copy Markdown
Contributor

@erik-krogh erik-krogh left a comment

Choose a reason for hiding this comment

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

LGTM.

You just have to update the expected files of a test.

@asgerf asgerf force-pushed the js/type-qualified-name-fallback branch from 15c4ed2 to 7a8b54b Compare July 30, 2020 11:21
erik-krogh
erik-krogh previously approved these changes Aug 3, 2020
@asgerf
Copy link
Copy Markdown
Contributor Author

asgerf commented Aug 7, 2020

Smoke-test evaluation (internal link) looks fine.

I'm considering rebasing on the RC branch, but will wait for next week.

@asgerf asgerf removed the Awaiting evaluation Do not merge yet, this PR is waiting for an evaluation to finish label Aug 7, 2020
@adityasharad adityasharad changed the base branch from master to main August 14, 2020 18:33
@asgerf asgerf force-pushed the js/type-qualified-name-fallback branch 2 times, most recently from 8099c88 to c05f5c1 Compare September 3, 2020 13:03
Comment thread javascript/ql/src/semmle/javascript/TypeScript.qll Outdated
Co-authored-by: Erik Krogh Kristensen <erik-krogh@github.com>
erik-krogh
erik-krogh previously approved these changes Sep 4, 2020
@codeql-ci codeql-ci merged commit b5872fe into github:main Sep 7, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants