TypeScript/tests/baselines/reference/bestCommonTypeWithContextualTyping.symbols
2015-04-15 16:44:20 -07:00

53 lines
2.4 KiB
Plaintext

=== tests/cases/compiler/bestCommonTypeWithContextualTyping.ts ===
interface Contextual {
>Contextual : Symbol(Contextual, Decl(bestCommonTypeWithContextualTyping.ts, 0, 0))
dummy;
>dummy : Symbol(dummy, Decl(bestCommonTypeWithContextualTyping.ts, 0, 22))
p?: number;
>p : Symbol(p, Decl(bestCommonTypeWithContextualTyping.ts, 1, 10))
}
interface Ellement {
>Ellement : Symbol(Ellement, Decl(bestCommonTypeWithContextualTyping.ts, 3, 1))
dummy;
>dummy : Symbol(dummy, Decl(bestCommonTypeWithContextualTyping.ts, 5, 20))
p: any;
>p : Symbol(p, Decl(bestCommonTypeWithContextualTyping.ts, 6, 10))
}
var e: Ellement;
>e : Symbol(e, Decl(bestCommonTypeWithContextualTyping.ts, 10, 3))
>Ellement : Symbol(Ellement, Decl(bestCommonTypeWithContextualTyping.ts, 3, 1))
// All of these should pass. Neither type is a supertype of the other, but the RHS should
// always use Ellement in these examples (not Contextual). Because Ellement is assignable
// to Contextual, no errors.
var arr: Contextual[] = [e]; // Ellement[]
>arr : Symbol(arr, Decl(bestCommonTypeWithContextualTyping.ts, 15, 3))
>Contextual : Symbol(Contextual, Decl(bestCommonTypeWithContextualTyping.ts, 0, 0))
>e : Symbol(e, Decl(bestCommonTypeWithContextualTyping.ts, 10, 3))
var obj: { [s: string]: Contextual } = { s: e }; // { s: Ellement; [s: string]: Ellement }
>obj : Symbol(obj, Decl(bestCommonTypeWithContextualTyping.ts, 16, 3))
>s : Symbol(s, Decl(bestCommonTypeWithContextualTyping.ts, 16, 12))
>Contextual : Symbol(Contextual, Decl(bestCommonTypeWithContextualTyping.ts, 0, 0))
>s : Symbol(s, Decl(bestCommonTypeWithContextualTyping.ts, 16, 40))
>e : Symbol(e, Decl(bestCommonTypeWithContextualTyping.ts, 10, 3))
var conditional: Contextual = null ? e : e; // Ellement
>conditional : Symbol(conditional, Decl(bestCommonTypeWithContextualTyping.ts, 18, 3))
>Contextual : Symbol(Contextual, Decl(bestCommonTypeWithContextualTyping.ts, 0, 0))
>e : Symbol(e, Decl(bestCommonTypeWithContextualTyping.ts, 10, 3))
>e : Symbol(e, Decl(bestCommonTypeWithContextualTyping.ts, 10, 3))
var contextualOr: Contextual = e || e; // Ellement
>contextualOr : Symbol(contextualOr, Decl(bestCommonTypeWithContextualTyping.ts, 19, 3))
>Contextual : Symbol(Contextual, Decl(bestCommonTypeWithContextualTyping.ts, 0, 0))
>e : Symbol(e, Decl(bestCommonTypeWithContextualTyping.ts, 10, 3))
>e : Symbol(e, Decl(bestCommonTypeWithContextualTyping.ts, 10, 3))