File: mangling_inverse_generics_basic.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 (116 lines) | stat: -rw-r--r-- 3,724 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
// RUN: %empty-directory(%t)
// RUN: %target-swift-emit-silgen %s -module-name test \
// RUN:   -enable-experimental-feature NonescapableTypes \
// RUN:   > %t/test.silgen

// RUN: %FileCheck %s < %t/test.silgen
// RUN: %swift-demangle < %t/test.silgen | %FileCheck %s --check-prefix=DEMANGLED

struct Basic<T: ~Copyable> {
    // DEMANGLED: (extension in test):test.Basic< where A: ~Swift.Copyable>.cali2() -> ()
    // CHECK: $s4test5BasicVAARi_zrlE5cali2yyF
    func cali2() {}
}

extension Basic where T: ~Copyable {
  // DEMANGLED: (extension in test):test.Basic< where A: ~Swift.Copyable>.cali1() -> ()
  // CHECK: $s4test5BasicVAARi_zrlE5cali1yyF
  func cali1() {}
}

extension Basic where T: ~Copyable {
  // Despite being in a noncopyable T extension,
  // 'texas2' adds a Copyable requirement, so it will
  // get mangled as if it were not in the extension.

  // DEMANGLED: test.Basic.texas2() -> ()
  // CHECK: $s4test5BasicV6texas2yyF
  func texas2() where T: Copyable {}
}

extension Basic {
  // DEMANGLED: test.Basic.texas1() -> ()
  // CHECK: @$s4test5BasicV6texas1yyF
  func texas1() {}
}

struct _G_ {}

extension _G_ {
  struct _H_<T: ~Copyable> {
    struct _I_ {
      // DEMANGLED: test._G_._H_._I_.foo() -> ()
      // CHECK: $s4test3_G_V3_H_V3_I_V3fooyyF
      func foo() where T: Copyable {}

      // DEMANGLED: test._G_._H_._I_.foo< where A: ~Swift.Copyable>() -> ()
      // CHECK: $s4test3_G_V3_H_V3_I_V3fooyyRi_zrlF
      func foo() {}
    }
  }
}

extension _G_._H_._I_ {
  // DEMANGLED: test._G_._H_._I_.bar() -> ()
  // CHECK: $s4test3_G_V3_H_V3_I_V3baryyF
  func bar() {}
}

struct Gloop<T: ~Copyable> {}

extension Gloop where T: ~Copyable {
  struct Crash<B: ~Escapable> {
    // DEMANGLED: (extension in test):test.Gloop< where A: ~Swift.Copyable>.Crash.foo< where A1: ~Swift.Escapable>() -> ()
    // CHECK: $s4test5GloopVAARi_zrlE5CrashV3fooyyRi0_d__rlF
    func foo() {}

    // DEMANGLED: test.Gloop.Crash.foo< where A1: ~Swift.Escapable>() -> ()
    // CHECK: $s4test5GloopV5CrashV3fooyyRi0_d__rlF
    func foo() where T: Copyable {}

    // DEMANGLED: (extension in test):test.Gloop< where A: ~Swift.Copyable>.Crash.foo() -> ()
    // CHECK: $s4test5GloopVAARi_zrlE5CrashV3fooyyF
    func foo() where B: Escapable {}

    // DEMANGLED: test.Gloop.Crash.foo() -> ()
    // CHECK: $s4test5GloopV5CrashV3fooyyF
    func foo() where T: Copyable, B: Escapable {}
  }
}

struct X<A: ~Copyable> {
  struct Y<B: ~Copyable> {

    // DEMANGLED: test.X.Y.g() -> ()
    // CHECK: $s4test1XV1YV1gyyF
    func g() where A: Copyable, B: Copyable {}

    // DEMANGLED: (extension in test):test.X.Y< where A1: ~Swift.Copyable>.g() -> ()
    // CHECK: $s4test1XV1YVAARi_d__rlE1gyyF
    func g() where A: Copyable {}

    // DEMANGLED: (extension in test):test.X.Y< where A: ~Swift.Copyable>.g() -> ()
    // CHECK: $s4test1XV1YVAARi_zrlE1gyyF
    func g() where B: Copyable {}

    // DEMANGLED: (extension in test):test.X.Y< where A: ~Swift.Copyable, A1: ~Swift.Copyable>.g() -> ()
    // CHECK: $s4test1XV1YVAARi_zRi_d__rlE1gyyF
    func g() {}
  }
}

struct OverloadComputed<T: ~Copyable> {
  // DEMANGLED: extension in test):test.OverloadComputed< where A: ~Swift.Copyable>.obtain() -> A
  // CHECK: $s4test16OverloadComputedVAARi_zrlE6obtainxyF
  func obtain() -> T { fatalError() }
}
extension OverloadComputed {
  // DEMANGLED: test.OverloadComputed.prop.getter : A
  // CHECK: $s4test16OverloadComputedV4propxvg
  var prop: T { return obtain() }
}
extension OverloadComputed where T: ~Copyable {
  // DEMANGLED: (extension in test):test.OverloadComputed< where A: ~Swift.Copyable>.prop.getter : A
  // CHECK: $s4test16OverloadComputedVAARi_zrlE4propxvg
  var prop: T { return obtain() }
}