mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Package decls were made to be resilient at the definition site by default. By allowing the attributes to be applied to package decls, we can enable non-resilient access. Resolves rdar://125169361
45 lines
1.1 KiB
Swift
45 lines
1.1 KiB
Swift
// RUN: %target-swift-frontend -typecheck %s -I %t -swift-version 5 -package-name mypkg -verify
|
|
|
|
package struct PkgStruct {
|
|
package var one: Int
|
|
package var two: String
|
|
package func f() {}
|
|
}
|
|
|
|
@frozen
|
|
package struct FrozenPkgStruct {
|
|
package var one: Int
|
|
package var two: String
|
|
package func f() {}
|
|
}
|
|
|
|
@frozen
|
|
@usableFromInline
|
|
package struct FrozenUfiPkgStruct {
|
|
package var one: Int
|
|
package var two: String
|
|
package func f() {}
|
|
}
|
|
|
|
@frozen // expected-error {{'@frozen' attribute can only be applied to '@usableFromInline', package, or public declarations, but 'FrozenInternalStruct' is internal}} {{1-9=}}
|
|
struct FrozenInternalStruct {
|
|
var one: Int
|
|
var two: String
|
|
func f() {}
|
|
}
|
|
|
|
@_fixed_layout
|
|
package class FixedPkgKlass {
|
|
package var one: Int = 1
|
|
package var two: String = ""
|
|
package func f() {}
|
|
}
|
|
|
|
@_fixed_layout // expected-error {{'@_fixed_layout' attribute can only be applied to '@usableFromInline', package, or public declarations, but 'FixedInternalKlass' is internal}} {{1-16=}}
|
|
class FixedInternalKlass {
|
|
var one: Int = 1
|
|
var two: String = ""
|
|
func f() {}
|
|
}
|
|
|