diff --git a/doNotEmitTripleSlashCommentsEvenInAmbientDeclaration.ts b/doNotEmitTripleSlashCommentsEvenInAmbientDeclaration.ts
deleted file mode 100644
index 3a89b600c66..00000000000
--- a/doNotEmitTripleSlashCommentsEvenInAmbientDeclaration.ts
+++ /dev/null
@@ -1,8 +0,0 @@
-// @comments: false
-
-// @Filename: file0.ts
-
-// @Fileame: file1.ts
-
-///
-declare var OData: any;
\ No newline at end of file
diff --git a/tests/baselines/reference/doNotEmitDetachedComments.js b/tests/baselines/reference/doNotEmitDetachedComments.js
new file mode 100644
index 00000000000..74acb537fa8
--- /dev/null
+++ b/tests/baselines/reference/doNotEmitDetachedComments.js
@@ -0,0 +1,33 @@
+//// [doNotEmitDetachedComments.ts]
+/*
+
+ multi line
+ comment
+*/
+
+var x = 10;
+
+// Single Line comment
+
+function foo() { }
+
+
+/*
+ multi-line comment
+
+*/
+
+
+//========================
+
+
+function bar() { }
+
+
+//========================
+
+
+//// [doNotEmitDetachedComments.js]
+var x = 10;
+function foo() { }
+function bar() { }
diff --git a/tests/baselines/reference/doNotEmitDetachedComments.symbols b/tests/baselines/reference/doNotEmitDetachedComments.symbols
new file mode 100644
index 00000000000..c718da7bb9a
--- /dev/null
+++ b/tests/baselines/reference/doNotEmitDetachedComments.symbols
@@ -0,0 +1,31 @@
+=== tests/cases/compiler/doNotEmitDetachedComments.ts ===
+/*
+
+ multi line
+ comment
+*/
+
+var x = 10;
+>x : Symbol(x, Decl(doNotEmitDetachedComments.ts, 6, 3))
+
+// Single Line comment
+
+function foo() { }
+>foo : Symbol(foo, Decl(doNotEmitDetachedComments.ts, 6, 11))
+
+
+/*
+ multi-line comment
+
+*/
+
+
+//========================
+
+
+function bar() { }
+>bar : Symbol(bar, Decl(doNotEmitDetachedComments.ts, 10, 18))
+
+
+//========================
+
diff --git a/tests/baselines/reference/doNotEmitDetachedComments.types b/tests/baselines/reference/doNotEmitDetachedComments.types
new file mode 100644
index 00000000000..d9b5f0634c2
--- /dev/null
+++ b/tests/baselines/reference/doNotEmitDetachedComments.types
@@ -0,0 +1,32 @@
+=== tests/cases/compiler/doNotEmitDetachedComments.ts ===
+/*
+
+ multi line
+ comment
+*/
+
+var x = 10;
+>x : number
+>10 : number
+
+// Single Line comment
+
+function foo() { }
+>foo : () => void
+
+
+/*
+ multi-line comment
+
+*/
+
+
+//========================
+
+
+function bar() { }
+>bar : () => void
+
+
+//========================
+
diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.js b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.js
new file mode 100644
index 00000000000..ba6dbf8b743
--- /dev/null
+++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.js
@@ -0,0 +1,64 @@
+//// [doNotEmitDetachedCommentsAtStartOfConstructor.ts]
+class A {
+ constructor() {
+ // Single Line Comment
+
+ var x = 10;
+ }
+}
+
+class B {
+ constructor() {
+ /*
+ Multi-line comment
+ */
+
+ var y = 10;
+ }
+}
+
+class C {
+ constructor() {
+ // Single Line Comment with more than one blank line
+
+
+ var x = 10;
+ }
+}
+
+class D {
+ constructor() {
+ /*
+ Multi-line comment with more than one blank line
+ */
+
+
+ var y = 10;
+ }
+}
+
+//// [doNotEmitDetachedCommentsAtStartOfConstructor.js]
+var A = (function () {
+ function A() {
+ var x = 10;
+ }
+ return A;
+})();
+var B = (function () {
+ function B() {
+ var y = 10;
+ }
+ return B;
+})();
+var C = (function () {
+ function C() {
+ var x = 10;
+ }
+ return C;
+})();
+var D = (function () {
+ function D() {
+ var y = 10;
+ }
+ return D;
+})();
diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.symbols b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.symbols
new file mode 100644
index 00000000000..d7c4f5b2ca9
--- /dev/null
+++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.symbols
@@ -0,0 +1,50 @@
+=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfConstructor.ts ===
+class A {
+>A : Symbol(A, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 0, 0))
+
+ constructor() {
+ // Single Line Comment
+
+ var x = 10;
+>x : Symbol(x, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 4, 11))
+ }
+}
+
+class B {
+>B : Symbol(B, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 6, 1))
+
+ constructor() {
+ /*
+ Multi-line comment
+ */
+
+ var y = 10;
+>y : Symbol(y, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 14, 11))
+ }
+}
+
+class C {
+>C : Symbol(C, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 16, 1))
+
+ constructor() {
+ // Single Line Comment with more than one blank line
+
+
+ var x = 10;
+>x : Symbol(x, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 23, 11))
+ }
+}
+
+class D {
+>D : Symbol(D, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 25, 1))
+
+ constructor() {
+ /*
+ Multi-line comment with more than one blank line
+ */
+
+
+ var y = 10;
+>y : Symbol(y, Decl(doNotEmitDetachedCommentsAtStartOfConstructor.ts, 34, 11))
+ }
+}
diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.types b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.types
new file mode 100644
index 00000000000..c316c6403c0
--- /dev/null
+++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfConstructor.types
@@ -0,0 +1,54 @@
+=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfConstructor.ts ===
+class A {
+>A : A
+
+ constructor() {
+ // Single Line Comment
+
+ var x = 10;
+>x : number
+>10 : number
+ }
+}
+
+class B {
+>B : B
+
+ constructor() {
+ /*
+ Multi-line comment
+ */
+
+ var y = 10;
+>y : number
+>10 : number
+ }
+}
+
+class C {
+>C : C
+
+ constructor() {
+ // Single Line Comment with more than one blank line
+
+
+ var x = 10;
+>x : number
+>10 : number
+ }
+}
+
+class D {
+>D : D
+
+ constructor() {
+ /*
+ Multi-line comment with more than one blank line
+ */
+
+
+ var y = 10;
+>y : number
+>10 : number
+ }
+}
diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.js b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.js
new file mode 100644
index 00000000000..dbd0f0be783
--- /dev/null
+++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.js
@@ -0,0 +1,48 @@
+//// [doNotEmitDetachedCommentsAtStartOfFunctionBody.ts]
+function foo1() {
+ // Single line comment
+
+ return 42;
+}
+
+function foo2() {
+ /*
+
+ multi line
+ comment
+ */
+
+ return 42;
+}
+
+function foo3() {
+ // Single line comment with more than one blank line
+
+
+ return 42;
+}
+
+function foo4() {
+ /*
+
+ multi line comment with more than one blank line
+ */
+
+ return 42;
+}
+
+
+
+//// [doNotEmitDetachedCommentsAtStartOfFunctionBody.js]
+function foo1() {
+ return 42;
+}
+function foo2() {
+ return 42;
+}
+function foo3() {
+ return 42;
+}
+function foo4() {
+ return 42;
+}
diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.symbols b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.symbols
new file mode 100644
index 00000000000..c1680100369
--- /dev/null
+++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.symbols
@@ -0,0 +1,42 @@
+=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts ===
+function foo1() {
+>foo1 : Symbol(foo1, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 0, 0))
+
+ // Single line comment
+
+ return 42;
+}
+
+function foo2() {
+>foo2 : Symbol(foo2, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 4, 1))
+
+ /*
+
+ multi line
+ comment
+ */
+
+ return 42;
+}
+
+function foo3() {
+>foo3 : Symbol(foo3, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 14, 1))
+
+ // Single line comment with more than one blank line
+
+
+ return 42;
+}
+
+function foo4() {
+>foo4 : Symbol(foo4, Decl(doNotEmitDetachedCommentsAtStartOfFunctionBody.ts, 21, 1))
+
+ /*
+
+ multi line comment with more than one blank line
+ */
+
+ return 42;
+}
+
+
diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.types b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.types
new file mode 100644
index 00000000000..3b4814bbbb2
--- /dev/null
+++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfFunctionBody.types
@@ -0,0 +1,46 @@
+=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts ===
+function foo1() {
+>foo1 : () => number
+
+ // Single line comment
+
+ return 42;
+>42 : number
+}
+
+function foo2() {
+>foo2 : () => number
+
+ /*
+
+ multi line
+ comment
+ */
+
+ return 42;
+>42 : number
+}
+
+function foo3() {
+>foo3 : () => number
+
+ // Single line comment with more than one blank line
+
+
+ return 42;
+>42 : number
+}
+
+function foo4() {
+>foo4 : () => number
+
+ /*
+
+ multi line comment with more than one blank line
+ */
+
+ return 42;
+>42 : number
+}
+
+
diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.js b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.js
new file mode 100644
index 00000000000..7fd5c2b8f8e
--- /dev/null
+++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.js
@@ -0,0 +1,45 @@
+//// [doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts]
+() => {
+ // Single line comment
+
+ return 0;
+}
+
+() => {
+ /*
+ multi-line comment
+ */
+
+ return 0;
+}
+
+() => {
+ // Single line comment with more than one blank line
+
+
+ return 0;
+}
+
+() => {
+ /*
+ multi-line comment with more than one blank line
+ */
+
+
+ return 0;
+}
+
+
+//// [doNotEmitDetachedCommentsAtStartOfLambdaFunction.js]
+(function () {
+ return 0;
+});
+(function () {
+ return 0;
+});
+(function () {
+ return 0;
+});
+(function () {
+ return 0;
+});
diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.symbols b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.symbols
new file mode 100644
index 00000000000..e57fc793920
--- /dev/null
+++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.symbols
@@ -0,0 +1,32 @@
+=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts ===
+() => {
+No type information for this code. // Single line comment
+No type information for this code.
+No type information for this code. return 0;
+No type information for this code.}
+No type information for this code.
+No type information for this code.() => {
+No type information for this code. /*
+No type information for this code. multi-line comment
+No type information for this code. */
+No type information for this code.
+No type information for this code. return 0;
+No type information for this code.}
+No type information for this code.
+No type information for this code.() => {
+No type information for this code. // Single line comment with more than one blank line
+No type information for this code.
+No type information for this code.
+No type information for this code. return 0;
+No type information for this code.}
+No type information for this code.
+No type information for this code.() => {
+No type information for this code. /*
+No type information for this code. multi-line comment with more than one blank line
+No type information for this code. */
+No type information for this code.
+No type information for this code.
+No type information for this code. return 0;
+No type information for this code.}
+No type information for this code.
+No type information for this code.
\ No newline at end of file
diff --git a/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.types b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.types
new file mode 100644
index 00000000000..d90e93d84c5
--- /dev/null
+++ b/tests/baselines/reference/doNotEmitDetachedCommentsAtStartOfLambdaFunction.types
@@ -0,0 +1,43 @@
+=== tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts ===
+() => {
+>() => { // Single line comment return 0;} : () => number
+
+ // Single line comment
+
+ return 0;
+>0 : number
+}
+
+() => {
+>() => { /* multi-line comment */ return 0;} : () => number
+
+ /*
+ multi-line comment
+ */
+
+ return 0;
+>0 : number
+}
+
+() => {
+>() => { // Single line comment with more than one blank line return 0;} : () => number
+
+ // Single line comment with more than one blank line
+
+
+ return 0;
+>0 : number
+}
+
+() => {
+>() => { /* multi-line comment with more than one blank line */ return 0;} : () => number
+
+ /*
+ multi-line comment with more than one blank line
+ */
+
+
+ return 0;
+>0 : number
+}
+
diff --git a/tests/baselines/reference/doNotEmitTripleSlashCommentsInAmbientDeclaration.js b/tests/baselines/reference/doNotEmitTripleSlashCommentsInAmbientDeclaration.js
index d3c461fe8c2..065c08afefb 100644
--- a/tests/baselines/reference/doNotEmitTripleSlashCommentsInAmbientDeclaration.js
+++ b/tests/baselines/reference/doNotEmitTripleSlashCommentsInAmbientDeclaration.js
@@ -2,11 +2,18 @@
//// [file0.ts]
+///
+class C {
+ ///
+ public foo(x: string, y: any)
+ public foo(x: string, y: number) { }
+}
//// [file1.ts]
+var x = 10;
///
declare var OData: any;
-//// [file0.js]
//// [file1.js]
+var x = 10;
diff --git a/tests/baselines/reference/doNotEmitTripleSlashCommentsInAmbientDeclaration.symbols b/tests/baselines/reference/doNotEmitTripleSlashCommentsInAmbientDeclaration.symbols
index f3566dc7e33..c41f7ed5822 100644
--- a/tests/baselines/reference/doNotEmitTripleSlashCommentsInAmbientDeclaration.symbols
+++ b/tests/baselines/reference/doNotEmitTripleSlashCommentsInAmbientDeclaration.symbols
@@ -1,10 +1,8 @@
=== tests/cases/compiler/file1.ts ===
+var x = 10;
+>x : Symbol(x, Decl(file1.ts, 0, 3))
///
declare var OData: any;
->OData : Symbol(OData, Decl(file1.ts, 2, 11))
+>OData : Symbol(OData, Decl(file1.ts, 3, 11))
-=== tests/cases/compiler/file0.ts ===
-
-No type information for this code.
-No type information for this code.
\ No newline at end of file
diff --git a/tests/baselines/reference/doNotEmitTripleSlashCommentsInAmbientDeclaration.types b/tests/baselines/reference/doNotEmitTripleSlashCommentsInAmbientDeclaration.types
index 37ae645a302..f4bb0bbc964 100644
--- a/tests/baselines/reference/doNotEmitTripleSlashCommentsInAmbientDeclaration.types
+++ b/tests/baselines/reference/doNotEmitTripleSlashCommentsInAmbientDeclaration.types
@@ -1,10 +1,9 @@
=== tests/cases/compiler/file1.ts ===
+var x = 10;
+>x : number
+>10 : number
///
declare var OData: any;
>OData : any
-=== tests/cases/compiler/file0.ts ===
-
-No type information for this code.
-No type information for this code.
\ No newline at end of file
diff --git a/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.js b/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.js
index 38f6980e5c7..f3b0888a78f 100644
--- a/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.js
+++ b/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.js
@@ -3,13 +3,13 @@
//// [file0.ts]
-//// [file2.ts]
-
//// [file1.ts]
+
+//// [file2.ts]
///
-///
+///
///
//// [file0.js]
-//// [file2.js]
//// [file1.js]
+//// [file2.js]
diff --git a/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.symbols b/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.symbols
index 7993a31b91e..d18810db280 100644
--- a/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.symbols
+++ b/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.symbols
@@ -1,10 +1,10 @@
-=== tests/cases/compiler/file1.ts ===
+=== tests/cases/compiler/file2.ts ===
///
-No type information for this code.///
+No type information for this code.///
No type information for this code.///
No type information for this code.=== tests/cases/compiler/file0.ts ===
No type information for this code.
-No type information for this code.=== tests/cases/compiler/file2.ts ===
+No type information for this code.=== tests/cases/compiler/file1.ts ===
No type information for this code.
\ No newline at end of file
diff --git a/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.types b/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.types
index 7993a31b91e..d18810db280 100644
--- a/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.types
+++ b/tests/baselines/reference/doNotEmitTripleSlashCommentsInEmptyFile.types
@@ -1,10 +1,10 @@
-=== tests/cases/compiler/file1.ts ===
+=== tests/cases/compiler/file2.ts ===
///
-No type information for this code.///
+No type information for this code.///
No type information for this code.///
No type information for this code.=== tests/cases/compiler/file0.ts ===
No type information for this code.
-No type information for this code.=== tests/cases/compiler/file2.ts ===
+No type information for this code.=== tests/cases/compiler/file1.ts ===
No type information for this code.
\ No newline at end of file
diff --git a/tests/baselines/reference/doNotEmitTripleSlashCommentsInTheMiddle.js b/tests/baselines/reference/doNotEmitTripleSlashCommentsInTheMiddle.js
deleted file mode 100644
index 5a1c65a2b6b..00000000000
--- a/tests/baselines/reference/doNotEmitTripleSlashCommentsInTheMiddle.js
+++ /dev/null
@@ -1,15 +0,0 @@
-//// [tests/cases/compiler/doNotEmitTripleSlashCommentsInTheMiddle.ts] ////
-
-//// [0.ts]
-
-
-//// [1.ts]
-///
-var x = 10;
-///
-var y = 1000;
-
-//// [0.js]
-//// [1.js]
-var x = 10;
-var y = 1000;
diff --git a/tests/baselines/reference/doNotEmitTripleSlashCommentsInTheMiddle.symbols b/tests/baselines/reference/doNotEmitTripleSlashCommentsInTheMiddle.symbols
deleted file mode 100644
index 353b90f3812..00000000000
--- a/tests/baselines/reference/doNotEmitTripleSlashCommentsInTheMiddle.symbols
+++ /dev/null
@@ -1,13 +0,0 @@
-=== tests/cases/compiler/1.ts ===
-///
-var x = 10;
->x : Symbol(x, Decl(1.ts, 1, 3))
-
-///
-var y = 1000;
->y : Symbol(y, Decl(1.ts, 3, 3))
-
-=== tests/cases/compiler/0.ts ===
-
-No type information for this code.
-No type information for this code.
\ No newline at end of file
diff --git a/tests/baselines/reference/doNotEmitTripleSlashCommentsInTheMiddle.types b/tests/baselines/reference/doNotEmitTripleSlashCommentsInTheMiddle.types
deleted file mode 100644
index e26f99fa1a7..00000000000
--- a/tests/baselines/reference/doNotEmitTripleSlashCommentsInTheMiddle.types
+++ /dev/null
@@ -1,15 +0,0 @@
-=== tests/cases/compiler/1.ts ===
-///
-var x = 10;
->x : number
->10 : number
-
-///
-var y = 1000;
->y : number
->1000 : number
-
-=== tests/cases/compiler/0.ts ===
-
-No type information for this code.
-No type information for this code.
\ No newline at end of file
diff --git a/tests/baselines/reference/doNotEmitdetachedCommentAtStartOfFunctionBody.js b/tests/baselines/reference/doNotEmitdetachedCommentAtStartOfFunctionBody.js
deleted file mode 100644
index 7dd9c7ce679..00000000000
--- a/tests/baselines/reference/doNotEmitdetachedCommentAtStartOfFunctionBody.js
+++ /dev/null
@@ -1,15 +0,0 @@
-//// [doNotEmitdetachedCommentAtStartOfFunctionBody.ts]
-function foo() {
- /*
-
- multi line
- comment
- */
-
- return 42;
-}
-
-//// [doNotEmitdetachedCommentAtStartOfFunctionBody.js]
-function foo() {
- return 42;
-}
diff --git a/tests/baselines/reference/doNotEmitdetachedCommentAtStartOfFunctionBody.symbols b/tests/baselines/reference/doNotEmitdetachedCommentAtStartOfFunctionBody.symbols
deleted file mode 100644
index a6f8e1514b5..00000000000
--- a/tests/baselines/reference/doNotEmitdetachedCommentAtStartOfFunctionBody.symbols
+++ /dev/null
@@ -1,12 +0,0 @@
-=== tests/cases/compiler/doNotEmitdetachedCommentAtStartOfFunctionBody.ts ===
-function foo() {
->foo : Symbol(foo, Decl(doNotEmitdetachedCommentAtStartOfFunctionBody.ts, 0, 0))
-
- /*
-
- multi line
- comment
- */
-
- return 42;
-}
diff --git a/tests/baselines/reference/doNotEmitdetachedCommentAtStartOfFunctionBody.types b/tests/baselines/reference/doNotEmitdetachedCommentAtStartOfFunctionBody.types
deleted file mode 100644
index 4271584ecbe..00000000000
--- a/tests/baselines/reference/doNotEmitdetachedCommentAtStartOfFunctionBody.types
+++ /dev/null
@@ -1,13 +0,0 @@
-=== tests/cases/compiler/doNotEmitdetachedCommentAtStartOfFunctionBody.ts ===
-function foo() {
->foo : () => number
-
- /*
-
- multi line
- comment
- */
-
- return 42;
->42 : number
-}
diff --git a/tests/baselines/reference/doNotemitTripleSlashComments.js b/tests/baselines/reference/doNotemitTripleSlashComments.js
index a2ae1666498..fe17db54cb1 100644
--- a/tests/baselines/reference/doNotemitTripleSlashComments.js
+++ b/tests/baselines/reference/doNotemitTripleSlashComments.js
@@ -2,16 +2,45 @@
//// [file0.ts]
-
-//// [file2.ts]
+///
+///
+///
+var x = 10;
+
+///
+var y = "hello";
+
+
+///
//// [file1.ts]
///
-///
-///
-var OData: any;
+
+function foo() { }
+
+
+///
+
+
+var z = "world";
+
+//// [file2.ts]
+///
+
+
+/// ====================================
+
+
+function bar() { }
+
+
+
//// [file0.js]
-//// [file2.js]
+var x = 10;
+var y = "hello";
//// [file1.js]
-var OData;
+function foo() { }
+var z = "world";
+//// [file2.js]
+function bar() { }
diff --git a/tests/baselines/reference/doNotemitTripleSlashComments.symbols b/tests/baselines/reference/doNotemitTripleSlashComments.symbols
index 7dfcc026914..36b31842f8b 100644
--- a/tests/baselines/reference/doNotemitTripleSlashComments.symbols
+++ b/tests/baselines/reference/doNotemitTripleSlashComments.symbols
@@ -1,13 +1,40 @@
-=== tests/cases/compiler/file1.ts ===
-///
-///
-///
-var OData: any;
->OData : Symbol(OData, Decl(file1.ts, 3, 3))
+=== tests/cases/compiler/file2.ts ===
+///
+
+
+/// ====================================
+
+
+function bar() { }
+>bar : Symbol(bar, Decl(file2.ts, 0, 0))
+
+
=== tests/cases/compiler/file0.ts ===
-No type information for this code.
-No type information for this code.=== tests/cases/compiler/file2.ts ===
+///
+///
+///
+var x = 10;
+>x : Symbol(x, Decl(file0.ts, 4, 3))
+
+///
+var y = "hello";
+>y : Symbol(y, Decl(file0.ts, 7, 3))
+
+
+///
+
+=== tests/cases/compiler/file1.ts ===
+///
+
+function foo() { }
+>foo : Symbol(foo, Decl(file1.ts, 0, 0))
+
+
+///
+
+
+var z = "world";
+>z : Symbol(z, Decl(file1.ts, 8, 3))
-No type information for this code.
\ No newline at end of file
diff --git a/tests/baselines/reference/doNotemitTripleSlashComments.types b/tests/baselines/reference/doNotemitTripleSlashComments.types
index 51316501655..edebe5687f6 100644
--- a/tests/baselines/reference/doNotemitTripleSlashComments.types
+++ b/tests/baselines/reference/doNotemitTripleSlashComments.types
@@ -1,13 +1,43 @@
-=== tests/cases/compiler/file1.ts ===
-///
-///
-///
-var OData: any;
->OData : any
+=== tests/cases/compiler/file2.ts ===
+///
+
+
+/// ====================================
+
+
+function bar() { }
+>bar : () => void
+
+
=== tests/cases/compiler/file0.ts ===
-No type information for this code.
-No type information for this code.=== tests/cases/compiler/file2.ts ===
+///
+///
+///
+var x = 10;
+>x : number
+>10 : number
+
+///
+var y = "hello";
+>y : string
+>"hello" : string
+
+
+///
+
+=== tests/cases/compiler/file1.ts ===
+///
+
+function foo() { }
+>foo : () => void
+
+
+///
+
+
+var z = "world";
+>z : string
+>"world" : string
-No type information for this code.
\ No newline at end of file
diff --git a/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.js b/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.js
new file mode 100644
index 00000000000..a30fcbf045d
--- /dev/null
+++ b/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.js
@@ -0,0 +1,16 @@
+//// [emitPinnedCommentsOnTopOfFile.ts]
+/*!
+
+ multi line
+ comment
+*/
+
+var x = 10;
+
+//// [emitPinnedCommentsOnTopOfFile.js]
+/*!
+
+ multi line
+ comment
+*/
+var x = 10;
diff --git a/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.symbols b/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.symbols
new file mode 100644
index 00000000000..c9eb5905303
--- /dev/null
+++ b/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.symbols
@@ -0,0 +1,10 @@
+=== tests/cases/compiler/emitPinnedCommentsOnTopOfFile.ts ===
+/*!
+
+ multi line
+ comment
+*/
+
+var x = 10;
+>x : Symbol(x, Decl(emitPinnedCommentsOnTopOfFile.ts, 6, 3))
+
diff --git a/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.types b/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.types
new file mode 100644
index 00000000000..0ada89e2802
--- /dev/null
+++ b/tests/baselines/reference/emitPinnedCommentsOnTopOfFile.types
@@ -0,0 +1,11 @@
+=== tests/cases/compiler/emitPinnedCommentsOnTopOfFile.ts ===
+/*!
+
+ multi line
+ comment
+*/
+
+var x = 10;
+>x : number
+>10 : number
+
diff --git a/tests/cases/compiler/doNotEmitDetachedComments.ts b/tests/cases/compiler/doNotEmitDetachedComments.ts
new file mode 100644
index 00000000000..412dbeac19b
--- /dev/null
+++ b/tests/cases/compiler/doNotEmitDetachedComments.ts
@@ -0,0 +1,27 @@
+// @comments: false
+/*
+
+ multi line
+ comment
+*/
+
+var x = 10;
+
+// Single Line comment
+
+function foo() { }
+
+
+/*
+ multi-line comment
+
+*/
+
+
+//========================
+
+
+function bar() { }
+
+
+//========================
diff --git a/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfConstructor.ts b/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfConstructor.ts
new file mode 100644
index 00000000000..1ea96993a5e
--- /dev/null
+++ b/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfConstructor.ts
@@ -0,0 +1,38 @@
+// @comments: false
+class A {
+ constructor() {
+ // Single Line Comment
+
+ var x = 10;
+ }
+}
+
+class B {
+ constructor() {
+ /*
+ Multi-line comment
+ */
+
+ var y = 10;
+ }
+}
+
+class C {
+ constructor() {
+ // Single Line Comment with more than one blank line
+
+
+ var x = 10;
+ }
+}
+
+class D {
+ constructor() {
+ /*
+ Multi-line comment with more than one blank line
+ */
+
+
+ var y = 10;
+ }
+}
\ No newline at end of file
diff --git a/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts b/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts
new file mode 100644
index 00000000000..31adbc18de8
--- /dev/null
+++ b/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfFunctionBody.ts
@@ -0,0 +1,33 @@
+// @comments: false
+function foo1() {
+ // Single line comment
+
+ return 42;
+}
+
+function foo2() {
+ /*
+
+ multi line
+ comment
+ */
+
+ return 42;
+}
+
+function foo3() {
+ // Single line comment with more than one blank line
+
+
+ return 42;
+}
+
+function foo4() {
+ /*
+
+ multi line comment with more than one blank line
+ */
+
+ return 42;
+}
+
diff --git a/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts b/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts
new file mode 100644
index 00000000000..c6a9cfc9e25
--- /dev/null
+++ b/tests/cases/compiler/doNotEmitDetachedCommentsAtStartOfLambdaFunction.ts
@@ -0,0 +1,30 @@
+// @comments: false
+() => {
+ // Single line comment
+
+ return 0;
+}
+
+() => {
+ /*
+ multi-line comment
+ */
+
+ return 0;
+}
+
+() => {
+ // Single line comment with more than one blank line
+
+
+ return 0;
+}
+
+() => {
+ /*
+ multi-line comment with more than one blank line
+ */
+
+
+ return 0;
+}
diff --git a/tests/cases/compiler/doNotEmitTripleSlashCommentsInAmbientDeclaration.ts b/tests/cases/compiler/doNotEmitTripleSlashCommentsInAmbientDeclaration.ts
index 99f6a292342..7075c9e3b30 100644
--- a/tests/cases/compiler/doNotEmitTripleSlashCommentsInAmbientDeclaration.ts
+++ b/tests/cases/compiler/doNotEmitTripleSlashCommentsInAmbientDeclaration.ts
@@ -1,8 +1,15 @@
// @comments: false
// @Filename: file0.ts
+///
+class C {
+ ///
+ public foo(x: string, y: any)
+ public foo(x: string, y: number) { }
+}
// @Filename: file1.ts
+var x = 10;
///
declare var OData: any;
\ No newline at end of file
diff --git a/tests/cases/compiler/doNotEmitTripleSlashCommentsInEmptyFile.ts b/tests/cases/compiler/doNotEmitTripleSlashCommentsInEmptyFile.ts
index 41ca8dcab22..047510e2ec9 100644
--- a/tests/cases/compiler/doNotEmitTripleSlashCommentsInEmptyFile.ts
+++ b/tests/cases/compiler/doNotEmitTripleSlashCommentsInEmptyFile.ts
@@ -2,9 +2,9 @@
// @Filename: file0.ts
-// @Filename: file2.ts
-
// @Filename: file1.ts
+
+// @Filename: file2.ts
///
-///
+///
///
\ No newline at end of file
diff --git a/tests/cases/compiler/doNotEmitTripleSlashCommentsInTheMiddle.ts b/tests/cases/compiler/doNotEmitTripleSlashCommentsInTheMiddle.ts
deleted file mode 100644
index a0aeecd07f5..00000000000
--- a/tests/cases/compiler/doNotEmitTripleSlashCommentsInTheMiddle.ts
+++ /dev/null
@@ -1,9 +0,0 @@
-// @comments: false
-
-// @Filename: 0.ts
-
-// @filename: 1.ts
-///
-var x = 10;
-///
-var y = 1000;
\ No newline at end of file
diff --git a/tests/cases/compiler/doNotEmitdetachedCommentAtStartOfFunctionBody.ts b/tests/cases/compiler/doNotEmitdetachedCommentAtStartOfFunctionBody.ts
deleted file mode 100644
index 3d99de36d0a..00000000000
--- a/tests/cases/compiler/doNotEmitdetachedCommentAtStartOfFunctionBody.ts
+++ /dev/null
@@ -1,10 +0,0 @@
-// @comments: false
-function foo() {
- /*
-
- multi line
- comment
- */
-
- return 42;
-}
\ No newline at end of file
diff --git a/tests/cases/compiler/doNotemitTripleSlashComments.ts b/tests/cases/compiler/doNotemitTripleSlashComments.ts
index e89586acfa0..f3b90662159 100644
--- a/tests/cases/compiler/doNotemitTripleSlashComments.ts
+++ b/tests/cases/compiler/doNotemitTripleSlashComments.ts
@@ -1,11 +1,35 @@
// @comments: false
// @Filename: file0.ts
+///
+///
+///
+var x = 10;
-// @Filename: file2.ts
+///
+var y = "hello";
+
+
+///
// @Filename: file1.ts
///
-///
-///
-var OData: any;
\ No newline at end of file
+
+function foo() { }
+
+
+///
+
+
+var z = "world";
+
+// @Filename: file2.ts
+///
+
+
+/// ====================================
+
+
+function bar() { }
+
+
diff --git a/tests/cases/compiler/emitPinnedCommentsOnTopOfFile.ts b/tests/cases/compiler/emitPinnedCommentsOnTopOfFile.ts
new file mode 100644
index 00000000000..bbe6c400601
--- /dev/null
+++ b/tests/cases/compiler/emitPinnedCommentsOnTopOfFile.ts
@@ -0,0 +1,8 @@
+// @comments: false
+/*!
+
+ multi line
+ comment
+*/
+
+var x = 10;
\ No newline at end of file