|
1 |
| -// RUN: %target-swift-emit-silgen -module-name main %s -verify | %FileCheck %s |
| 1 | +// RUN: %target-swift-emit-silgen -module-name main %s -verify | %FileCheck %s --check-prefix=FRAGILE |
| 2 | +// RUN: %target-swift-emit-silgen -module-name main %s -verify -enable-library-evolution | %FileCheck %s --check-prefix=RESILIENT |
| 3 | + |
2 | 4 | // SR-9425
|
3 |
| -enum MyState : String { |
| 5 | +public enum MyState : String { |
4 | 6 | case closed = "closed"
|
5 | 7 | case opened = "opened"
|
6 | 8 | }
|
7 | 9 |
|
8 |
| -@inline(never) |
9 |
| -func check_state(_ state : MyState) -> Int { |
10 |
| - // CHECK: function_ref @$s4main7MyStateO21__derived_enum_equalsySbAC_ACtFZ |
| 10 | +// CHECK-LABEL: sil [ossa] @$s4main11check_stateySiAA7MyStateOF : $@convention(thin) (MyState) -> Int { |
| 11 | +public func check_state(_ state : MyState) -> Int { |
| 12 | + // FRAGILE: function_ref @$s4main7MyStateO21__derived_enum_equalsySbAC_ACtFZ |
| 13 | + // RESILIENT: function_ref @$ss2eeoiySbx_xtSYRzSQ8RawValueRpzlF |
11 | 14 | return state == .opened ? 1 : 0
|
12 | 15 | }
|
13 | 16 |
|
14 | 17 | // generic-enum.swift
|
15 |
| -enum GenericMyState<T> : String { |
| 18 | +public enum GenericMyState<T> : String { |
16 | 19 | case closed
|
17 | 20 | case opened
|
18 | 21 | }
|
19 | 22 |
|
20 |
| -@inline(never) |
21 |
| -func check_generic_state(_ state : GenericMyState<Int>) -> Int { |
22 |
| - // CHECK: function_ref @$s4main14GenericMyStateO21__derived_enum_equalsySbACyxG_AEtFZ |
| 23 | +// CHECK-LABEL: sil [ossa] @$s4main19check_generic_stateySiAA14GenericMyStateOySiGF : $@convention(thin) (GenericMyState<Int>) -> Int { |
| 24 | +public func check_generic_state(_ state : GenericMyState<Int>) -> Int { |
| 25 | + // FRAGILE: function_ref @$s4main14GenericMyStateO21__derived_enum_equalsySbACyxG_AEtFZ |
| 26 | + // RESILIENT: function_ref @$ss2eeoiySbx_xtSYRzSQ8RawValueRpzlF |
23 | 27 | return state == .opened ? 1 : 0
|
24 | 28 | }
|
25 | 29 |
|
26 | 30 | // regular-enum.swift
|
27 |
| -enum Regular { |
| 31 | +public enum Regular { |
28 | 32 | case closed
|
29 | 33 | case opened
|
30 | 34 | }
|
31 | 35 |
|
32 |
| -@inline(never) |
33 |
| -func check_regular(_ state : Regular) -> Int { |
34 |
| - // CHECK: function_ref @$s4main7RegularO21__derived_enum_equalsySbAC_ACtFZ |
| 36 | +// CHECK-LABEL: sil [ossa] @$s4main13check_regularySiAA7RegularOF : $@convention(thin) (Regular) -> Int { |
| 37 | +public func check_regular(_ state : Regular) -> Int { |
| 38 | + // FRAGILE: function_ref @$s4main7RegularO21__derived_enum_equalsySbAC_ACtFZ |
| 39 | + // RESILIENT: function_ref @$ss2eeoiySbx_xtSYRzSQ8RawValueRpzlF |
35 | 40 | return state == .closed ? 1 : 0
|
36 | 41 | }
|
37 | 42 |
|
38 | 43 | // string-enum.swift
|
39 |
| -enum Alphabet : String { |
| 44 | +public enum Alphabet : String { |
40 | 45 | case A = "A", B = "B", C = "C", D = "D", E = "E", F = "F", G = "G", H = "H", I = "I", J = "J"
|
41 | 46 | }
|
42 | 47 |
|
43 |
| -@inline(never) |
44 |
| -func check_alphabet(_ state : Alphabet) -> Int { |
45 |
| - // CHECK: function_ref @$s4main8AlphabetO21__derived_enum_equalsySbAC_ACtFZ |
| 48 | +// CHECK-LABEL: sil [ossa] @$s4main14check_alphabetySiAA8AlphabetOF : $@convention(thin) (Alphabet) -> Int { |
| 49 | +public func check_alphabet(_ state : Alphabet) -> Int { |
| 50 | + // FRAGILE: function_ref @$s4main8AlphabetO21__derived_enum_equalsySbAC_ACtFZ |
| 51 | + // RESILIENT: function_ref @$ss2eeoiySbx_xtSYRzSQ8RawValueRpzlF |
46 | 52 | return state == .E ? 1 : 0
|
47 | 53 | }
|
48 | 54 |
|
49 |
| -@inline(never) |
50 |
| -func compareIt(_ state : Alphabet, _ rhs: Alphabet) -> Bool { |
51 |
| - // CHECK: function_ref @$s4main8AlphabetO21__derived_enum_equalsySbAC_ACtFZ |
| 55 | +// CHECK-LABEL: sil [ossa] @$s4main9compareItySbAA8AlphabetO_ADtF : $@convention(thin) (Alphabet, Alphabet) -> Bool { |
| 56 | +public func compareIt(_ state : Alphabet, _ rhs: Alphabet) -> Bool { |
| 57 | + // FRAGILE: function_ref @$s4main8AlphabetO21__derived_enum_equalsySbAC_ACtFZ |
| 58 | + // RESILIENT: function_ref @$ss2eeoiySbx_xtSYRzSQ8RawValueRpzlF |
52 | 59 | return state == rhs
|
53 | 60 | }
|
54 | 61 |
|
55 | 62 | // int-enum.swift
|
56 |
| -enum AlphabetInt : Int { |
| 63 | +public enum AlphabetInt : Int { |
57 | 64 | case A = 10, B = 100, C = 12, D = 456, E = 1, F = 3, G = 77, H = 2, I = 27, J = 42
|
58 | 65 | }
|
59 | 66 |
|
60 |
| -@inline(never) |
61 |
| -func check_alphabet_int(_ state : AlphabetInt) -> Int { |
62 |
| - // CHECK: function_ref @$s4main11AlphabetIntO21__derived_enum_equalsySbAC_ACtFZ |
| 67 | +// CHECK-LABEL: sil [ossa] @$s4main18check_alphabet_intySiAA11AlphabetIntOF : $@convention(thin) (AlphabetInt) -> Int { |
| 68 | +public func check_alphabet_int(_ state : AlphabetInt) -> Int { |
| 69 | + // FRAGILE: function_ref @$s4main11AlphabetIntO21__derived_enum_equalsySbAC_ACtFZ |
| 70 | + // RESILIENT: function_ref @$ss2eeoiySbx_xtSYRzSQ8RawValueRpzlF |
63 | 71 | return state == .E ? 1 : 0
|
64 | 72 | }
|
65 | 73 |
|
66 |
| -@inline(never) |
67 |
| -func compareIt(_ state : AlphabetInt, _ rhs: AlphabetInt) -> Bool { |
68 |
| - // CHECK: function_ref @$s4main11AlphabetIntO21__derived_enum_equalsySbAC_ACtFZ |
| 74 | +// CHECK-LABEL: sil [ossa] @$s4main9compareItySbAA11AlphabetIntO_ADtF : $@convention(thin) (AlphabetInt, AlphabetInt) -> Bool { |
| 75 | +public func compareIt(_ state : AlphabetInt, _ rhs: AlphabetInt) -> Bool { |
| 76 | + // FRAGILE: function_ref @$s4main11AlphabetIntO21__derived_enum_equalsySbAC_ACtFZ |
| 77 | + // RESILIENT: function_ref @$ss2eeoiySbx_xtSYRzSQ8RawValueRpzlF |
69 | 78 | return state == rhs
|
70 | 79 | }
|
0 commit comments