2
2
// RUN: %target-typecheck-verify-swift -swift-version 4 -enable-testing
3
3
4
4
private func privateFunction( ) { }
5
- // expected-note@-1 2{{global function 'privateFunction()' is not public}}
5
+ // expected-note@-1 2{{global function 'privateFunction()' is not '@usableFromInline' or public}}
6
6
fileprivate func fileprivateFunction( ) { }
7
- // expected-note@-1 2{{global function 'fileprivateFunction()' is not public}}
7
+ // expected-note@-1 2{{global function 'fileprivateFunction()' is not '@usableFromInline' or public}}
8
8
func internalFunction( ) { }
9
- // expected-note@-1 2{{global function 'internalFunction()' is not public}}
10
- @usableFromInline func versionedFunction( ) { }
11
- // expected-note@-1 4{{global function 'versionedFunction()' is not public}}
9
+ // expected-note@-1 2{{global function 'internalFunction()' is not '@usableFromInline' or public}}
10
+ @usableFromInline func usableFromInlineFunction( ) { }
12
11
public func publicFunction( ) { }
13
12
14
13
func internalIntFunction( ) -> Int { }
15
- // expected-note@-1 {{global function 'internalIntFunction()' is not public}}
14
+ // expected-note@-1 {{global function 'internalIntFunction()' is not '@usableFromInline' or public}}
16
15
17
16
private func privateFunction2( ) { }
18
17
// expected-note@-1 {{global function 'privateFunction2()' is not '@usableFromInline' or public}}
@@ -31,7 +30,7 @@ func internalFunctionWithDefaultValue(
31
30
32
31
publicFunction ( )
33
32
// OK
34
- versionedFunction ( )
33
+ usableFromInlineFunction ( )
35
34
// OK
36
35
internalFunction ( )
37
36
// OK
@@ -44,16 +43,14 @@ func internalFunctionWithDefaultValue(
44
43
} ( ) ,
45
44
y: Int = internalIntFunction ( ) ) { }
46
45
47
- @usableFromInline func versionedFunctionWithDefaultValue (
46
+ @usableFromInline func usableFromInlineFunctionWithDefaultValue (
48
47
x: Int = {
49
48
struct Nested { }
50
49
// expected-error@-1 {{type 'Nested' cannot be nested inside a default argument value}}
51
50
52
- // FIXME: Some errors below are diagnosed twice
53
-
54
51
publicFunction ( )
55
52
// OK
56
- versionedFunction ( )
53
+ usableFromInlineFunction ( )
57
54
// OK
58
55
internalFunction2 ( )
59
56
// expected-error@-1 {{global function 'internalFunction2()' is internal and cannot be referenced from a default argument value}}
@@ -76,8 +73,7 @@ public func publicFunctionWithDefaultValue(
76
73
77
74
publicFunction ( )
78
75
79
- versionedFunction ( )
80
- // expected-error@-1 {{global function 'versionedFunction()' is internal and cannot be referenced from a default argument value}}
76
+ usableFromInlineFunction ( )
81
77
82
78
internalFunction ( )
83
79
// expected-error@-1 {{global function 'internalFunction()' is internal and cannot be referenced from a default argument value}}
@@ -101,18 +97,16 @@ public class MyClass {
101
97
public func evilCode(
102
98
x: Int = {
103
99
let _ = publicFunction ( )
104
- let _ = versionedFunction ( )
105
- // expected-error@-1 {{global function 'versionedFunction()' is internal and cannot be referenced from a default argument value}}
100
+ let _ = usableFromInlineFunction ( )
106
101
107
102
func localFunction( ) {
108
103
publicFunction ( )
109
- versionedFunction ( )
110
- // expected-error@-1 {{global function 'versionedFunction()' is internal and cannot be referenced from a default argument value}}
104
+ usableFromInlineFunction ( )
111
105
}
112
106
return 0
113
107
} ( ) ) { }
114
108
115
- private func privateIntFunction( ) -> Int { } // expected-note {{global function 'privateIntFunction()' is not public}}
109
+ private func privateIntFunction( ) -> Int { } // expected-note {{global function 'privateIntFunction()' is not '@usableFromInline' or public}}
116
110
117
111
public struct HasSubscript {
118
112
public subscript( x: Int = {
@@ -121,8 +115,7 @@ public struct HasSubscript {
121
115
122
116
publicFunction ( )
123
117
124
- versionedFunction ( )
125
- // expected-error@-1 {{global function 'versionedFunction()' is internal and cannot be referenced from a default argument value}}
118
+ usableFromInlineFunction ( )
126
119
127
120
internalFunction ( )
128
121
// expected-error@-1 {{global function 'internalFunction()' is internal and cannot be referenced from a default argument value}}
0 commit comments