Skip to content

Qualified name param tag error#29352

Merged
gabritto merged 7 commits into
masterfrom
qualified-name-param-tag-error
Jan 14, 2019
Merged

Qualified name param tag error#29352
gabritto merged 7 commits into
masterfrom
qualified-name-param-tag-error

Conversation

@gabritto
Copy link
Copy Markdown
Member

Fixes #27010 by displaying a better error message.
The following code

/**
 * @param {number} xyz.p
 */
function g(xyz) {
    return xyz.p;
}

generates the following error message:
Qualified name 'xyz.p' is not allowed without a leading '@param {object} xyz'.

@gabritto gabritto requested review from a user and sandersn January 10, 2019 22:15

==== tests/cases/conformance/jsdoc/paramTagNestedWithoutTopLevelObject.js (1 errors) ====
/**
* @param {number} xyz.p
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

can you also add test case for xyz.bar.p when there is

  • xyz.bar but no xyz
  • xyz but no xyz.bar
  • no xyz or xyz.bar

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Added them.

@sandersn sandersn self-assigned this Jan 10, 2019
@sandersn sandersn removed the request for review from a user January 10, 2019 22:54
Copy link
Copy Markdown
Member

@sandersn sandersn left a comment

Choose a reason for hiding this comment

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

Looks good but missing baselines for tests 2 and 3.

@@ -0,0 +1,12 @@
// @noEmit: true
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

looks like 2 and 3 are missing their baselines

@@ -0,0 +1,12 @@
tests/cases/conformance/jsdoc/paramTagNestedWithoutTopLevelObject4.js(2,20): error TS8032: Qualified name 'xyz.bar.p' is not allowed without a leading '@param {object} xyz.bar'.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I like this error because, although it's not correct, (1) pasting in the suggested line leads to another error with the correct fix and (2) I can't think of a good way to word the fact that you actually need two more lines.

@gabritto gabritto merged commit e5708e1 into master Jan 14, 2019
@gabritto gabritto deleted the qualified-name-param-tag-error branch January 15, 2019 23:51
@microsoft microsoft locked as resolved and limited conversation to collaborators Oct 21, 2025
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants