diff --git a/src/compiler/emitter.ts b/src/compiler/emitter.ts index e9c648bba14..cd4c000b9ef 100644 --- a/src/compiler/emitter.ts +++ b/src/compiler/emitter.ts @@ -203,7 +203,7 @@ module ts { }); } - function emitNewLineBeforeLeadingComments(node: Node, leadingComments: Comment[], writer: EmitTextWriter) { + function emitNewLineBeforeLeadingComments(node: TextRange, leadingComments: Comment[], writer: EmitTextWriter) { // If the leading comments start on different line than the start of node, write new line if (leadingComments && leadingComments.length && node.pos !== leadingComments[0].pos && currentSourceFile.getLineAndCharacterFromPosition(node.pos).line !== currentSourceFile.getLineAndCharacterFromPosition(leadingComments[0].pos).line) { @@ -325,9 +325,9 @@ module ts { /** Emit Trailing comments of the node */ var emitTrailingComments = compilerOptions.removeComments ? (node: Node) => { } : emitTrailingDeclarationComments; - var detachedCommentsEndPos: number; + var detachedCommentsInfo: { nodePos: number; detachedCommentEndPos: number }[]; /** Emit detached comments of the node */ - var emitDetachedComments = compilerOptions.removeComments ? (node: Node) => { } : emitDetachedCommentsAtPosition; + var emitDetachedComments = compilerOptions.removeComments ? (node: TextRange) => { } : emitDetachedCommentsAtPosition; var writeComment = writeCommentRange; @@ -1354,6 +1354,8 @@ module ts { scopeEmitStart(node); increaseIndent(); + emitDetachedComments(node.body.kind === SyntaxKind.FunctionBlock ? (node.body).statements : node.body); + var startIndex = 0; if (node.body.kind === SyntaxKind.FunctionBlock) { startIndex = emitDirectivePrologues((node.body).statements, /*startWithNewLine*/ true); @@ -1380,9 +1382,11 @@ module ts { } else { writeLine(); + emitLeadingComments(node.body); write("return "); emit(node.body); write(";"); + emitTrailingComments(node.body); } decreaseIndent(); writeLine(); @@ -2070,14 +2074,19 @@ module ts { // Emit the leading comments only if the parent's pos doesnt match because parent should take care of emitting these comments if (node.parent.kind === SyntaxKind.SourceFile || node.pos !== node.parent.pos) { var leadingComments: Comment[]; - if (detachedCommentsEndPos === undefined) { + if (detachedCommentsInfo === undefined || detachedCommentsInfo[detachedCommentsInfo.length - 1].nodePos !== node.pos) { // get the leading comments from the node leadingComments = getLeadingCommentsOfNode(node, currentSourceFile); } else { // get the leading comments from detachedPos - leadingComments = getLeadingComments(currentSourceFile.text, detachedCommentsEndPos); - detachedCommentsEndPos = undefined; + leadingComments = getLeadingComments(currentSourceFile.text, detachedCommentsInfo[detachedCommentsInfo.length - 1].detachedCommentEndPos); + if (detachedCommentsInfo.length - 1) { + detachedCommentsInfo.pop(); + } + else { + detachedCommentsInfo = undefined; + } } emitNewLineBeforeLeadingComments(node, leadingComments, writer); // Leading comments are emitted at /*leading comment1 */space/*leading comment*/space @@ -2094,7 +2103,7 @@ module ts { } } - function emitDetachedCommentsAtPosition(node: Node) { + function emitDetachedCommentsAtPosition(node: TextRange) { var leadingComments = getLeadingComments(currentSourceFile.text, node.pos); if (leadingComments) { var detachedComments: Comment[] = []; @@ -2125,8 +2134,15 @@ module ts { var astLine = currentSourceFile.getLineAndCharacterFromPosition(skipTrivia(currentSourceFile.text, node.pos)).line; if (astLine >= lastCommentLine + 2) { // Valid detachedComments + emitNewLineBeforeLeadingComments(node, leadingComments, writer); emitComments(detachedComments, /*trailingSeparator*/ true, writer, writeComment); - detachedCommentsEndPos = detachedComments[detachedComments.length - 1].end; + var currentDetachedCommentInfo = { nodePos: node.pos, detachedCommentEndPos: detachedComments[detachedComments.length - 1].end }; + if (detachedCommentsInfo) { + detachedCommentsInfo.push(currentDetachedCommentInfo); + } + else { + detachedCommentsInfo = [currentDetachedCommentInfo]; + } } } } diff --git a/tests/baselines/reference/detachedCommentAtStartOfFunctionBody2.js b/tests/baselines/reference/detachedCommentAtStartOfFunctionBody2.js index 6020a2c240d..2a0ac0a4f0a 100644 --- a/tests/baselines/reference/detachedCommentAtStartOfFunctionBody2.js +++ b/tests/baselines/reference/detachedCommentAtStartOfFunctionBody2.js @@ -14,10 +14,10 @@ var TestFile = (function () { function TestFile() { } TestFile.prototype.foo = function (message) { - var _this = this; /// Test summary /// /// + var _this = this; return function () { return message + _this.name; }; }; return TestFile; diff --git a/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction1.js b/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction1.js new file mode 100644 index 00000000000..2505e3f6082 --- /dev/null +++ b/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction1.js @@ -0,0 +1,31 @@ +//// [detachedCommentAtStartOfLambdaFunction1.ts] +class TestFile { + name: string; + foo(message: string): () => string { + return (...x: string[]) => + /// Test summary + /// + /// + message + this.name; + } +} + +//// [detachedCommentAtStartOfLambdaFunction1.js] +var TestFile = (function () { + function TestFile() { + } + TestFile.prototype.foo = function (message) { + var _this = this; + return function () { + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + /// Test summary + /// + /// + return message + _this.name; + }; + }; + return TestFile; +})(); diff --git a/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction2.js b/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction2.js new file mode 100644 index 00000000000..53f6d08eaf5 --- /dev/null +++ b/tests/baselines/reference/detachedCommentAtStartOfLambdaFunction2.js @@ -0,0 +1,32 @@ +//// [detachedCommentAtStartOfLambdaFunction2.ts] +class TestFile { + name: string; + foo(message: string): () => string { + return (...x: string[]) => + /// Test summary + /// + /// + + message + this.name; + } +} + +//// [detachedCommentAtStartOfLambdaFunction2.js] +var TestFile = (function () { + function TestFile() { + } + TestFile.prototype.foo = function (message) { + var _this = this; + return function () { + /// Test summary + /// + /// + var x = []; + for (var _i = 0; _i < arguments.length; _i++) { + x[_i - 0] = arguments[_i]; + } + return message + _this.name; + }; + }; + return TestFile; +})(); diff --git a/tests/baselines/reference/mergeThreeInterfaces.js b/tests/baselines/reference/mergeThreeInterfaces.js index 947453756eb..7c887e4fc7c 100644 --- a/tests/baselines/reference/mergeThreeInterfaces.js +++ b/tests/baselines/reference/mergeThreeInterfaces.js @@ -80,7 +80,6 @@ module M { //// [mergeThreeInterfaces.js] // interfaces with the same root module should merge -// basic case var a; var r1 = a.foo; var r2 = a.bar; diff --git a/tests/baselines/reference/mergeTwoInterfaces.js b/tests/baselines/reference/mergeTwoInterfaces.js index 385f74f7757..3396c62ec07 100644 --- a/tests/baselines/reference/mergeTwoInterfaces.js +++ b/tests/baselines/reference/mergeTwoInterfaces.js @@ -59,7 +59,6 @@ module M { //// [mergeTwoInterfaces.js] // two interfaces with the same root module should merge -// basic case var a; var r1 = a.foo; var r2 = a.bar; diff --git a/tests/baselines/reference/parserSbp_7.9_A9_T3.js b/tests/baselines/reference/parserSbp_7.9_A9_T3.js index ee6db5c75a4..60c8c4ad6eb 100644 --- a/tests/baselines/reference/parserSbp_7.9_A9_T3.js +++ b/tests/baselines/reference/parserSbp_7.9_A9_T3.js @@ -22,11 +22,4 @@ do { do { ; } while (false); -/** - * Check Do-While Statement for automatic semicolon insertion - * - * @path bestPractice/Sbp_7.9_A9_T3.js - * @description Execute do { \n ; \n }while(false) true - */ -//CHECK#1 true; diff --git a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js index 186b666dfa7..37aa59bef43 100644 --- a/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js +++ b/tests/baselines/reference/stringLiteralTypeIsSubtypeOfString.js @@ -101,7 +101,6 @@ function f16(x: any) { } //// [stringLiteralTypeIsSubtypeOfString.js] // string literal types are subtypes of string, any -// ok function f1(x) { } function f2(x) { diff --git a/tests/baselines/reference/subtypingWithObjectMembersOptionality.js b/tests/baselines/reference/subtypingWithObjectMembersOptionality.js index d23fed74b0b..87a7012e91e 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersOptionality.js +++ b/tests/baselines/reference/subtypingWithObjectMembersOptionality.js @@ -75,6 +75,7 @@ module TwoLevels { //// [subtypingWithObjectMembersOptionality.js] // Derived member is not optional but base member is, should be ok +// object literal case var a; var b = { Foo: null }; var r = true ? a : b; diff --git a/tests/baselines/reference/subtypingWithObjectMembersOptionality2.js b/tests/baselines/reference/subtypingWithObjectMembersOptionality2.js index 81f3ce4de36..186f3ba4544 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersOptionality2.js +++ b/tests/baselines/reference/subtypingWithObjectMembersOptionality2.js @@ -35,6 +35,7 @@ var r = true ? a : b; // error //// [subtypingWithObjectMembersOptionality2.js] // Derived member is optional but base member is not, should be an error +// object literal case var a; var b; var r = true ? a : b; // error diff --git a/tests/baselines/reference/subtypingWithObjectMembersOptionality3.js b/tests/baselines/reference/subtypingWithObjectMembersOptionality3.js index 9895a554306..0f2e26d8c0c 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersOptionality3.js +++ b/tests/baselines/reference/subtypingWithObjectMembersOptionality3.js @@ -35,6 +35,7 @@ var r = true ? a : b; // ok //// [subtypingWithObjectMembersOptionality3.js] // Base property is optional and derived type has no property of that name +// object literal case var a; var b; var r = true ? a : b; // ok diff --git a/tests/baselines/reference/subtypingWithObjectMembersOptionality4.js b/tests/baselines/reference/subtypingWithObjectMembersOptionality4.js index c9f534210fb..da9429e6a9a 100644 --- a/tests/baselines/reference/subtypingWithObjectMembersOptionality4.js +++ b/tests/baselines/reference/subtypingWithObjectMembersOptionality4.js @@ -35,6 +35,7 @@ var r = true ? a : b; // ok //// [subtypingWithObjectMembersOptionality4.js] // Base has required property, derived adds an optional property, no errors +// object literal case var a; var b; var r = true ? a : b; // ok diff --git a/tests/baselines/reference/typeResolution.js.map b/tests/baselines/reference/typeResolution.js.map index 3c70a03783d..0e998a5a883 100644 --- a/tests/baselines/reference/typeResolution.js.map +++ b/tests/baselines/reference/typeResolution.js.map @@ -1,2 +1,2 @@ //// [typeResolution.js.map] -{"version":3,"file":"typeResolution.js","sourceRoot":"","sources":["typeResolution.ts"],"names":["TopLevelModule1","TopLevelModule1.SubModule1","TopLevelModule1.SubModule1.SubSubModule1","TopLevelModule1.SubModule1.SubSubModule1.ClassA","TopLevelModule1.SubModule1.SubSubModule1.ClassA.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.ClassB","TopLevelModule1.SubModule1.SubSubModule1.ClassB.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ","TopLevelModule1.SubModule1.ClassA","TopLevelModule1.SubModule1.ClassA.constructor","TopLevelModule1.SubModule1.ClassA.constructor.AA","TopLevelModule1.SubModule2","TopLevelModule1.SubModule2.SubSubModule2","TopLevelModule1.SubModule2.SubSubModule2.ClassA","TopLevelModule1.SubModule2.SubSubModule2.ClassA.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassA.AisIn1_2_2","TopLevelModule1.SubModule2.SubSubModule2.ClassB","TopLevelModule1.SubModule2.SubSubModule2.ClassB.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassB.BisIn1_2_2","TopLevelModule1.SubModule2.SubSubModule2.ClassC","TopLevelModule1.SubModule2.SubSubModule2.ClassC.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassC.CisIn1_2_2","TopLevelModule1.ClassA","TopLevelModule1.ClassA.constructor","TopLevelModule1.ClassA.AisIn1","TopLevelModule1.NotExportedModule","TopLevelModule1.NotExportedModule.ClassA","TopLevelModule1.NotExportedModule.ClassA.constructor","TopLevelModule2","TopLevelModule2.SubModule3","TopLevelModule2.SubModule3.ClassA","TopLevelModule2.SubModule3.ClassA.constructor","TopLevelModule2.SubModule3.ClassA.AisIn2_3"],"mappings":";IAAA,WAAc,eAAe,EAAC,CAAC;QAC3BA,WAAcA,UAAUA,EAACA,CAACA;YACtBC,WAAcA,aAAaA,EAACA,CAACA;gBACzBC,IAAaA,MAAMA;oBAAnBC,SAAaA,MAAMA;oBAmBnBC,CAACA;oBAlBUD,2BAAUA,GAAjBA;wBAEIE,AADAA,uCAAuCA;4BACnCA,EAAUA,C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bA,CAAAA;QAEDA,IAAMA,MAAMA;YAAZ0B,SAAMA,MAAMA;YAEZC,CAACA;YADUD,uBAAMA,GAAbA;YAAkBE,CAACA;YACvBF,aAACA;QAADA,CAACA,AAFD1B,IAECA;QAMDA,IAAOA,iBAAiBA,CAEvBA;QAFDA,WAAOA,iBAAiBA,EAACA,CAACA;YACtB6B,IAAaA,MAAMA;gBAAnBC,SAAaA,MAAMA;gBAAGC,CAACA;gBAADD,aAACA;YAADA,CAACA,AAAvBD,IAAuBA;YAAVA,wBAAMA,GAANA,MAAUA,CAAAA;QAC3BA,CAACA,EAFM7B,iBAAiBA,KAAjBA,iBAAiBA,QAEvBA;IACLA,CAACA,EAnGa,uBAAe,KAAf,uBAAe,QAmG5B;IAnGD,IAAc,eAAe,GAAf,uBAmGb,CAAA;IAED,IAAO,eAAe,CAMrB;IAND,WAAO,eAAe,EAAC,CAAC;QACpBgC,WAAcA,UAAUA,EAACA,CAACA;YACtBC,IAAaA,MAAMA;gBAAnBC,SAAaA,MAAMA;gBAEnBC,CAACA;gBADUD,yBAAQA,GAAfA;gBAAoBE,CAACA;gBACzBF,aAACA;YAADA,CAACA,AAFDD,IAECA;YAFYA,iBAAMA,GAANA,MAEZA,CAAAA;QACLA,CAACA,EAJaD,0BAAUA,KAAVA,0BAAUA,QAIvBA;QAJDA,IAAcA,UAAUA,GAAVA,0BAIbA,CAAAA;IACLA,CAACA,EANM,eAAe,KAAf,eAAe,QAMrB"} \ No newline at end of file +{"version":3,"file":"typeResolution.js","sourceRoot":"","sources":["typeResolution.ts"],"names":["TopLevelModule1","TopLevelModule1.SubModule1","TopLevelModule1.SubModule1.SubSubModule1","TopLevelModule1.SubModule1.SubSubModule1.ClassA","TopLevelModule1.SubModule1.SubSubModule1.ClassA.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassA.AisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.ClassB","TopLevelModule1.SubModule1.SubSubModule1.ClassB.constructor","TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor","TopLevelModule1.SubModule1.SubSubModule1.NonExportedClassQ.constructor.QQ","TopLevelModule1.SubModule1.ClassA","TopLevelModule1.SubModule1.ClassA.constructor","TopLevelModule1.SubModule1.ClassA.constructor.AA","TopLevelModule1.SubModule2","TopLevelModule1.SubModule2.SubSubModule2","TopLevelModule1.SubModule2.SubSubModule2.ClassA","TopLevelModule1.SubModule2.SubSubModule2.ClassA.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassA.AisIn1_2_2","TopLevelModule1.SubModule2.SubSubModule2.ClassB","TopLevelModule1.SubModule2.SubSubModule2.ClassB.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassB.BisIn1_2_2","TopLevelModule1.SubModule2.SubSubModule2.ClassC","TopLevelModule1.SubModule2.SubSubModule2.ClassC.constructor","TopLevelModule1.SubModule2.SubSubModule2.ClassC.CisIn1_2_2","TopLevelModule1.ClassA","TopLevelModule1.ClassA.constructor","TopLevelModule1.ClassA.AisIn1","TopLevelModule1.NotExportedModule","TopLevelModule1.NotExportedModule.ClassA","TopLevelModule1.NotExportedModule.ClassA.constructor","TopLevelModule2","TopLevelModule2.SubModule3","TopLevelModule2.SubModule3.ClassA","TopLevelModule2.SubModule3.ClassA.constructor","TopLevelModule2.SubModule3.ClassA.AisIn2_3"],"mappings":";IAAA,WAAc,eAAe,EAAC,CAAC;QAC3BA,WAAcA,UAAUA,EAACA,CAACA;YACtBC,WAAcA,aAAaA,EAACA,CAACA;gBACzBC,IAAaA,MAAMA;oBAAnBC,SAAaA,MAAMA;oBAmBnBC,CAACA;oBAlBUD,2BAAUA,GAAjBA;wBAEIE,AADAA,uCAAuCA;4BACnCA,EAAUA,CAACA;wBAACA,EAAEA,CAACA,UAAUA,EAAEA,CAACA;wBAChCA,IAAIA,EAAwBA,CAACA;wBAACA,EAAEA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YAAkBE,CAACA;YACvBF,aAACA;QAADA,CAACA,AAFD1B,IAECA;QAMDA,IAAOA,iBAAiBA,CAEvBA;QAFDA,WAAOA,iBAAiBA,EAACA,CAACA;YACtB6B,IAAaA,MAAMA;gBAAnBC,SAAaA,MAAMA;gBAAGC,CAACA;gBAADD,aAACA;YAADA,CAACA,AAAvBD,IAAuBA;YAAVA,wBAAMA,GAANA,MAAUA,CAAAA;QAC3BA,CAACA,EAFM7B,iBAAiBA,KAAjBA,iBAAiBA,QAEvBA;IACLA,CAACA,EAnGa,uBAAe,KAAf,uBAAe,QAmG5B;IAnGD,IAAc,eAAe,GAAf,uBAmGb,CAAA;IAED,IAAO,eAAe,CAMrB;IAND,WAAO,eAAe,EAAC,CAAC;QACpBgC,WAAcA,UAAUA,EAACA,CAACA;YACtBC,IAAaA,MAAMA;gBAAnBC,SAAaA,MAAMA;gBAEnBC,CAACA;gBADUD,yBAAQA,GAAfA;gBAAoBE,CAACA;gBACzBF,aAACA;YAADA,CAACA,AAFDD,IAECA;YAFYA,iBAAMA,GAANA,MAEZA,CAAAA;QACLA,CAACA,EAJaD,0BAAUA,KAAVA,0BAAUA,QAIvBA;QAJDA,IAAcA,UAAUA,GAAVA,0BAIbA,CAAAA;IACLA,CAACA,EANM,eAAe,KAAf,eAAe,QAMrB"} \ No newline at end of file diff --git a/tests/baselines/reference/typeResolution.sourcemap.txt b/tests/baselines/reference/typeResolution.sourcemap.txt index f013eeb30d3..82ac1974558 100644 --- a/tests/baselines/reference/typeResolution.sourcemap.txt +++ b/tests/baselines/reference/typeResolution.sourcemap.txt @@ -656,28 +656,26 @@ sourceFile:typeResolution.ts --- >>> /** Exactly the same as above in AisIn1_1_1 **/ 1->^^^^^^^^^^^^^^^^^^^^^^^^ -2 > -3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ 1->public BisIn1_1_1() { - > /** Exactly the same as above in AisIn1_1_1 **/ + > +2 > /** Exactly the same as above in AisIn1_1_1 **/ +1->Emitted(39, 25) Source(26, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +2 >Emitted(39, 72) Source(26, 68) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +--- +>>> // Try all qualified names of this type +1 >^^^^^^^^^^^^^^^^^^^^^^^^ +2 > +3 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ +1 > > > // Try all qualified names of this type > 2 > -3 > /** Exactly the same as above in AisIn1_1_1 **/ -1->Emitted(39, 25) Source(29, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -2 >Emitted(39, 25) Source(26, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -3 >Emitted(39, 72) Source(26, 68) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) ---- ->>> // Try all qualified names of this type -1 >^^^^^^^^^^^^^^^^^^^^^^^^ -2 > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ -1 > - > - > -2 > // Try all qualified names of this type -1 >Emitted(40, 25) Source(28, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) -2 >Emitted(40, 64) Source(28, 60) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +3 > // Try all qualified names of this type +1 >Emitted(40, 25) Source(29, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +2 >Emitted(40, 25) Source(28, 21) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) +3 >Emitted(40, 64) Source(28, 60) + SourceIndex(0) name (TopLevelModule1.SubModule1.SubSubModule1.ClassB.BisIn1_1_1) --- >>> var a1; 1 >^^^^^^^^^^^^^^^^^^^^^^^^^^^^ diff --git a/tests/cases/compiler/detachedCommentAtStartOfLambdaFunction1.ts b/tests/cases/compiler/detachedCommentAtStartOfLambdaFunction1.ts new file mode 100644 index 00000000000..cd18872780e --- /dev/null +++ b/tests/cases/compiler/detachedCommentAtStartOfLambdaFunction1.ts @@ -0,0 +1,10 @@ +class TestFile { + name: string; + foo(message: string): () => string { + return (...x: string[]) => + /// Test summary + /// + /// + message + this.name; + } +} \ No newline at end of file diff --git a/tests/cases/compiler/detachedCommentAtStartOfLambdaFunction2.ts b/tests/cases/compiler/detachedCommentAtStartOfLambdaFunction2.ts new file mode 100644 index 00000000000..a7d591440e3 --- /dev/null +++ b/tests/cases/compiler/detachedCommentAtStartOfLambdaFunction2.ts @@ -0,0 +1,11 @@ +class TestFile { + name: string; + foo(message: string): () => string { + return (...x: string[]) => + /// Test summary + /// + /// + + message + this.name; + } +} \ No newline at end of file