Files
swift-mirror/test/Sema/discard_module.swift
Michael Gottesman d0938a906f [move-only] Ban resilient noncopyable types.
One can still in resilient frameworks have noncopyable frozen types.

This means that one cannot make a noncopyable:

1. Full resilient public type.
2. @usableFromInline type.

NOTE: One can still use a frozen noncopyable type as a usableFromInline class
field. I validated in the attached tests that we get the correct code
generation.

I also eliminated a small bug in TypeCheckDeclPrimary where we weren't using a
requestified attr check and instead were checking directly.

rdar://111125845
2023-06-21 16:57:44 -07:00

26 lines
1.1 KiB
Swift

// RUN: %empty-directory(%t)
// >> first try when no library evolution is specified
// RUN: %target-swift-frontend -emit-module -o %t/SorryModule.swiftmodule %S/Inputs/discard_module_defining.swift %S/Inputs/discard_module_adjacent.swift
// RUN: %target-typecheck-verify-swift -I %t
// >> now again with library evolution; we expect the same result.
// RUN: %target-swift-frontend -enable-library-evolution -emit-module -o %t/SorryModule.swiftmodule %S/Inputs/discard_module_defining.swift %S/Inputs/discard_module_adjacent.swift -enable-experimental-feature MoveOnlyResilientTypes
// RUN: %target-typecheck-verify-swift -I %t
// "Sorry" is meaningless
import SorryModule
extension Regular {
__consuming func delete() {
// FIXME: rdar://108933330 (cannot define struct deinit with -enable-library-evolution)
// discard self // DISABLED-error {{can only 'discard' from the same module defining type 'Regular'}}
}
}
extension Frozen {
__consuming func delete() {
discard self // expected-error {{can only 'discard' from the same module defining type 'Frozen'}}
}
}