- Notifications
You must be signed in to change notification settings - Fork 10.5k
/
Copy pathattr_usableFromInline_protocol.swift
47 lines (40 loc) · 2.13 KB
/
attr_usableFromInline_protocol.swift
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
// RUN: %target-typecheck-verify-swift -swift-version 4
// RUN: %target-typecheck-verify-swift -swift-version 4.2
publicprotocolPublicProtoWithReqs{
associatedtypeAssoc
func foo()
}
@usableFromInlinestructUFIAdopter<T>:PublicProtoWithReqs{}
// expected-warning@-1 {{type alias 'Assoc' must be declared '@usableFromInline' because it matches a requirement in protocol 'PublicProtoWithReqs'; this is an error in Swift 5}} {{none}}
// expected-warning@-2 {{instance method 'foo()' must be declared '@usableFromInline' because it matches a requirement in protocol 'PublicProtoWithReqs'; this is an error in Swift 5}} {{none}}
extensionUFIAdopter{
typealiasAssoc=Int
// expected-note@-1 {{'Assoc' declared here}}
func foo(){}
// expected-note@-1 {{'foo()' declared here}}
}
@usableFromInlinestructUFIAdopterAllInOne<T>:PublicProtoWithReqs{
typealiasAssoc=Int
// expected-warning@-1 {{type alias 'Assoc' must be declared '@usableFromInline' because it matches a requirement in protocol 'PublicProtoWithReqs'; this is an error in Swift 5}} {{none}}
func foo(){}
// expected-warning@-1 {{instance method 'foo()' must be declared '@usableFromInline' because it matches a requirement in protocol 'PublicProtoWithReqs'; this is an error in Swift 5}} {{none}}
}
internalstructInternalAdopter<T>:PublicProtoWithReqs{}
extensionInternalAdopter{
typealiasAssoc=Int // okay
func foo(){} // okay
}
@usableFromInlineprotocolUFIProtoWithReqs{
associatedtypeAssoc
func foo()
}
publicstructPublicAdopter<T>:UFIProtoWithReqs{}
// expected-warning@-1 {{type alias 'Assoc' must be declared '@usableFromInline' because it matches a requirement in protocol 'UFIProtoWithReqs'; this is an error in Swift 5}} {{none}}
// expected-warning@-2 {{instance method 'foo()' must be declared '@usableFromInline' because it matches a requirement in protocol 'UFIProtoWithReqs'; this is an error in Swift 5}} {{none}}
extensionPublicAdopter{
typealiasAssoc=Int
// expected-note@-1 {{'Assoc' declared here}}
func foo(){}
// expected-note@-1 {{'foo()' declared here}}
}
extensionInternalAdopter:UFIProtoWithReqs{} // okay