[SR-14526] Improve diagnostic on trying to call @usableFromInlinable method of internal protocol from @inlinable context #56878
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
compiler
The Swift compiler in itself
diagnostics QoI
Bug: Diagnostics Quality of Implementation
type checker
Area → compiler: Semantic analysis
Attachment: Download
Environment
Tested with Xcode 12.5 Beta 3 and swift-DEVELOPMENT-SNAPSHOT-2021-04-16-a
Additional Detail from JIRA
md5: f55cec726812def89e1e0a8c7f35f382
Issue Description:
When calling an internal method which is marked with @usableFromInline inside a public @inlinable method but the Type on which the method is defined is internal and not marked with @usableFromInline, the compiler complains rightfully but gives an unhelpful error message.
Example code:
Error message: Instance method 'internalMethod()' is not '@usableFromInline' or public
``
The compiler should instead state that the problem is the protocol and not the method e.g.:
Protocol 'InternalProtocol' is internal and cannot be referenced from an '@inlinable' function
Protocol 'InternalProtocol' is not '@usableFromInline' or public
Example Project:
usableFromInline.zip
The text was updated successfully, but these errors were encountered: