Skip to content

[SR-7471] Need to diagnose @usableFromInline stored property with inferred non-@usableFromInline type #50014

@phausler

Description

@phausler
Previous ID SR-7471
Radar rdar://problem/39532028
Original Reporter @phausler
Type Bug
Status Resolved
Resolution Done
Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee @slavapestov
Priority Medium

md5: 54ba0b5368cafb49e35e02f8c2858087

Issue Description:

internal final class _Bar {
    func foo() {
        
    }
    
    @usableFromInline
    func fooCalledFromInline() {
        
    }
}

public struct Bar {
    @usableFromInline
    internal var bar = _Bar()
    public func foo() {
        bar.foo()
    }
    
    @inlinable
    public func inlineFoo() {
        bar.fooCalledFromInline()
    }
}

inlineFoo reports an error (which seems incorrect)

/tmp/inlines/inlines/main.swift:31:13: error: instance method 'fooCalledFromInline()' is internal and cannot be referenced from an '@inlinable' function
        bar.fooCalledFromInline()
            ^
/tmp/inlines/inlines/main.swift:17:10: note: instance method 'fooCalledFromInline()' is not '@usableFromInline' or public
    func fooCalledFromInline() {

Metadata

Metadata

Assignees

Labels

bugA deviation from expected or documented behavior. Also: expected but undesirable behavior.compilerThe Swift compiler itself

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions