Skip to content

Commit d0506e1

Browse files
authored
Merge pull request #77237 from tshortli/fix-resilience-diagnostic
Sema: Correct the decl kind in a resilience diagnostic
2 parents f4bea5f + ac8aec3 commit d0506e1

8 files changed

+15
-15
lines changed

lib/Sema/ResilienceDiagnostics.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -300,7 +300,7 @@ static bool diagnoseValueDeclRefExportability(SourceLoc loc, const ValueDecl *D,
300300
static_cast<unsigned>(originKind))
301301
.limitBehavior(limit);
302302

303-
D->diagnose(diag::kind_declared_here, DescriptiveDeclKind::Type);
303+
D->diagnose(diag::kind_declared_here, D->getDescriptiveKind());
304304
} else {
305305
// Only implicitly imported decls should be reported as a warning,
306306
// and only for language versions below Swift 6.

test/SPI/local_spi_decls.swift

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,13 @@
1414
@_spi() public func emptyParensSPI() {} // expected-error {{expected an SPI identifier as subject of the '@_spi' attribute}}
1515
@_spi(set) public func keywordSPI() {} // expected-error {{expected an SPI identifier as subject of the '@_spi' attribute}}
1616

17-
@_spi(S) public class SPIClass { // expected-note 6 {{type declared here}}
17+
@_spi(S) public class SPIClass { // expected-note 6 {{class declared here}}
1818
public init() {}
1919
}
2020
class InternalClass {} // expected-note 2 {{type declared here}}
2121
private class PrivateClass {} // expected-note 2 {{type declared here}}
2222

23-
@_spi(S) public protocol SPIProtocol {} // expected-note {{type declared here}}
23+
@_spi(S) public protocol SPIProtocol {} // expected-note {{protocol declared here}}
2424

2525
@_spi(S) public func useOfSPITypeOk(_ p0: SPIProtocol, p1: SPIClass) -> SPIClass { fatalError() } // OK
2626
public func useOfSPITypeInvalid() -> SPIClass { fatalError() } // expected-error {{cannot use class 'SPIClass' here; it is SPI}}
@@ -42,7 +42,7 @@ func inlinable() -> SPIClass { // expected-error {{class 'SPIClass' cannot be us
4242
}
4343

4444
@_spi(S) public struct SPIStruct {
45-
// expected-note@-1 {{type declared here}}
45+
// expected-note@-1 {{struct declared here}}
4646
public init() {}
4747
}
4848

test/SPI/spi_enum_element.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ public enum PublicEnum {
3232
}
3333

3434
public struct PublicStruct {}
35-
@_spi(S) public struct SPIStruct {} // expected-note {{type declared here}}
35+
@_spi(S) public struct SPIStruct {} // expected-note {{struct declared here}}
3636

3737
public enum PublicEnumWithPayloads {
3838
case publicCasePublicPayload(_ s: PublicStruct)

test/SPI/spi_global_actor.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
@available(SwiftStdlib 5.1, *)
66
@_spi(Foo)
77
@globalActor
8-
public struct SPIGA { // expected-note {{type declared here}}
8+
public struct SPIGA { // expected-note {{struct declared here}}
99
public actor Actor {}
1010
public static let shared = Actor()
1111
}

test/SPI/spi_members.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ public struct Wrapper<T> {
99

1010
@_spi(Foo)
1111
public class Bar {
12-
// expected-note@-1 16{{type declared here}}
12+
// expected-note@-1 16{{class declared here}}
1313

1414
public init() {}
1515
}

test/Sema/spi-available-context.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
@_spi_available(macOS 10.10, *)
55
@available(iOS 8.0, *)
6-
public protocol MacOSSPIProto {} // expected-note {{type declared here}}
6+
public protocol MacOSSPIProto {} // expected-note {{protocol declared here}}
77

88
@_spi_available(iOS 8.0, *)
99
@available(macOS 10.10, *)

test/Sema/spi-available-local.swift

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
@_spi_available(macOS 10.10, *)
55
@available(iOS 8.0, *)
6-
public class MacOSSPIClass {} // expected-note {{type declared here}}
6+
public class MacOSSPIClass {} // expected-note {{class declared here}}
77

88
@_spi_available(iOS 8.0, *)
99
@available(macOS 10.10, *)

test/Sema/spi-in-decls.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,21 +22,21 @@ extension NormalClass: @retroactive NormalProto {
2222
}
2323

2424
@_spi(X)
25-
public struct BadStruct {} // expected-note 34 {{type declared here}}
25+
public struct BadStruct {} // expected-note 34 {{struct declared here}}
2626
@_spi(X)
27-
public protocol BadProto {} // expected-note 20 {{type declared here}}
27+
public protocol BadProto {} // expected-note 20 {{protocol declared here}}
2828
@_spi(X)
29-
open class BadClass {} // expected-note 2 {{type declared here}}
29+
open class BadClass {} // expected-note 2 {{class declared here}}
3030

3131
@_spi(X)
32-
public struct IntLike: ExpressibleByIntegerLiteral, Equatable { // expected-note {{type declared here}}
32+
public struct IntLike: ExpressibleByIntegerLiteral, Equatable { // expected-note {{struct declared here}}
3333
public init(integerLiteral: Int) {}
3434
}
3535

3636
@_spi(X)
3737
@propertyWrapper
38-
public struct BadWrapper { // expected-note {{type declared here}}
39-
public var wrappedValue: Int // expected-note {{type declared here}}
38+
public struct BadWrapper { // expected-note {{struct declared here}}
39+
public var wrappedValue: Int // expected-note {{property declared here}}
4040
public init(wrappedValue: Int) {
4141
self.wrappedValue = wrappedValue
4242
}

0 commit comments

Comments
 (0)