Skip to content

Allow question token as start of type #17994

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

Merged
merged 2 commits into from
Aug 23, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/compiler/parser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2721,6 +2721,7 @@ namespace ts {
case SyntaxKind.FalseKeyword:
case SyntaxKind.ObjectKeyword:
case SyntaxKind.AsteriskToken:
case SyntaxKind.QuestionToken:
return true;
case SyntaxKind.MinusToken:
return lookAhead(nextTokenIsNumericLiteral);
Expand Down
21 changes: 0 additions & 21 deletions tests/baselines/reference/checkJsdocTypeTag3.errors.txt

This file was deleted.

24 changes: 0 additions & 24 deletions tests/baselines/reference/checkJsdocTypeTag3.js

This file was deleted.

5 changes: 5 additions & 0 deletions tests/baselines/reference/checkJsdocTypeTag3.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
=== tests/cases/conformance/jsdoc/test.js ===
/** @type {Array<?number>} */
var nns;
>nns : Symbol(nns, Decl(test.js, 1, 3))

5 changes: 5 additions & 0 deletions tests/baselines/reference/checkJsdocTypeTag3.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
=== tests/cases/conformance/jsdoc/test.js ===
/** @type {Array<?number>} */
var nns;
>nns : number[]

Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,6 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(169,20): e
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(169,23): error TS1003: Identifier expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(169,27): error TS1005: ',' expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(170,23): error TS1005: ',' expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(170,24): error TS1138: Parameter declaration expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,28): error TS1003: Identifier expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(171,32): error TS1005: ',' expected.
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(172,30): error TS1005: ',' expected.
Expand All @@ -94,7 +93,7 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(175,32): e
tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(175,35): error TS2304: Cannot find name 'm'.


==== tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts (60 errors) ====
==== tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts (59 errors) ====
class C {
n: number;
explicitThis(this: this, m: number): number {
Expand Down Expand Up @@ -403,8 +402,6 @@ tests/cases/conformance/types/thisType/thisTypeInFunctionsNegative.ts(175,35): e
function optional(this?: C): number { return this.n; }
~
!!! error TS1005: ',' expected.
~
!!! error TS1138: Parameter declaration expected.
function decorated(@deco() this: C): number { return this.n; }
~~~~
!!! error TS1003: Identifier expected.
Expand Down
2 changes: 1 addition & 1 deletion tests/baselines/reference/thisTypeInFunctionsNegative.js
Original file line number Diff line number Diff line change
Expand Up @@ -345,7 +345,7 @@ function modifiers(, C) {
return this.n;
}
function restParam(C) { return this.n; }
function optional(C) { return this.n; }
function optional() { return this.n; }
function decorated(, C) {
if ( === void 0) { = this; }
return this.n;
Expand Down
6 changes: 6 additions & 0 deletions tests/cases/conformance/jsdoc/checkJsdocTypeTag3.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @Filename:test.js
// @checkJs: true
// @allowJs: true
// @noEmit: true
/** @type {Array<?number>} */
var nns;