|
1 | | -var topLevelDecl : Int = 0 |
| 1 | +var topLevelDecl: Int = 0 |
2 | 2 | 0 |
3 | | -topLevelDecl + 1 // $ type=topLevelDecl:Int |
| 3 | +topLevelDecl + 1 // $ type=topLevelDecl:Int |
4 | 4 |
|
5 | 5 | class C { |
6 | | - var myInt : Int |
| 6 | + var myInt: Int |
7 | 7 | // C.init |
8 | 8 | init(n: Int) { |
9 | | - myInt = n // $ type=n:Int |
| 9 | + myInt = n // $ type=n:Int |
10 | 10 | } |
11 | 11 |
|
12 | 12 | // C.getMyInt |
13 | 13 | func getMyInt() -> Int { |
14 | | - return myInt // $ type=.myInt:Int |
| 14 | + return myInt // $ type=.myInt:Int |
15 | 15 | } |
16 | 16 | } |
17 | 17 |
|
18 | | -class Derived : C { |
| 18 | +class Derived: C { |
19 | 19 | // Derived.init |
20 | 20 | init() { |
21 | | - super.init(n: 0) // $ type=super:C target=C.init |
| 21 | + super.init(n: 0) // $ type=super:C target=C.init |
22 | 22 | } |
23 | 23 |
|
24 | 24 | // Derived.callGetMyInt |
25 | 25 | func callGetMyInt() -> Int { |
26 | | - let x = getMyInt(); // $ type=x:Int target=C.getMyInt |
| 26 | + let x = getMyInt() // $ type=x:Int target=C.getMyInt |
27 | 27 | return x |
28 | 28 | } |
29 | 29 | } |
30 | 30 |
|
31 | 31 | class Generic<T> { |
32 | | - var value : T |
| 32 | + var value: T |
33 | 33 | // Generic.init |
34 | 34 | init(v: T) { |
35 | | - value = v // $ type=v:T |
| 35 | + value = v // $ type=v:T |
36 | 36 | } |
37 | 37 |
|
38 | 38 | // Generic.getValue |
39 | 39 | func getValue() -> T { |
40 | | - return value // $ type=.value:T |
| 40 | + return value // $ type=.value:T |
41 | 41 | } |
42 | 42 | } |
43 | 43 |
|
44 | | -class GenericDerived : Generic<Int> { |
| 44 | +class GenericDerived: Generic<Int> { |
45 | 45 | // GenericDerived.init |
46 | 46 | init() { |
47 | | - super.init(v: 0) // $ type=super@Generic<T>:Int target=Generic.init |
| 47 | + super.init(v: 0) // $ type=super@Generic<T>:Int target=Generic.init |
48 | 48 | } |
49 | 49 | } |
50 | 50 |
|
51 | 51 | func testGeneric() { |
52 | | - let g = Generic(v: 42) // $ type=g@Generic<T>:Int target=Generic.init |
53 | | - let x = g.getValue() // $ type=x:Int target=Generic.getValue |
| 52 | + let g = Generic(v: 42) // $ type=g@Generic<T>:Int target=Generic.init |
| 53 | + let x = g.getValue() // $ type=x:Int target=Generic.getValue |
54 | 54 |
|
55 | | - let gd = GenericDerived() // $ type=gd:GenericDerived target=GenericDerived.init |
56 | | - let y = gd.getValue() // $ type=y:Int target=Generic.getValue |
| 55 | + let gd = GenericDerived() // $ type=gd:GenericDerived target=GenericDerived.init |
| 56 | + let y = gd.getValue() // $ type=y:Int target=Generic.getValue |
57 | 57 | } |
58 | 58 |
|
59 | 59 | // --- Extensions --- |
60 | 60 |
|
61 | 61 | extension C { |
62 | 62 | // C.doubled |
63 | 63 | func doubled() -> Int { |
64 | | - return myInt * 2 // $ type=.myInt:Int |
| 64 | + return myInt * 2 // $ type=.myInt:Int |
65 | 65 | } |
66 | 66 | } |
67 | 67 |
|
68 | 68 | func testExtension() { |
69 | | - let obj = C(n: 10) // $ target=C.init |
70 | | - let d = obj.doubled() // $ type=d:Int target=C.doubled |
| 69 | + let obj = C(n: 10) // $ target=C.init |
| 70 | + let d = obj.doubled() // $ type=d:Int target=C.doubled |
71 | 71 | } |
0 commit comments