File: print_synthesized_extensions_superclass.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 (132 lines) | stat: -rw-r--r-- 4,697 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
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
// RUN: %empty-directory(%t)
// RUN: %target-swift-frontend -emit-module-path %t/print_synthesized_extensions_superclass.swiftmodule -emit-module-doc -emit-module-doc-path %t/print_synthesized_extensions_superclass.swiftdoc %s
// RUN: %target-swift-ide-test -print-module -synthesize-extension -print-interface -no-empty-line-between-members -module-to-print=print_synthesized_extensions_superclass -I %t -source-filename=%s | %FileCheck %s

public class Base {}
public class Middle<T> : Base {}
public class Most : Middle<Int> {}

public protocol P {
  associatedtype T
  associatedtype U
}

public extension P where T : Base {
  func withBase() {}
}

public extension P where T : Middle<U> {
  func withMiddleAbstract() {}
}

public extension P where T : Middle<Int> {
  func withMiddleConcrete() {}
}

public extension P where T : Most {
  func withMost() {}
}

// CHECK-LABEL: public struct S1 : print_synthesized_extensions_superclass.P {
// CHECK-NEXT:    public typealias T = print_synthesized_extensions_superclass.Base
// CHECK-NEXT:    public typealias U = Int
// CHECK-NEXT:    public func withBase()
// CHECk-NEXT:  }

public struct S1 : P {
  public typealias T = Base
  public typealias U = Int
}

// CHECK-LABEL: public struct S2 : print_synthesized_extensions_superclass.P {
// CHECK-NEXT:    public typealias T = print_synthesized_extensions_superclass.Middle<Int>
// CHECK-NEXT:    public typealias U = Int
// CHECK-NEXT:    public func withBase()
// CHECk-NEXT:    public func withMiddleAbstract()
// CHECk-NEXT:    public func withMiddleConcrete()
// CHECk-NEXT:  }

public struct S2 : P {
  public typealias T = Middle<Int>
  public typealias U = Int
}

// CHECK-LABEL: public struct S3 : print_synthesized_extensions_superclass.P {
// CHECK-NEXT:    public typealias T = print_synthesized_extensions_superclass.Middle<String>
// CHECK-NEXT:    public typealias U = String
// CHECK-NEXT:    public func withBase()
// CHECK-NEXT:    public func withMiddleAbstract()
// CHECK-NEXT:  }

public struct S3 : P {
  public typealias T = Middle<String>
  public typealias U = String
}

// CHECK-LABEL: public struct S4 : print_synthesized_extensions_superclass.P {
// CHECK-NEXT:    public typealias T = print_synthesized_extensions_superclass.Most
// CHECK-NEXT:    public typealias U = Int
// CHECK-NEXT:    public func withBase()
// CHECK-NEXT:    public func withMiddleAbstract()
// CHECK-NEXT:    public func withMiddleConcrete()
// CHECK-NEXT:    public func withMost()
// CHECK-NEXT:  }

public struct S4 : P {
  public typealias T = Most
  public typealias U = Int
}

// CHECK-LABEL: public struct S5 : print_synthesized_extensions_superclass.P {
// CHECK-NEXT:   public typealias T = print_synthesized_extensions_superclass.Most
// CHECK-NEXT:   public typealias U = String
// CHECK-NEXT:   public func withBase()
// CHECK-NEXT:   public func withMiddleConcrete()
// CHECK-NEXT:   public func withMost()
// CHECK-NEXT: }

public struct S5 : P {
  public typealias T = Most
  public typealias U = String
}

// CHECK-LABEL: public struct S6<T, U> : print_synthesized_extensions_superclass.P where T : print_synthesized_extensions_superclass.Base {
// CHECK-NEXT:    public func withBase()
// CHECK-NEXT:  }

// CHECK-LABEL: extension S6 where T : print_synthesized_extensions_superclass.Middle<U> {
// CHECK-NEXT:    public func withMiddleAbstract()
// CHECK-NEXT:  }

// CHECK-LABEL: extension S6 where T : print_synthesized_extensions_superclass.Middle<Int> {
// CHECK-NEXT:    public func withMiddleConcrete()
// CHECK-NEXT:  }

// CHECK-LABEL: extension S6 where T : print_synthesized_extensions_superclass.Most {
// CHECK-NEXT:    public func withMost()
// CHECK-NEXT:  }

public struct S6<T, U> : P where T : Base {}

// CHECK-LABEL: public struct S7<T, U> : print_synthesized_extensions_superclass.P where T : print_synthesized_extensions_superclass.Middle<U> {
// CHECK-NEXT:    public func withBase()
// CHECK-NEXT:    public func withMiddleAbstract()
// CHECK-NEXT:  }

// CHECK-LABEL: extension S7 where T : print_synthesized_extensions_superclass.Middle<Int> {
// CHECK-NEXT:    public func withMiddleConcrete()
// CHECK-NEXT:  }

// CHECK-LABEL: extension S7 where T : print_synthesized_extensions_superclass.Most {
// CHECK-NEXT:    public func withMost()
// CHECK-NEXT:  }

public struct S7<T, U> : P where T : Middle<U> {}

// CHECK-LABEL: public struct S8<T, U> : print_synthesized_extensions_superclass.P where T : print_synthesized_extensions_superclass.Most {
// CHECK-NEXT:    public func withBase()
// CHECK-NEXT:    public func withMiddleConcrete()
// CHECK-NEXT:    public func withMost()
// CHECK-NEXT:  }

public struct S8<T, U> : P where T : Most {}