|
| 1 | +=== tests/cases/conformance/types/nonPrimitive/nonPrimitiveConstraintOfIndexAccessType.ts === |
| 2 | +// test for #15371 |
| 3 | +function f<T extends object, P extends keyof T>(s: string, tp: T[P]): void { |
| 4 | +>f : Symbol(f, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 0, 0)) |
| 5 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 11)) |
| 6 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 28)) |
| 7 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 11)) |
| 8 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 48)) |
| 9 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 58)) |
| 10 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 11)) |
| 11 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 28)) |
| 12 | + |
| 13 | + tp = s; |
| 14 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 58)) |
| 15 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 1, 48)) |
| 16 | +} |
| 17 | +function g<T extends null, P extends keyof T>(s: string, tp: T[P]): void { |
| 18 | +>g : Symbol(g, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 3, 1)) |
| 19 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 11)) |
| 20 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 26)) |
| 21 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 11)) |
| 22 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 46)) |
| 23 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 56)) |
| 24 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 11)) |
| 25 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 26)) |
| 26 | + |
| 27 | + tp = s; |
| 28 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 56)) |
| 29 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 4, 46)) |
| 30 | +} |
| 31 | +function h<T extends undefined, P extends keyof T>(s: string, tp: T[P]): void { |
| 32 | +>h : Symbol(h, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 6, 1)) |
| 33 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 11)) |
| 34 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 31)) |
| 35 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 11)) |
| 36 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 51)) |
| 37 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 61)) |
| 38 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 11)) |
| 39 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 31)) |
| 40 | + |
| 41 | + tp = s; |
| 42 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 61)) |
| 43 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 7, 51)) |
| 44 | +} |
| 45 | +function i<T extends void, P extends keyof T>(s: string, tp: T[P]): void { |
| 46 | +>i : Symbol(i, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 9, 1)) |
| 47 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 11)) |
| 48 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 26)) |
| 49 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 11)) |
| 50 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 46)) |
| 51 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 56)) |
| 52 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 11)) |
| 53 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 26)) |
| 54 | + |
| 55 | + tp = s; |
| 56 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 56)) |
| 57 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 10, 46)) |
| 58 | +} |
| 59 | +function j<T extends never, P extends keyof T>(s: string, tp: T[P]): void { |
| 60 | +>j : Symbol(j, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 12, 1)) |
| 61 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 11)) |
| 62 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 27)) |
| 63 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 11)) |
| 64 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 47)) |
| 65 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 57)) |
| 66 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 11)) |
| 67 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 27)) |
| 68 | + |
| 69 | + tp = s; |
| 70 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 57)) |
| 71 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 13, 47)) |
| 72 | +} |
| 73 | +function k<T extends number, P extends keyof T>(s: string, tp: T[P]): void { |
| 74 | +>k : Symbol(k, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 15, 1)) |
| 75 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 11)) |
| 76 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 28)) |
| 77 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 11)) |
| 78 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 48)) |
| 79 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 58)) |
| 80 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 11)) |
| 81 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 28)) |
| 82 | + |
| 83 | + tp = s; |
| 84 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 58)) |
| 85 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 16, 48)) |
| 86 | +} |
| 87 | +function o<T extends string, P extends keyof T>(s: string, tp: T[P]): void { |
| 88 | +>o : Symbol(o, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 18, 1)) |
| 89 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 11)) |
| 90 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 28)) |
| 91 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 11)) |
| 92 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 48)) |
| 93 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 58)) |
| 94 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 11)) |
| 95 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 28)) |
| 96 | + |
| 97 | + tp = s; |
| 98 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 58)) |
| 99 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 19, 48)) |
| 100 | +} |
| 101 | +function l<T extends {}, P extends keyof T>(s: string, tp: T[P]): void { |
| 102 | +>l : Symbol(l, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 21, 1)) |
| 103 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 11)) |
| 104 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 24)) |
| 105 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 11)) |
| 106 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 44)) |
| 107 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 54)) |
| 108 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 11)) |
| 109 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 24)) |
| 110 | + |
| 111 | + tp = s; |
| 112 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 54)) |
| 113 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 22, 44)) |
| 114 | +} |
| 115 | +function m<T extends { a: number }, P extends keyof T>(s: string, tp: T[P]): void { |
| 116 | +>m : Symbol(m, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 24, 1)) |
| 117 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 11)) |
| 118 | +>a : Symbol(a, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 22)) |
| 119 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 35)) |
| 120 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 11)) |
| 121 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 55)) |
| 122 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 65)) |
| 123 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 11)) |
| 124 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 35)) |
| 125 | + |
| 126 | + tp = s; |
| 127 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 65)) |
| 128 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 25, 55)) |
| 129 | +} |
| 130 | +function n<T extends { [s: string]: number }, P extends keyof T>(s: string, tp: T[P]): void { |
| 131 | +>n : Symbol(n, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 27, 1)) |
| 132 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 11)) |
| 133 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 24)) |
| 134 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 45)) |
| 135 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 11)) |
| 136 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 65)) |
| 137 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 75)) |
| 138 | +>T : Symbol(T, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 11)) |
| 139 | +>P : Symbol(P, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 45)) |
| 140 | + |
| 141 | + tp = s; |
| 142 | +>tp : Symbol(tp, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 75)) |
| 143 | +>s : Symbol(s, Decl(nonPrimitiveConstraintOfIndexAccessType.ts, 28, 65)) |
| 144 | +} |
| 145 | + |
0 commit comments