Merge branch 'contextSensitiveIsRelatedTo' into abstract-classes2
This commit is contained in:
commit
b445f90eb9
2 changed files with 12 additions and 9 deletions
|
@ -4329,7 +4329,7 @@ namespace ts {
|
||||||
* @param relationFlags Additional information affecting whether the relation holds. Currently used only for distinguishing
|
* @param relationFlags Additional information affecting whether the relation holds. Currently used only for distinguishing
|
||||||
* between a type comparison when extending classes from other comparisons of the constructor types.
|
* between a type comparison when extending classes from other comparisons of the constructor types.
|
||||||
*
|
*
|
||||||
* Caution: checks triggered by these flags should NOT affect the result re
|
* Caution: checks triggered by these flags should NOT affect the result cached.
|
||||||
* @param errorNode The node upon which all errors will be reported, if defined.
|
* @param errorNode The node upon which all errors will be reported, if defined.
|
||||||
* @param headMessage If the error chain should be prepended by a head message, then headMessage will be used.
|
* @param headMessage If the error chain should be prepended by a head message, then headMessage will be used.
|
||||||
* @param containingMessageChain A chain of errors to prepend any new errors found.
|
* @param containingMessageChain A chain of errors to prepend any new errors found.
|
||||||
|
@ -4388,6 +4388,7 @@ namespace ts {
|
||||||
// Ternary.False if they are not related.
|
// Ternary.False if they are not related.
|
||||||
function isRelatedTo(source: Type, target: Type, reportErrors?: boolean, headMessage?: DiagnosticMessage): Ternary {
|
function isRelatedTo(source: Type, target: Type, reportErrors?: boolean, headMessage?: DiagnosticMessage): Ternary {
|
||||||
let result: Ternary;
|
let result: Ternary;
|
||||||
|
let relationFlagCheckResult: Ternary;
|
||||||
// both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases
|
// both types are the same - covers 'they are the same primitive type or both are Any' or the same type parameter cases
|
||||||
if (source === target) return Ternary.True;
|
if (source === target) return Ternary.True;
|
||||||
if (relation !== identityRelation) {
|
if (relation !== identityRelation) {
|
||||||
|
|
|
@ -2,13 +2,15 @@
|
||||||
|
|
||||||
/* @internal */
|
/* @internal */
|
||||||
namespace ts {
|
namespace ts {
|
||||||
// Ternary values are defined such that
|
/**
|
||||||
// x & y is False if either x or y is False.
|
* Ternary values are defined such that
|
||||||
// x & y is Maybe if either x or y is Maybe, but neither x or y is False.
|
* x & y is False if either x or y is False.
|
||||||
// x & y is True if both x and y are True.
|
* x & y is Maybe if either x or y is Maybe, but neither x or y is False.
|
||||||
// x | y is False if both x and y are False.
|
* x & y is True if both x and y are True.
|
||||||
// x | y is Maybe if either x or y is Maybe, but neither x or y is True.
|
* x | y is False if both x and y are False.
|
||||||
// x | y is True if either x or y is True.
|
* x | y is Maybe if either x or y is Maybe, but neither x or y is True.
|
||||||
|
* x | y is True if either x or y is True.
|
||||||
|
*/
|
||||||
export const enum Ternary {
|
export const enum Ternary {
|
||||||
False = 0,
|
False = 0,
|
||||||
Maybe = 1,
|
Maybe = 1,
|
||||||
|
|
Loading…
Reference in a new issue