File: assignmentCompatBug3.types

package info (click to toggle)
node-typescript 5.0.4%2Bds1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 459,140 kB
  • sloc: javascript: 1,972,754; makefile: 6; sh: 1
file content (72 lines) | stat: -rw-r--r-- 1,662 bytes parent folder | download | duplicates (5)
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
=== tests/cases/compiler/assignmentCompatBug3.ts ===
function makePoint(x: number, y: number) {
>makePoint : (x: number, y: number) => { readonly x: number; readonly y: number; dist: () => number; }
>x : number
>y : number

    return {
>{        get x() { return x;}, // shouldn't be "void"        get y() { return y;}, // shouldn't be "void"        //x: "yo",        //y: "boo",        dist: function () {			return Math.sqrt(x*x+y*y); // shouldn't be picking up "x" and "y" from the object lit		}	} : { readonly x: number; readonly y: number; dist: () => number; }

        get x() { return x;}, // shouldn't be "void"
>x : number
>x : number

        get y() { return y;}, // shouldn't be "void"
>y : number
>y : number

        //x: "yo",
        //y: "boo",
        dist: function () {
>dist : () => number
>function () {			return Math.sqrt(x*x+y*y); // shouldn't be picking up "x" and "y" from the object lit		} : () => number

			return Math.sqrt(x*x+y*y); // shouldn't be picking up "x" and "y" from the object lit
>Math.sqrt(x*x+y*y) : number
>Math.sqrt : (x: number) => number
>Math : Math
>sqrt : (x: number) => number
>x*x+y*y : number
>x*x : number
>x : number
>x : number
>y*y : number
>y : number
>y : number
		}
	}
}

class C {
>C : C

    get x() {
>x : number

        return 0;
>0 : 0
    }
}

function foo(test: string) { }
>foo : (test: string) => void
>test : string

var x: any;
>x : any

var y: any;
>y : any

foo(x);
>foo(x) : void
>foo : (test: string) => void
>x : any

foo(x + y);
>foo(x + y) : void
>foo : (test: string) => void
>x + y : any
>x : any
>y : any