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

Fix getTypeAtLocation for dotted implements clauses #39363

Merged
merged 2 commits into from
Jul 7, 2020

Conversation

andrewbranch
Copy link
Member

Fixes #37901

@@ -14381,11 +14381,12 @@ namespace ts {
return getTypeFromInferTypeNode(<InferTypeNode>node);
case SyntaxKind.ImportType:
return getTypeFromImportTypeNode(<ImportTypeNode>node);
// This function assumes that an identifier or qualified name is a type expression
// This function assumes that an identifier, qualified name, or proprety access expression is a type expression
Copy link
Member

Choose a reason for hiding this comment

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

Suggested change
// This function assumes that an identifier, qualified name, or proprety access expression is a type expression
// This function assumes that an identifier, qualified name, or property access expression is a type expression

@@ -77,3 +77,31 @@ describe("unittests:: Public APIs:: isPropertyName", () => {
assert.isTrue(ts.isPropertyName(prop), "PrivateIdentifier must be a valid property name.");
});
});

describe("unittests:: Public APIs:: getTypeAtLocation", () => {
it("works on PropertyAccessExpression in implements clause", () => {
Copy link
Member

Choose a reason for hiding this comment

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

would this be easier as a fourslash test? I mean, the answer is probably No, but I thought that quickinfo used getTypeAtLocation.

Copy link
Member Author

Choose a reason for hiding this comment

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

Mmmmmaaybe? I didn’t think about quick info. I had hoped that the type baseliner would do the job, but it didn’t drill all the way down to the problematic node. Quick info also seems susceptible to future changes in which nodes it calls getTypeAtLocation on, even if it works now. I do wish it was easier to set up this kind of test.

@andrewbranch andrewbranch merged commit 2d6d5db into microsoft:master Jul 7, 2020
@andrewbranch andrewbranch deleted the bug/37901 branch July 7, 2020 23:17
cangSDARM added a commit to cangSDARM/TypeScript that referenced this pull request Jul 9, 2020
* upstream/master: (75 commits)
  Insert auto-imports in sorted order (microsoft#39394)
  LEGO: check in for master to temporary branch.
  Better checking of @param/@Property tags (microsoft#39487)
  fix(25155): add space before optional parameters/properties (microsoft#38798)
  Add regression test for microsoft#38834 (microsoft#39479)
  Fixes searches for symbols exported using export * as (microsoft#39507)
  fix(39421): omit prefix text for rest binding element (microsoft#39433)
  fix(39440): show QF for abstract classes with methods which include 'this' parameter (microsoft#39465)
  Remove unnecessary assert (microsoft#39483)
  LEGO: check in for master to temporary branch.
  Update user baselines (microsoft#39220)
  Type `this` in more constructor functions (microsoft#39447)
  LEGO: check in for master to temporary branch.
  LEGO: check in for master to temporary branch.
  Properly handle rest parameters in function declarations with @type annotations (microsoft#39473)
  Ensure type/namespaceish statics are included in the list of namespace merge members (microsoft#38920)
  Fix getTypeAtLocation for dotted implements clauses (microsoft#39363)
  Add workflow_dispatch to our nightly publish script. (microsoft#39485)
  Fix crash in decorator metadata calculation when serializing template literal type nodes (microsoft#39481)
  Fix test semantic merge conflict between microsoft#39348 and microsoft#39130 (microsoft#39478)
  ...

# Conflicts:
#	src/compiler/scanner.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

getTypeAtLocation fails on a PropertyAccessExpression in a type position
4 participants