Skip to content

Conversation

@elsh
Copy link
Contributor

@elsh elsh commented Mar 15, 2023

Allow @usableFromInline and @inlinable to package decls
Add tests
Resolves rdar://104617133

This PR allows the following (similar to how the attributes works with internal/public decls):

@usableFromInline package func foo() {}
@inlinable package func bar() { 
    foo() 
}
@inlinable public func baz() { 
    foo() 
}

Copy link
Contributor Author

@elsh elsh Mar 15, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this back (removed in the previous PR); changes to the existing tests in this file are needed to match the original (before the PR)

@elsh
Copy link
Contributor Author

elsh commented Mar 16, 2023

@swift-ci smoke test

Add tests for packgae inline
Add more package acl tests

Resolves rdar://104617133
@elsh
Copy link
Contributor Author

elsh commented Mar 16, 2023

@swift-ci smoke test

@elsh
Copy link
Contributor Author

elsh commented Mar 17, 2023

@swift-ci smoke test

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, I wonder how long that typo was there.

// RUN: not %target-swift-frontend -typecheck %t/Utils.swift -package-name myLib -I %t 2> %t/resultUtils.output
// RUN: %FileCheck %s -input-file %t/resultUtils.output -check-prefix CHECK-UTILS
// CHECK-UTILS: error: class 'PackageKlass' is package and cannot be referenced from an '@inlinable' function
// CHECK-UTILS: let a = PackageKlass()
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the -verify mode and \\ expected-errors to test these? Or maybe move the CHECK lines under the source code raising it if -verify isn't an option? Having the error far from the code makes it hard to follow along.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense; will update the test in the next PR

@elsh elsh merged commit 2bc92a6 into main Mar 17, 2023
@elsh elsh deleted the es-inline branch March 17, 2023 22:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants