Skip to content

Fix #7397: Remove error checks for noEmit and out* compiler options combined. #7409

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
Mar 12, 2016
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
19 changes: 1 addition & 18 deletions src/compiler/program.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1746,24 +1746,7 @@ namespace ts {
}
}

if (options.noEmit) {
if (options.out) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "out"));
}

if (options.outFile) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outFile"));
}

if (options.outDir) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "outDir"));
}

if (options.declaration) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "noEmit", "declaration"));
}
}
else if (options.allowJs && options.declaration) {
if (!options.noEmit && options.allowJs && options.declaration) {
programDiagnostics.add(createCompilerDiagnostic(Diagnostics.Option_0_cannot_be_specified_with_option_1, "allowJs", "declaration"));
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

&& !options.noEmit

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@mhegazy That would reflect the old behaviour. But I gave this a thought and I chose to do it this way because:

allowJs is incompatible with declaration. Then why does the compiler try to hide the error when noEmit is true? Maybe I should add && !options.noEmit and let this be discussed somewhere else.

}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/a.ts ===

class c {
>c : Symbol(c, Decl(a.ts, 0, 0))
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/a.ts ===

class c {
>c : c
}

6 changes: 6 additions & 0 deletions tests/baselines/reference/compilerOptionsOutAndNoEmit.symbols
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/a.ts ===

class c {
>c : Symbol(c, Decl(a.ts, 0, 0))
}

6 changes: 6 additions & 0 deletions tests/baselines/reference/compilerOptionsOutAndNoEmit.types
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/a.ts ===

class c {
>c : c
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/a.ts ===

class c {
>c : Symbol(c, Decl(a.ts, 0, 0))
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/a.ts ===

class c {
>c : c
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/a.ts ===

class c {
>c : Symbol(c, Decl(a.ts, 0, 0))
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
=== tests/cases/compiler/a.ts ===

class c {
>c : c
}

6 changes: 6 additions & 0 deletions tests/cases/compiler/compilerOptionsDeclarationAndNoEmit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @declaration: true
// @noEmit: true
// @fileName: a.ts

class c {
}
6 changes: 6 additions & 0 deletions tests/cases/compiler/compilerOptionsOutAndNoEmit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @out: outDir
// @noEmit: true
// @fileName: a.ts

class c {
}
6 changes: 6 additions & 0 deletions tests/cases/compiler/compilerOptionsOutDirAndNoEmit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @outDir: outDir
// @noEmit: true
// @fileName: a.ts

class c {
}
6 changes: 6 additions & 0 deletions tests/cases/compiler/compilerOptionsOutFileAndNoEmit.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
// @outFile: a.js
// @noEmit: true
// @fileName: a.ts

class c {
}