Error type access level not enforced for property getters #79992
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
Given a protocol that has a property getter which throws a typed error, the compiler does not check whether the access level of the error type is compatible with that of the protocol.
Reproduction
Expected behavior
I expected a compiler error telling me that the property cannot be declared public because its thrown error uses an internal type. However, instead the code compiles without error.
If I switch the property to a function, then I get the expected error:
gives "method cannot be declared public because its thrown error uses an internal type".
Environment
Tried with the following:
Xcode 16.1:
swift-driver version: 1.115 Apple Swift version 6.0.2 (swiftlang-6.0.2.1.2 clang-1600.0.26.4)
Target: arm64-apple-macosx15.0
Xcode 16.3 Beta 2:
swift-driver version: 1.120.5 Apple Swift version 6.1 (swiftlang-6.1.0.109.103 clang-1700.0.13.2)
Target: arm64-apple-macosx15.0
Additional information
No response
The text was updated successfully, but these errors were encountered: