Files
swift-mirror/test/Availability/spi-available-context.swift
Alexis Laferrière 2d339c1260 Sema: Custom diagnostic for var decls referencing a restricted type
Replace the `here` part of the generic exportability diagnostic for
variables with: `in a property declaration marked public or in a
'@frozen' or '@usableFromInline' context`.

The full diagnostic now looks like:
```
error: cannot use struct 'ImportedType' in a property declaration marked
public or in a '@frozen' or '@usableFromInline' context;
'HiddenDependency' has been imported as implementation-only
```

This should be improved further to support implicitly exported memory
layouts in non-library-evolution and embedded.
2025-10-21 11:30:52 -07:00

24 lines
726 B
Swift

// REQUIRES: OS=macosx
// RUN: %target-typecheck-verify-swift -library-level api
@_spi_available(macOS 10.10, *)
@available(iOS 8.0, *)
public protocol MacOSSPIProto {} // expected-note {{protocol declared here}}
@_spi_available(iOS 8.0, *)
@available(macOS 10.10, *)
public protocol iOSSPIProto {}
@_spi_available(macOS 10.10, *)
@available(iOS 8.0, *)
public class Bar {
public var macos: MacOSSPIProto?
public var ios: iOSSPIProto?
}
@available(macOS 10.10, iOS 8.0, *)
public class Baz {
public var macos: MacOSSPIProto? // expected-error {{cannot use protocol 'MacOSSPIProto' in a property declaration marked public or in a '@frozen' or '@usableFromInline' context; it is SPI}}
public var ios: iOSSPIProto?
}