Merge branch 'contextSensitiveIsRelatedTo' into abstract-classes2

This commit is contained in:
Arthur Ozga 2015-06-29 15:09:14 -07:00
commit b445f90eb9
2 changed files with 12 additions and 9 deletions

View file

@ -4329,7 +4329,7 @@ namespace ts {
* @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.
*
* 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 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.
@ -4388,6 +4388,7 @@ namespace ts {
// Ternary.False if they are not related.
function isRelatedTo(source: Type, target: Type, reportErrors?: boolean, headMessage?: DiagnosticMessage): 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
if (source === target) return Ternary.True;
if (relation !== identityRelation) {

View file

@ -2,17 +2,19 @@
/* @internal */
namespace ts {
// Ternary values are defined such that
// x & y is False if either x or y is False.
// x & y is Maybe if either x or y is Maybe, but neither x or y is False.
// x & y is True if both x and y are True.
// x | y is False if both x and y are False.
// 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.
/**
* Ternary values are defined such that
* x & y is False if either x or y is False.
* x & y is Maybe if either x or y is Maybe, but neither x or y is False.
* x & y is True if both x and y are True.
* x | y is False if both x and y are False.
* 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 {
False = 0,
Maybe = 1,
True = -1
True = -1
}
export function createFileMap<T>(getCanonicalFileName: (fileName: string) => string): FileMap<T> {