Skip to content

Commit

Permalink
Ignore related info in diagnostic deduplication (#50309)
Browse files Browse the repository at this point in the history
* Ignore related info in diagnostic deduplication

* Add another test
  • Loading branch information
andrewbranch authored Aug 16, 2022
1 parent f24f74e commit 330e33c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/compiler/utilities.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3944,7 +3944,7 @@ namespace ts {
diagnostics = nonFileDiagnostics;
}

insertSorted(diagnostics, diagnostic, compareDiagnostics);
insertSorted(diagnostics, diagnostic, compareDiagnosticsSkipRelatedInformation);
}

function getGlobalDiagnostics(): Diagnostic[] {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,12 @@ tests/cases/conformance/jsx/file.tsx(20,23): error TS2783: 'b' is specified more
tests/cases/conformance/jsx/file.tsx(21,17): error TS2783: 'a' is specified more than once, so this usage will be overwritten.
tests/cases/conformance/jsx/file.tsx(21,23): error TS2783: 'd' is specified more than once, so this usage will be overwritten.
tests/cases/conformance/jsx/file.tsx(22,17): error TS2783: 'a' is specified more than once, so this usage will be overwritten.
tests/cases/conformance/jsx/file.tsx(22,17): error TS2783: 'a' is specified more than once, so this usage will be overwritten.
tests/cases/conformance/jsx/file.tsx(22,23): error TS2783: 'd' is specified more than once, so this usage will be overwritten.


!!! error TS2318: Cannot find global type 'CallableFunction'.
!!! error TS2318: Cannot find global type 'NewableFunction'.
==== tests/cases/conformance/jsx/file.tsx (8 errors) ====
==== tests/cases/conformance/jsx/file.tsx (7 errors) ====
import React = require('react');

interface Props {
Expand Down Expand Up @@ -53,9 +52,6 @@ tests/cases/conformance/jsx/file.tsx(22,23): error TS2783: 'd' is specified more
~~~~~
!!! error TS2783: 'a' is specified more than once, so this usage will be overwritten.
!!! related TS2785 tests/cases/conformance/jsx/file.tsx:22:29: This spread always overwrites this property.
~~~~~
!!! error TS2783: 'a' is specified more than once, so this usage will be overwritten.
!!! related TS2785 tests/cases/conformance/jsx/file.tsx:22:40: This spread always overwrites this property.
~~~~~
!!! error TS2783: 'd' is specified more than once, so this usage will be overwritten.
!!! related TS2785 tests/cases/conformance/jsx/file.tsx:22:40: This spread always overwrites this property.
Expand Down
6 changes: 1 addition & 5 deletions tests/baselines/reference/objectSpreadNegative.errors.txt
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(28,36): error TS111
tests/cases/conformance/types/spread/objectSpreadNegative.ts(28,53): error TS1117: An object literal cannot have multiple properties with the same name.
tests/cases/conformance/types/spread/objectSpreadNegative.ts(32,7): error TS2783: 'b' is specified more than once, so this usage will be overwritten.
tests/cases/conformance/types/spread/objectSpreadNegative.ts(37,7): error TS2783: 'b' is specified more than once, so this usage will be overwritten.
tests/cases/conformance/types/spread/objectSpreadNegative.ts(37,7): error TS2783: 'b' is specified more than once, so this usage will be overwritten.
tests/cases/conformance/types/spread/objectSpreadNegative.ts(39,14): error TS2783: 'b' is specified more than once, so this usage will be overwritten.
tests/cases/conformance/types/spread/objectSpreadNegative.ts(41,53): error TS2783: 'd' is specified more than once, so this usage will be overwritten.
tests/cases/conformance/types/spread/objectSpreadNegative.ts(43,7): error TS2783: 'a' is specified more than once, so this usage will be overwritten.
Expand All @@ -27,7 +26,7 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(69,9): error TS2339
tests/cases/conformance/types/spread/objectSpreadNegative.ts(74,11): error TS2339: Property 'a' does not exist on type '{}'.


==== tests/cases/conformance/types/spread/objectSpreadNegative.ts (23 errors) ====
==== tests/cases/conformance/types/spread/objectSpreadNegative.ts (22 errors) ====
let o = { a: 1, b: 'no' }

/// private propagates
Expand Down Expand Up @@ -91,9 +90,6 @@ tests/cases/conformance/types/spread/objectSpreadNegative.ts(74,11): error TS233
~~~~~~~
!!! error TS2783: 'b' is specified more than once, so this usage will be overwritten.
!!! related TS2785 tests/cases/conformance/types/spread/objectSpreadNegative.ts:37:16: This spread always overwrites this property.
~~~~~~~
!!! error TS2783: 'b' is specified more than once, so this usage will be overwritten.
!!! related TS2785 tests/cases/conformance/types/spread/objectSpreadNegative.ts:37:23: This spread always overwrites this property.
let combinedMid: { a: number, b: string, c: boolean } =
{ ...o3, b: 'ok', ...o4 }
~~~~~~~
Expand Down
8 changes: 8 additions & 0 deletions tests/cases/fourslash/deduplicateErrors.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
/// <reference path="./fourslash.ts" />

////let lololol = 123;
////
////lololo/**/

verify.encodedSemanticClassificationsLength("2020", 3);
verify.numberOfErrorsInCurrentFile(1);
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
goTo.marker();

// Function with bodies can only merge with classes
// Class declaration cannot implement overload list x 2
verify.numberOfErrorsInCurrentFile(4);
// Class declaration cannot implement overload list
verify.numberOfErrorsInCurrentFile(2);

// Shouldn't change the number of errors
edit.insert('return null;');
verify.numberOfErrorsInCurrentFile(4);
verify.numberOfErrorsInCurrentFile(2);

0 comments on commit 330e33c

Please sign in to comment.