File: conditionalOperatorWithIdenticalBCT.symbols

package info (click to toggle)
node-typescript 3.3.3333-1
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 324,548 kB
  • sloc: makefile: 6; sh: 3
file content (149 lines) | stat: -rw-r--r-- 8,109 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
=== tests/cases/conformance/expressions/conditonalOperator/conditionalOperatorWithIdenticalBCT.ts ===
//Cond ? Expr1 : Expr2,  Expr1 and Expr2 have identical best common type
class X { propertyX: any; propertyX1: number; propertyX2: string };
>X : Symbol(X, Decl(conditionalOperatorWithIdenticalBCT.ts, 0, 0))
>propertyX : Symbol(X.propertyX, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 9))
>propertyX1 : Symbol(X.propertyX1, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 25))
>propertyX2 : Symbol(X.propertyX2, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 45))

class A extends X { propertyA: number };
>A : Symbol(A, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 67))
>X : Symbol(X, Decl(conditionalOperatorWithIdenticalBCT.ts, 0, 0))
>propertyA : Symbol(A.propertyA, Decl(conditionalOperatorWithIdenticalBCT.ts, 2, 19))

class B extends X { propertyB: string };
>B : Symbol(B, Decl(conditionalOperatorWithIdenticalBCT.ts, 2, 40))
>X : Symbol(X, Decl(conditionalOperatorWithIdenticalBCT.ts, 0, 0))
>propertyB : Symbol(B.propertyB, Decl(conditionalOperatorWithIdenticalBCT.ts, 3, 19))

var x: X;
>x : Symbol(x, Decl(conditionalOperatorWithIdenticalBCT.ts, 5, 3))
>X : Symbol(X, Decl(conditionalOperatorWithIdenticalBCT.ts, 0, 0))

var a: A;
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 6, 3))
>A : Symbol(A, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 67))

var b: B;
>b : Symbol(b, Decl(conditionalOperatorWithIdenticalBCT.ts, 7, 3))
>B : Symbol(B, Decl(conditionalOperatorWithIdenticalBCT.ts, 2, 40))

//Cond ? Expr1 : Expr2,  Expr1 is supertype
//Be Not contextually typed
true ? x : a;
>x : Symbol(x, Decl(conditionalOperatorWithIdenticalBCT.ts, 5, 3))
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 6, 3))

var result1 = true ? x : a;
>result1 : Symbol(result1, Decl(conditionalOperatorWithIdenticalBCT.ts, 12, 3))
>x : Symbol(x, Decl(conditionalOperatorWithIdenticalBCT.ts, 5, 3))
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 6, 3))

//Expr1 and Expr2 are literals
true ? {} : 1;
true ? { a: 1 } : { a: 2, b: 'string' };
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 16, 8))
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 16, 19))
>b : Symbol(b, Decl(conditionalOperatorWithIdenticalBCT.ts, 16, 25))

var result2 = true ? {} : 1;
>result2 : Symbol(result2, Decl(conditionalOperatorWithIdenticalBCT.ts, 17, 3))

var result3 = true ? { a: 1 } : { a: 2, b: 'string' };
>result3 : Symbol(result3, Decl(conditionalOperatorWithIdenticalBCT.ts, 18, 3))
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 18, 22))
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 18, 33))
>b : Symbol(b, Decl(conditionalOperatorWithIdenticalBCT.ts, 18, 39))

//Contextually typed
var resultIsX1: X = true ? x : a;
>resultIsX1 : Symbol(resultIsX1, Decl(conditionalOperatorWithIdenticalBCT.ts, 21, 3))
>X : Symbol(X, Decl(conditionalOperatorWithIdenticalBCT.ts, 0, 0))
>x : Symbol(x, Decl(conditionalOperatorWithIdenticalBCT.ts, 5, 3))
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 6, 3))

var result4: (t: A) => any = true ? (m) => m.propertyX : (n) => n.propertyA;
>result4 : Symbol(result4, Decl(conditionalOperatorWithIdenticalBCT.ts, 22, 3))
>t : Symbol(t, Decl(conditionalOperatorWithIdenticalBCT.ts, 22, 14))
>A : Symbol(A, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 67))
>m : Symbol(m, Decl(conditionalOperatorWithIdenticalBCT.ts, 22, 37))
>m.propertyX : Symbol(X.propertyX, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 9))
>m : Symbol(m, Decl(conditionalOperatorWithIdenticalBCT.ts, 22, 37))
>propertyX : Symbol(X.propertyX, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 9))
>n : Symbol(n, Decl(conditionalOperatorWithIdenticalBCT.ts, 22, 58))
>n.propertyA : Symbol(A.propertyA, Decl(conditionalOperatorWithIdenticalBCT.ts, 2, 19))
>n : Symbol(n, Decl(conditionalOperatorWithIdenticalBCT.ts, 22, 58))
>propertyA : Symbol(A.propertyA, Decl(conditionalOperatorWithIdenticalBCT.ts, 2, 19))

//Cond ? Expr1 : Expr2,  Expr2 is supertype
//Be Not contextually typed
true ? a : x;
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 6, 3))
>x : Symbol(x, Decl(conditionalOperatorWithIdenticalBCT.ts, 5, 3))

var result5 = true ? a : x;
>result5 : Symbol(result5, Decl(conditionalOperatorWithIdenticalBCT.ts, 27, 3))
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 6, 3))
>x : Symbol(x, Decl(conditionalOperatorWithIdenticalBCT.ts, 5, 3))

//Expr1 and Expr2 are literals
true ? 1 : {};
true ? { a: 2, b: 'string' } : { a: 1 };
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 31, 8))
>b : Symbol(b, Decl(conditionalOperatorWithIdenticalBCT.ts, 31, 14))
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 31, 32))

var result6 = true ? 1 : {};
>result6 : Symbol(result6, Decl(conditionalOperatorWithIdenticalBCT.ts, 32, 3))

var result7 = true ? { a: 2, b: 'string' } : { a: 1 };
>result7 : Symbol(result7, Decl(conditionalOperatorWithIdenticalBCT.ts, 33, 3))
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 33, 22))
>b : Symbol(b, Decl(conditionalOperatorWithIdenticalBCT.ts, 33, 28))
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 33, 46))

//Contextually typed
var resultIsX2: X = true ? x : a;
>resultIsX2 : Symbol(resultIsX2, Decl(conditionalOperatorWithIdenticalBCT.ts, 36, 3))
>X : Symbol(X, Decl(conditionalOperatorWithIdenticalBCT.ts, 0, 0))
>x : Symbol(x, Decl(conditionalOperatorWithIdenticalBCT.ts, 5, 3))
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 6, 3))

var result8: (t: A) => any = true ? (m) => m.propertyA : (n) => n.propertyX;
>result8 : Symbol(result8, Decl(conditionalOperatorWithIdenticalBCT.ts, 37, 3))
>t : Symbol(t, Decl(conditionalOperatorWithIdenticalBCT.ts, 37, 14))
>A : Symbol(A, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 67))
>m : Symbol(m, Decl(conditionalOperatorWithIdenticalBCT.ts, 37, 37))
>m.propertyA : Symbol(A.propertyA, Decl(conditionalOperatorWithIdenticalBCT.ts, 2, 19))
>m : Symbol(m, Decl(conditionalOperatorWithIdenticalBCT.ts, 37, 37))
>propertyA : Symbol(A.propertyA, Decl(conditionalOperatorWithIdenticalBCT.ts, 2, 19))
>n : Symbol(n, Decl(conditionalOperatorWithIdenticalBCT.ts, 37, 58))
>n.propertyX : Symbol(X.propertyX, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 9))
>n : Symbol(n, Decl(conditionalOperatorWithIdenticalBCT.ts, 37, 58))
>propertyX : Symbol(X.propertyX, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 9))

//Result = Cond ? Expr1 : Expr2,  Result is supertype
//Contextually typed
var resultIsX3: X = true ? a : b;
>resultIsX3 : Symbol(resultIsX3, Decl(conditionalOperatorWithIdenticalBCT.ts, 41, 3))
>X : Symbol(X, Decl(conditionalOperatorWithIdenticalBCT.ts, 0, 0))
>a : Symbol(a, Decl(conditionalOperatorWithIdenticalBCT.ts, 6, 3))
>b : Symbol(b, Decl(conditionalOperatorWithIdenticalBCT.ts, 7, 3))

var result10: (t: X) => any = true ? (m) => m.propertyX1 : (n) => n.propertyX2;
>result10 : Symbol(result10, Decl(conditionalOperatorWithIdenticalBCT.ts, 42, 3))
>t : Symbol(t, Decl(conditionalOperatorWithIdenticalBCT.ts, 42, 15))
>X : Symbol(X, Decl(conditionalOperatorWithIdenticalBCT.ts, 0, 0))
>m : Symbol(m, Decl(conditionalOperatorWithIdenticalBCT.ts, 42, 38))
>m.propertyX1 : Symbol(X.propertyX1, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 25))
>m : Symbol(m, Decl(conditionalOperatorWithIdenticalBCT.ts, 42, 38))
>propertyX1 : Symbol(X.propertyX1, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 25))
>n : Symbol(n, Decl(conditionalOperatorWithIdenticalBCT.ts, 42, 60))
>n.propertyX2 : Symbol(X.propertyX2, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 45))
>n : Symbol(n, Decl(conditionalOperatorWithIdenticalBCT.ts, 42, 60))
>propertyX2 : Symbol(X.propertyX2, Decl(conditionalOperatorWithIdenticalBCT.ts, 1, 45))

//Expr1 and Expr2 are literals
var result11: any = true ? 1 : 'string';
>result11 : Symbol(result11, Decl(conditionalOperatorWithIdenticalBCT.ts, 45, 3))