135 lines
5.1 KiB
Plaintext
135 lines
5.1 KiB
Plaintext
=== tests/cases/conformance/types/mapped/mappedTypes3.ts ===
|
|
class Box<P> {
|
|
>Box : Symbol(Box, Decl(mappedTypes3.ts, 0, 0))
|
|
>P : Symbol(P, Decl(mappedTypes3.ts, 0, 10))
|
|
|
|
value: P;
|
|
>value : Symbol(Box.value, Decl(mappedTypes3.ts, 0, 14))
|
|
>P : Symbol(P, Decl(mappedTypes3.ts, 0, 10))
|
|
}
|
|
|
|
type Boxified<T> = {
|
|
>Boxified : Symbol(Boxified, Decl(mappedTypes3.ts, 2, 1))
|
|
>T : Symbol(T, Decl(mappedTypes3.ts, 4, 14))
|
|
|
|
[K in keyof T]: Box<T[K]>;
|
|
>K : Symbol(K, Decl(mappedTypes3.ts, 5, 5))
|
|
>T : Symbol(T, Decl(mappedTypes3.ts, 4, 14))
|
|
>Box : Symbol(Box, Decl(mappedTypes3.ts, 0, 0))
|
|
>T : Symbol(T, Decl(mappedTypes3.ts, 4, 14))
|
|
>K : Symbol(K, Decl(mappedTypes3.ts, 5, 5))
|
|
}
|
|
|
|
declare function boxify<T>(obj: T): Boxified<T>;
|
|
>boxify : Symbol(boxify, Decl(mappedTypes3.ts, 6, 1))
|
|
>T : Symbol(T, Decl(mappedTypes3.ts, 8, 24))
|
|
>obj : Symbol(obj, Decl(mappedTypes3.ts, 8, 27))
|
|
>T : Symbol(T, Decl(mappedTypes3.ts, 8, 24))
|
|
>Boxified : Symbol(Boxified, Decl(mappedTypes3.ts, 2, 1))
|
|
>T : Symbol(T, Decl(mappedTypes3.ts, 8, 24))
|
|
|
|
declare function unboxify<T>(obj: Boxified<T>): T;
|
|
>unboxify : Symbol(unboxify, Decl(mappedTypes3.ts, 8, 48))
|
|
>T : Symbol(T, Decl(mappedTypes3.ts, 9, 26))
|
|
>obj : Symbol(obj, Decl(mappedTypes3.ts, 9, 29))
|
|
>Boxified : Symbol(Boxified, Decl(mappedTypes3.ts, 2, 1))
|
|
>T : Symbol(T, Decl(mappedTypes3.ts, 9, 26))
|
|
>T : Symbol(T, Decl(mappedTypes3.ts, 9, 26))
|
|
|
|
interface Bacon {
|
|
>Bacon : Symbol(Bacon, Decl(mappedTypes3.ts, 9, 50))
|
|
|
|
isPerfect: boolean;
|
|
>isPerfect : Symbol(Bacon.isPerfect, Decl(mappedTypes3.ts, 11, 17))
|
|
|
|
weight: number;
|
|
>weight : Symbol(Bacon.weight, Decl(mappedTypes3.ts, 12, 23))
|
|
}
|
|
|
|
interface BoxifiedBacon {
|
|
>BoxifiedBacon : Symbol(BoxifiedBacon, Decl(mappedTypes3.ts, 14, 1))
|
|
|
|
isPerfect: Box<boolean>;
|
|
>isPerfect : Symbol(BoxifiedBacon.isPerfect, Decl(mappedTypes3.ts, 16, 25))
|
|
>Box : Symbol(Box, Decl(mappedTypes3.ts, 0, 0))
|
|
|
|
weight: Box<number>;
|
|
>weight : Symbol(BoxifiedBacon.weight, Decl(mappedTypes3.ts, 17, 28))
|
|
>Box : Symbol(Box, Decl(mappedTypes3.ts, 0, 0))
|
|
}
|
|
|
|
function f1(b: Bacon) {
|
|
>f1 : Symbol(f1, Decl(mappedTypes3.ts, 19, 1))
|
|
>b : Symbol(b, Decl(mappedTypes3.ts, 21, 12))
|
|
>Bacon : Symbol(Bacon, Decl(mappedTypes3.ts, 9, 50))
|
|
|
|
let bb = boxify(b);
|
|
>bb : Symbol(bb, Decl(mappedTypes3.ts, 22, 7))
|
|
>boxify : Symbol(boxify, Decl(mappedTypes3.ts, 6, 1))
|
|
>b : Symbol(b, Decl(mappedTypes3.ts, 21, 12))
|
|
|
|
let isPerfect = bb.isPerfect.value;
|
|
>isPerfect : Symbol(isPerfect, Decl(mappedTypes3.ts, 23, 7))
|
|
>bb.isPerfect.value : Symbol(Box.value, Decl(mappedTypes3.ts, 0, 14))
|
|
>bb.isPerfect : Symbol(isPerfect, Decl(mappedTypes3.ts, 11, 17))
|
|
>bb : Symbol(bb, Decl(mappedTypes3.ts, 22, 7))
|
|
>isPerfect : Symbol(isPerfect, Decl(mappedTypes3.ts, 11, 17))
|
|
>value : Symbol(Box.value, Decl(mappedTypes3.ts, 0, 14))
|
|
|
|
let weight = bb.weight.value;
|
|
>weight : Symbol(weight, Decl(mappedTypes3.ts, 24, 7))
|
|
>bb.weight.value : Symbol(Box.value, Decl(mappedTypes3.ts, 0, 14))
|
|
>bb.weight : Symbol(weight, Decl(mappedTypes3.ts, 12, 23))
|
|
>bb : Symbol(bb, Decl(mappedTypes3.ts, 22, 7))
|
|
>weight : Symbol(weight, Decl(mappedTypes3.ts, 12, 23))
|
|
>value : Symbol(Box.value, Decl(mappedTypes3.ts, 0, 14))
|
|
}
|
|
|
|
function f2(bb: Boxified<Bacon>) {
|
|
>f2 : Symbol(f2, Decl(mappedTypes3.ts, 25, 1))
|
|
>bb : Symbol(bb, Decl(mappedTypes3.ts, 27, 12))
|
|
>Boxified : Symbol(Boxified, Decl(mappedTypes3.ts, 2, 1))
|
|
>Bacon : Symbol(Bacon, Decl(mappedTypes3.ts, 9, 50))
|
|
|
|
let b = unboxify(bb); // Infer Bacon for T
|
|
>b : Symbol(b, Decl(mappedTypes3.ts, 28, 7))
|
|
>unboxify : Symbol(unboxify, Decl(mappedTypes3.ts, 8, 48))
|
|
>bb : Symbol(bb, Decl(mappedTypes3.ts, 27, 12))
|
|
|
|
let bool = b.isPerfect;
|
|
>bool : Symbol(bool, Decl(mappedTypes3.ts, 29, 7))
|
|
>b.isPerfect : Symbol(Bacon.isPerfect, Decl(mappedTypes3.ts, 11, 17))
|
|
>b : Symbol(b, Decl(mappedTypes3.ts, 28, 7))
|
|
>isPerfect : Symbol(Bacon.isPerfect, Decl(mappedTypes3.ts, 11, 17))
|
|
|
|
let weight = b.weight;
|
|
>weight : Symbol(weight, Decl(mappedTypes3.ts, 30, 7))
|
|
>b.weight : Symbol(Bacon.weight, Decl(mappedTypes3.ts, 12, 23))
|
|
>b : Symbol(b, Decl(mappedTypes3.ts, 28, 7))
|
|
>weight : Symbol(Bacon.weight, Decl(mappedTypes3.ts, 12, 23))
|
|
}
|
|
|
|
function f3(bb: BoxifiedBacon) {
|
|
>f3 : Symbol(f3, Decl(mappedTypes3.ts, 31, 1))
|
|
>bb : Symbol(bb, Decl(mappedTypes3.ts, 33, 12))
|
|
>BoxifiedBacon : Symbol(BoxifiedBacon, Decl(mappedTypes3.ts, 14, 1))
|
|
|
|
let b = unboxify<Bacon>(bb); // Explicit type parameter required
|
|
>b : Symbol(b, Decl(mappedTypes3.ts, 34, 7))
|
|
>unboxify : Symbol(unboxify, Decl(mappedTypes3.ts, 8, 48))
|
|
>Bacon : Symbol(Bacon, Decl(mappedTypes3.ts, 9, 50))
|
|
>bb : Symbol(bb, Decl(mappedTypes3.ts, 33, 12))
|
|
|
|
let bool = b.isPerfect;
|
|
>bool : Symbol(bool, Decl(mappedTypes3.ts, 35, 7))
|
|
>b.isPerfect : Symbol(Bacon.isPerfect, Decl(mappedTypes3.ts, 11, 17))
|
|
>b : Symbol(b, Decl(mappedTypes3.ts, 34, 7))
|
|
>isPerfect : Symbol(Bacon.isPerfect, Decl(mappedTypes3.ts, 11, 17))
|
|
|
|
let weight = bb.weight;
|
|
>weight : Symbol(weight, Decl(mappedTypes3.ts, 36, 7))
|
|
>bb.weight : Symbol(BoxifiedBacon.weight, Decl(mappedTypes3.ts, 17, 28))
|
|
>bb : Symbol(bb, Decl(mappedTypes3.ts, 33, 12))
|
|
>weight : Symbol(BoxifiedBacon.weight, Decl(mappedTypes3.ts, 17, 28))
|
|
}
|