Skip to content

Commit da5285e

Browse files
committed
Update baselines
1 parent d24b3a3 commit da5285e

15 files changed

Lines changed: 170 additions & 158 deletions

src/harness/unittests/jsDocParsing.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ namespace ts {
4444
parsesCorrectly("functionType1", "{function()}");
4545
parsesCorrectly("functionType2", "{function(string, boolean)}");
4646
parsesCorrectly("functionReturnType1", "{function(string, boolean)}");
47-
parsesCorrectly("thisType1", "{this:a.b}");
48-
parsesCorrectly("newType1", "{new:a.b}");
47+
parsesCorrectly("thisType1", "{function(this:a.b)}");
48+
parsesCorrectly("newType1", "{function(new:a.b)}");
4949
parsesCorrectly("variadicType", "{...number}");
5050
parsesCorrectly("optionalType", "{number=}");
5151
parsesCorrectly("optionalNullable", "{?=}");
@@ -64,7 +64,7 @@ namespace ts {
6464
parsesCorrectly("tupleType3", "{[number,string,boolean]}");
6565
parsesCorrectly("tupleTypeWithTrailingComma", "{[number,]}");
6666
parsesCorrectly("typeOfType", "{typeof M}");
67-
parsesCorrectly("tsConstructoType", "{new () => string}");
67+
parsesCorrectly("tsConstructorType", "{new () => string}");
6868
parsesCorrectly("tsFunctionType", "{() => string}");
6969
parsesCorrectly("typeArgumentsNotFollowingDot", "{a<>}");
7070
parsesCorrectly("functionTypeWithTrailingComma", "{function(a,)}");
Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,51 @@
11
{
2-
"kind": "JSDocConstructorType",
3-
"pos": 4,
4-
"end": 8,
2+
"kind": "JSDocFunctionType",
3+
"pos": 1,
4+
"end": 18,
55
"flags": "JSDoc",
6-
"type": {
7-
"kind": "TypeReference",
8-
"pos": 5,
9-
"end": 8,
10-
"flags": "JSDoc",
11-
"typeName": {
12-
"kind": "FirstNode",
13-
"pos": 5,
14-
"end": 8,
6+
"parameters": {
7+
"0": {
8+
"kind": "Parameter",
9+
"pos": 10,
10+
"end": 17,
1511
"flags": "JSDoc",
16-
"left": {
12+
"name": {
1713
"kind": "Identifier",
18-
"pos": 5,
19-
"end": 6,
14+
"pos": 10,
15+
"end": 13,
2016
"flags": "JSDoc",
21-
"text": "a"
17+
"originalKeywordKind": "NewKeyword",
18+
"text": "new"
2219
},
23-
"right": {
24-
"kind": "Identifier",
25-
"pos": 7,
26-
"end": 8,
20+
"type": {
21+
"kind": "TypeReference",
22+
"pos": 14,
23+
"end": 17,
2724
"flags": "JSDoc",
28-
"text": "b"
25+
"typeName": {
26+
"kind": "FirstNode",
27+
"pos": 14,
28+
"end": 17,
29+
"flags": "JSDoc",
30+
"left": {
31+
"kind": "Identifier",
32+
"pos": 14,
33+
"end": 15,
34+
"flags": "JSDoc",
35+
"text": "a"
36+
},
37+
"right": {
38+
"kind": "Identifier",
39+
"pos": 16,
40+
"end": 17,
41+
"flags": "JSDoc",
42+
"text": "b"
43+
}
44+
}
2945
}
30-
}
46+
},
47+
"length": 1,
48+
"pos": 10,
49+
"end": 17
3150
}
3251
}
Lines changed: 41 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,51 @@
11
{
2-
"kind": "JSDocThisType",
3-
"pos": 5,
4-
"end": 9,
2+
"kind": "JSDocFunctionType",
3+
"pos": 1,
4+
"end": 19,
55
"flags": "JSDoc",
6-
"type": {
7-
"kind": "TypeReference",
8-
"pos": 6,
9-
"end": 9,
10-
"flags": "JSDoc",
11-
"typeName": {
12-
"kind": "FirstNode",
13-
"pos": 6,
14-
"end": 9,
6+
"parameters": {
7+
"0": {
8+
"kind": "Parameter",
9+
"pos": 10,
10+
"end": 18,
1511
"flags": "JSDoc",
16-
"left": {
12+
"name": {
1713
"kind": "Identifier",
18-
"pos": 6,
19-
"end": 7,
14+
"pos": 10,
15+
"end": 14,
2016
"flags": "JSDoc",
21-
"text": "a"
17+
"originalKeywordKind": "ThisKeyword",
18+
"text": "this"
2219
},
23-
"right": {
24-
"kind": "Identifier",
25-
"pos": 8,
26-
"end": 9,
20+
"type": {
21+
"kind": "TypeReference",
22+
"pos": 15,
23+
"end": 18,
2724
"flags": "JSDoc",
28-
"text": "b"
25+
"typeName": {
26+
"kind": "FirstNode",
27+
"pos": 15,
28+
"end": 18,
29+
"flags": "JSDoc",
30+
"left": {
31+
"kind": "Identifier",
32+
"pos": 15,
33+
"end": 16,
34+
"flags": "JSDoc",
35+
"text": "a"
36+
},
37+
"right": {
38+
"kind": "Identifier",
39+
"pos": 17,
40+
"end": 18,
41+
"flags": "JSDoc",
42+
"text": "b"
43+
}
44+
}
2945
}
30-
}
46+
},
47+
"length": 1,
48+
"pos": 10,
49+
"end": 18
3150
}
3251
}

tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsConstructoType.json renamed to tests/baselines/reference/JSDocParsing/TypeExpressions.parsesCorrectly.tsConstructorType.json

File renamed without changes.
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(2,10): error TS8020: JSDoc types can only be used inside documentation comments.
2+
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(4,15): error TS8020: JSDoc types can only be used inside documentation comments.
3+
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(4,27): error TS8020: JSDoc types can only be used inside documentation comments.
4+
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(7,20): error TS8020: JSDoc types can only be used inside documentation comments.
5+
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(10,18): error TS8020: JSDoc types can only be used inside documentation comments.
6+
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(11,12): error TS2554: Expected 1 arguments, but got 2.
7+
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(13,14): error TS8020: JSDoc types can only be used inside documentation comments.
8+
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(14,11): error TS8020: JSDoc types can only be used inside documentation comments.
9+
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(15,8): error TS8020: JSDoc types can only be used inside documentation comments.
10+
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(16,15): error TS8020: JSDoc types can only be used inside documentation comments.
11+
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(17,11): error TS8020: JSDoc types can only be used inside documentation comments.
12+
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(18,17): error TS8020: JSDoc types can only be used inside documentation comments.
13+
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(19,5): error TS2322: Type 'undefined' is not assignable to type 'number | null'.
14+
tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts(19,17): error TS8020: JSDoc types can only be used inside documentation comments.
15+
16+
17+
==== tests/cases/conformance/jsdoc/jsdocDisallowedInTypescript.ts (14 errors) ====
18+
// grammar error from checker
19+
var ara: Array.<number> = [1,2,3];
20+
~~~~~~~~~~~~~~
21+
!!! error TS8020: JSDoc types can only be used inside documentation comments.
22+
23+
function f(x: ?number, y: Array.<number>) {
24+
~~~~~~~
25+
!!! error TS8020: JSDoc types can only be used inside documentation comments.
26+
~~~~~~~~~~~~~~
27+
!!! error TS8020: JSDoc types can only be used inside documentation comments.
28+
return x ? x + y[1] : y[0];
29+
}
30+
function hof(ctor: function(new: number, string)) {
31+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
32+
!!! error TS8020: JSDoc types can only be used inside documentation comments.
33+
return new ctor('hi');
34+
}
35+
function hof2(f: function(this: number, string): string) {
36+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
37+
!!! error TS8020: JSDoc types can only be used inside documentation comments.
38+
return f(12, 'hullo');
39+
~~~~~~~~~~~~~~
40+
!!! error TS2554: Expected 1 arguments, but got 2.
41+
}
42+
var whatevs: * = 1001;
43+
~
44+
!!! error TS8020: JSDoc types can only be used inside documentation comments.
45+
var ques: ? = 'what';
46+
~
47+
!!! error TS8020: JSDoc types can only be used inside documentation comments.
48+
var g: function(number, number): number = (n,m) => n + m;
49+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
50+
!!! error TS8020: JSDoc types can only be used inside documentation comments.
51+
var variadic: ...boolean = [true, false, true];
52+
~~~~~~~~~~
53+
!!! error TS8020: JSDoc types can only be used inside documentation comments.
54+
var most: !string = 'definite';
55+
~~~~~~~
56+
!!! error TS8020: JSDoc types can only be used inside documentation comments.
57+
var postfixdef: number! = 101;
58+
~~~~~~~
59+
!!! error TS8020: JSDoc types can only be used inside documentation comments.
60+
var postfixopt: number? = undefined;
61+
~~~~~~~~~~
62+
!!! error TS2322: Type 'undefined' is not assignable to type 'number | null'.
63+
~~~~~~~
64+
!!! error TS8020: JSDoc types can only be used inside documentation comments.
65+

tests/baselines/reference/jsdocInTypescript.js renamed to tests/baselines/reference/jsdocDisallowedInTypescript.js

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//// [jsdocInTypescript.ts]
1+
//// [jsdocDisallowedInTypescript.ts]
22
// grammar error from checker
33
var ara: Array.<number> = [1,2,3];
44

@@ -16,13 +16,11 @@ var ques: ? = 'what';
1616
var g: function(number, number): number = (n,m) => n + m;
1717
var variadic: ...boolean = [true, false, true];
1818
var most: !string = 'definite';
19-
var weird1: new:string = {};
20-
var weird2: this:string = {};
2119
var postfixdef: number! = 101;
2220
var postfixopt: number? = undefined;
2321

2422

25-
//// [jsdocInTypescript.js]
23+
//// [jsdocDisallowedInTypescript.js]
2624
"use strict";
2725
// grammar error from checker
2826
var ara = [1, 2, 3];
@@ -40,7 +38,5 @@ var ques = 'what';
4038
var g = function (n, m) { return n + m; };
4139
var variadic = [true, false, true];
4240
var most = 'definite';
43-
var weird1 = {};
44-
var weird2 = {};
4541
var postfixdef = 101;
4642
var postfixopt = undefined;

tests/baselines/reference/jsdocInTypescript.errors.txt

Lines changed: 0 additions & 85 deletions
This file was deleted.

tests/baselines/reference/jsdocInTypescript2.errors.txt

Lines changed: 0 additions & 9 deletions
This file was deleted.
Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
tests/cases/conformance/jsdoc/jsdocParseErrorsInTypescript.ts(2,27): error TS1109: Expression expected.
2+
3+
4+
==== tests/cases/conformance/jsdoc/jsdocParseErrorsInTypescript.ts (1 errors) ====
5+
// parse error (blocks grammar errors from checker)
6+
function parse1(n: number=) { }
7+
~
8+
!!! error TS1109: Expression expected.
9+

tests/baselines/reference/jsdocInTypescript2.js renamed to tests/baselines/reference/jsdocParseErrorsInTypescript.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
//// [jsdocInTypescript2.ts]
1+
//// [jsdocParseErrorsInTypescript.ts]
22
// parse error (blocks grammar errors from checker)
33
function parse1(n: number=) { }
44

55

6-
//// [jsdocInTypescript2.js]
6+
//// [jsdocParseErrorsInTypescript.js]
77
// parse error (blocks grammar errors from checker)
88
function parse1(n) {
99
if (n === void 0) { n = ; }

0 commit comments

Comments
 (0)