diff --git a/src/compiler/checker.ts b/src/compiler/checker.ts index 57603c461ef..df5356e7332 100644 --- a/src/compiler/checker.ts +++ b/src/compiler/checker.ts @@ -4074,8 +4074,8 @@ module ts { } } else if (source.flags & TypeFlags.TypeParameter && sourceOrApparentType.flags & TypeFlags.Union) { - if (result = isRelatedTo(sourceOrApparentType, target, reportStructuralErrors)) { - errorInfo = saveErrorInfo; + errorInfo = saveErrorInfo; + if (result = isRelatedTo(sourceOrApparentType, target, reportErrors)) { return result; } } diff --git a/tests/baselines/reference/typeParameterDiamond3.errors.txt b/tests/baselines/reference/typeParameterDiamond3.errors.txt index 2ef46ec2f8b..abefeb2a2d9 100644 --- a/tests/baselines/reference/typeParameterDiamond3.errors.txt +++ b/tests/baselines/reference/typeParameterDiamond3.errors.txt @@ -1,8 +1,8 @@ tests/cases/compiler/typeParameterDiamond3.ts(8,13): error TS2322: Type 'T | U' is not assignable to type 'Top'. Type 'T' is not assignable to type 'Top'. tests/cases/compiler/typeParameterDiamond3.ts(9,13): error TS2322: Type 'Bottom' is not assignable to type 'T | U'. - Type 'Bottom' is not assignable to type 'U'. - Type 'Top | T | U' is not assignable to type 'U'. + Type 'Top | T | U' is not assignable to type 'T | U'. + Type 'Top' is not assignable to type 'T | U'. Type 'Top' is not assignable to type 'U'. tests/cases/compiler/typeParameterDiamond3.ts(10,13): error TS2322: Type 'Bottom' is not assignable to type 'Top'. Type 'Top | T | U' is not assignable to type 'Top'. @@ -24,8 +24,8 @@ tests/cases/compiler/typeParameterDiamond3.ts(10,13): error TS2322: Type 'Bottom middle = bottom; ~~~~~~ !!! error TS2322: Type 'Bottom' is not assignable to type 'T | U'. -!!! error TS2322: Type 'Bottom' is not assignable to type 'U'. -!!! error TS2322: Type 'Top | T | U' is not assignable to type 'U'. +!!! error TS2322: Type 'Top | T | U' is not assignable to type 'T | U'. +!!! error TS2322: Type 'Top' is not assignable to type 'T | U'. !!! error TS2322: Type 'Top' is not assignable to type 'U'. top = bottom; ~~~