Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-8212] Incorrect error message: '@inlinable' attribute can only be applied to public declarations #50744

Open
atrick opened this issue Jul 9, 2018 · 4 comments
Assignees
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

Comments

@atrick
Copy link
Member

atrick commented Jul 9, 2018

Previous ID SR-8212
Radar rdar://problem/41982309
Original Reporter @atrick
Type Bug
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug, DiagnosticsQoI
Assignee @slavapestov
Priority Medium

md5: 004c0037dac16a92c6b7f39936e4fc41

Issue Description:

@inlinable fileprivate func foo() {}

error: '@inlinable' attribute can only be applied to public declarations, but 'foo' is fileprivate

This is somewhat misleading because '@inlinable' also applies to 'internal' declarations.

@atrick
Copy link
Member Author

atrick commented Jul 9, 2018

@swift-ci create.

@slavapestov
Copy link
Member

It’s a bit tricky, because on an internal declaration, @inlinable implies @usableFromInline, but only if all outer scopes are @usableFromInline.

Eg,

class C {
  @inlinable func f() {} // error
}

@usableFromInline class D {
  @inlinable func f() // OK
}

@belkadan
Copy link
Contributor

We should probably have a distinct error message for that case, but okay, that might take it out of being a starter bug.

@omochi
Copy link
Collaborator

omochi commented Apr 17, 2019

Currently this `C.f` can be compiled.
Is there any effect at inlineable without usableFromInline such a `C.f` ?
I think it looks inlineable since compileable but it is never actually.
If it is useless, it should be error with `outer scope must be @usableFromInline`.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
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
Projects
None yet
Development

No branches or pull requests

4 participants