mirror of
https://github.com/microsoft/TypeScript.git
synced 2026-05-15 12:51:30 -05:00
Fix issue #5810 doubled comment on functions in array literals
This commit is contained in:
31
tests/baselines/reference/arrayLiteralComments.js
Normal file
31
tests/baselines/reference/arrayLiteralComments.js
Normal file
@@ -0,0 +1,31 @@
|
||||
//// [arrayLiteralComments.ts]
|
||||
var testArrayWithFunc = [
|
||||
// Function comment
|
||||
function() {
|
||||
let x = 1;
|
||||
},
|
||||
// String comment
|
||||
'1',
|
||||
// Numeric comment
|
||||
2,
|
||||
// Object comment
|
||||
{ a: 1 },
|
||||
// Array comment
|
||||
[1, 2, 3]
|
||||
]
|
||||
|
||||
//// [arrayLiteralComments.js]
|
||||
var testArrayWithFunc = [
|
||||
// Function comment
|
||||
function () {
|
||||
var x = 1;
|
||||
},
|
||||
// String comment
|
||||
'1',
|
||||
// Numeric comment
|
||||
2,
|
||||
// Object comment
|
||||
{ a: 1 },
|
||||
// Array comment
|
||||
[1, 2, 3]
|
||||
];
|
||||
21
tests/baselines/reference/arrayLiteralComments.symbols
Normal file
21
tests/baselines/reference/arrayLiteralComments.symbols
Normal file
@@ -0,0 +1,21 @@
|
||||
=== tests/cases/compiler/arrayLiteralComments.ts ===
|
||||
var testArrayWithFunc = [
|
||||
>testArrayWithFunc : Symbol(testArrayWithFunc, Decl(arrayLiteralComments.ts, 0, 3))
|
||||
|
||||
// Function comment
|
||||
function() {
|
||||
let x = 1;
|
||||
>x : Symbol(x, Decl(arrayLiteralComments.ts, 3, 11))
|
||||
|
||||
},
|
||||
// String comment
|
||||
'1',
|
||||
// Numeric comment
|
||||
2,
|
||||
// Object comment
|
||||
{ a: 1 },
|
||||
>a : Symbol(a, Decl(arrayLiteralComments.ts, 10, 5))
|
||||
|
||||
// Array comment
|
||||
[1, 2, 3]
|
||||
]
|
||||
36
tests/baselines/reference/arrayLiteralComments.types
Normal file
36
tests/baselines/reference/arrayLiteralComments.types
Normal file
@@ -0,0 +1,36 @@
|
||||
=== tests/cases/compiler/arrayLiteralComments.ts ===
|
||||
var testArrayWithFunc = [
|
||||
>testArrayWithFunc : ((() => void) | string | number | { a: number; } | number[])[]
|
||||
>[ // Function comment function() { let x = 1; }, // String comment '1', // Numeric comment 2, // Object comment { a: 1 }, // Array comment [1, 2, 3]] : ((() => void) | string | number | { a: number; } | number[])[]
|
||||
|
||||
// Function comment
|
||||
function() {
|
||||
>function() { let x = 1; } : () => void
|
||||
|
||||
let x = 1;
|
||||
>x : number
|
||||
>1 : number
|
||||
|
||||
},
|
||||
// String comment
|
||||
'1',
|
||||
>'1' : string
|
||||
|
||||
// Numeric comment
|
||||
2,
|
||||
>2 : number
|
||||
|
||||
// Object comment
|
||||
{ a: 1 },
|
||||
>{ a: 1 } : { a: number; }
|
||||
>a : number
|
||||
>1 : number
|
||||
|
||||
// Array comment
|
||||
[1, 2, 3]
|
||||
>[1, 2, 3] : number[]
|
||||
>1 : number
|
||||
>2 : number
|
||||
>3 : number
|
||||
|
||||
]
|
||||
Reference in New Issue
Block a user