Skip to content

Commit 0f0714f

Browse files
committed
s/must have (internal|public) access/must be declared $1/ in diagnostic.
Thanks, Chris! Swift SVN r19759
1 parent 7decdc3 commit 0f0714f

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed

include/swift/AST/DiagnosticsSema.def

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -524,9 +524,9 @@ ERROR(witness_argument_name_mismatch,sema_tcd,none,
524524
"required by protocol %2 (%3)", (bool, DeclName, Type, DeclName))
525525
ERROR(witness_not_accessible_proto,sema_tcd,none,
526526
"%select{initializer %1|method %1|%select{|setter for }2property %1"
527-
"|subscript%select{| setter}2}0 must have "
528-
"%select{PRIVATE|internal|public}3 access because it matches a "
529-
"requirement in %select{PRIVATE|internal|public}3 protocol %4",
527+
"|subscript%select{| setter}2}0 must be declared "
528+
"%select{PRIVATE|internal|public}3 because it matches a requirement "
529+
"in %select{PRIVATE|internal|public}3 protocol %4",
530530
(RequirementKind, DeclName, bool, Accessibility, DeclName))
531531
ERROR(witness_not_accessible_type,sema_tcd,none,
532532
"%select{initializer %1|method %1|%select{|setter for }2property %1"

test/Sema/accessibility.swift

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,15 @@ private protocol PrivateProto {
1515
}
1616

1717
public struct PublicStruct: PublicProto, InternalProto, PrivateProto {
18-
private func publicReq() {} // expected-error {{method 'publicReq()' must have public access because it matches a requirement in public protocol 'PublicProto'}} {{3-10=public}}
19-
private func internalReq() {} // expected-error {{method 'internalReq()' must have internal access because it matches a requirement in internal protocol 'InternalProto'}} {{3-10=internal}}
18+
private func publicReq() {} // expected-error {{method 'publicReq()' must be declared public because it matches a requirement in public protocol 'PublicProto'}} {{3-10=public}}
19+
private func internalReq() {} // expected-error {{method 'internalReq()' must be declared internal because it matches a requirement in internal protocol 'InternalProto'}} {{3-10=internal}}
2020
private func privateReq() {}
2121
}
2222

2323
// expected-note@+1 + {{type declared here}}
2424
internal struct InternalStruct: PublicProto, InternalProto, PrivateProto {
2525
private func publicReq() {} // expected-error {{method 'publicReq()' must be as accessible as its enclosing type because it matches a requirement in protocol 'PublicProto'}} {{3-10=internal}}
26-
private func internalReq() {} // expected-error {{method 'internalReq()' must have internal access because it matches a requirement in internal protocol 'InternalProto'}} {{3-10=internal}}
26+
private func internalReq() {} // expected-error {{method 'internalReq()' must be declared internal because it matches a requirement in internal protocol 'InternalProto'}} {{3-10=internal}}
2727
private func privateReq() {}
2828
}
2929

@@ -35,7 +35,7 @@ private struct PrivateStruct: PublicProto, InternalProto, PrivateProto {
3535
}
3636

3737
public struct PublicStructDefaultMethods: PublicProto, InternalProto, PrivateProto {
38-
func publicReq() {} // expected-error {{method 'publicReq()' must have public access because it matches a requirement in public protocol 'PublicProto'}} {{3-3=public }}
38+
func publicReq() {} // expected-error {{method 'publicReq()' must be declared public because it matches a requirement in public protocol 'PublicProto'}} {{3-3=public }}
3939
func internalReq() {}
4040
func privateReq() {}
4141
}
@@ -246,17 +246,17 @@ internal protocol InternalMutationOperations {
246246
}
247247

248248
public struct AccessorsControl : InternalMutationOperations {
249-
private var size = 0 // expected-error {{property 'size' must have internal access because it matches a requirement in internal protocol 'InternalMutationOperations'}}
250-
private subscript (Int) -> Int { // expected-error {{subscript must have internal access because it matches a requirement in internal protocol 'InternalMutationOperations'}}
249+
private var size = 0 // expected-error {{property 'size' must be declared internal because it matches a requirement in internal protocol 'InternalMutationOperations'}}
250+
private subscript (Int) -> Int { // expected-error {{subscript must be declared internal because it matches a requirement in internal protocol 'InternalMutationOperations'}}
251251
get { return 42 }
252252
set {}
253253
}
254254
}
255255

256256
public struct PrivateSettersPublic : InternalMutationOperations {
257257
// Please don't change the formatting here; it's a precise fix-it test.
258-
public private(set) var size = 0 // expected-error {{setter for property 'size' must have internal access because it matches a requirement in internal protocol 'InternalMutationOperations'}} {{10-17=internal}}
259-
internal private(set) subscript (Int) -> Int { // expected-error {{subscript setter must have internal access because it matches a requirement in internal protocol 'InternalMutationOperations'}} {{12-25=}}
258+
public private(set) var size = 0 // expected-error {{setter for property 'size' must be declared internal because it matches a requirement in internal protocol 'InternalMutationOperations'}} {{10-17=internal}}
259+
internal private(set) subscript (Int) -> Int { // expected-error {{subscript setter must be declared internal because it matches a requirement in internal protocol 'InternalMutationOperations'}} {{12-25=}}
260260
get { return 42 }
261261
set {}
262262
}

0 commit comments

Comments
 (0)