File: a.swift

package info (click to toggle)
swiftlang 6.0.3-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 2,519,992 kB
  • sloc: cpp: 9,107,863; ansic: 2,040,022; asm: 1,135,751; python: 296,500; objc: 82,456; f90: 60,502; lisp: 34,951; pascal: 19,946; sh: 18,133; perl: 7,482; ml: 4,937; javascript: 4,117; makefile: 3,840; awk: 3,535; xml: 914; fortran: 619; cs: 573; ruby: 573
file content (84 lines) | stat: -rw-r--r-- 1,496 bytes parent folder | download
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
public struct A {
  var i: Int
}
public struct B {
  var d: Double
}

let a = A(i: 23)
let b = B(d: 2.71)

public func f1<each T>(args: repeat each T) {
  print("break here")
}
 
f1(args: a, b)
 
public func f2<each U, each V>(us: repeat each U, vs: repeat each V) {
  print("break here")
}
 
f2(us: a, vs: b)
 
public func f3<each T>(ts: repeat each T, more_ts: repeat each T) {
  print("break here")
}
 
f3(ts: a, b, more_ts: a, b)

public func f4<each U, each V>(uvs: repeat (each U, each V)) {
  print("break here")
}
 
f4(uvs: (a, b), (a, b))
 
public func f5<each T, U>(ts: repeat (each T, U)) {
  print("break here")
}
 
f5(ts: (a, b), (42, b))

public func f6<each U, each V>(us: repeat each U, more_us: repeat each U, vs: repeat each V) {
  print("break here")
}
 
f6(us: a, more_us: a, vs: b, b)
 
public func f7<each U, each V>(us: repeat each U, vs: repeat each V, more_us: repeat each U, more_vs: repeat each V) {
  print("break here")
}
 
f7(us: a, vs: 1, b, more_us: a, more_vs: 2, b)

struct S<each T> {
    let vals: (repeat each T)

    func f8() {
        print("break here")
    }
}

let s = S<Int, Double>(vals: (23, 2.71))
print("break here")
s.f8()

func f9<each T>(s9: S<repeat each T>) {
    print("break here")
}

f9(s9: s)

func f10<each T>(args: repeat each T) {
  print("break here")
}

func f10_maker<each T>(args: repeat each T) -> () -> () {
  return { f10(args: repeat each args) }
}

func f10_caller() {
  let f10 = f10_maker(args: a, b)
  f10()
}

f10_caller()