mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Enable MoveOnlyResilientTypes feature.
This commit is contained in:
@@ -107,6 +107,7 @@ LANGUAGE_FEATURE(
|
||||
LANGUAGE_FEATURE(AttachedMacros, 389, "Attached macros", hasSwiftSwiftParser)
|
||||
LANGUAGE_FEATURE(ExtensionMacros, 402, "Extension macros", hasSwiftSwiftParser)
|
||||
LANGUAGE_FEATURE(MoveOnly, 390, "noncopyable types", true)
|
||||
LANGUAGE_FEATURE(MoveOnlyResilientTypes, 390, "non-@frozen noncopyable types with library evolution", true)
|
||||
LANGUAGE_FEATURE(ParameterPacks, 393, "Value and type parameter packs", true)
|
||||
SUPPRESSIBLE_LANGUAGE_FEATURE(LexicalLifetimes, 0, "@_eagerMove/@_noEagerMove/@_lexicalLifetimes annotations", true)
|
||||
LANGUAGE_FEATURE(FreestandingMacros, 397, "freestanding declaration macros", true)
|
||||
@@ -142,7 +143,6 @@ EXPERIMENTAL_FEATURE(NoImplicitCopy, true)
|
||||
EXPERIMENTAL_FEATURE(OldOwnershipOperatorSpellings, true)
|
||||
EXPERIMENTAL_FEATURE(MoveOnlyEnumDeinits, true)
|
||||
EXPERIMENTAL_FEATURE(MoveOnlyTuples, true)
|
||||
EXPERIMENTAL_FEATURE(MoveOnlyResilientTypes, true)
|
||||
EXPERIMENTAL_FEATURE(MoveOnlyPartialConsumption, true)
|
||||
|
||||
EXPERIMENTAL_FEATURE(OneWayClosureParameters, false)
|
||||
|
||||
@@ -2758,12 +2758,6 @@ public:
|
||||
ED->getBaseIdentifier());
|
||||
}
|
||||
}
|
||||
|
||||
if (!ED->getASTContext().LangOpts.hasFeature(
|
||||
Feature::MoveOnlyResilientTypes) &&
|
||||
ED->isResilient()) {
|
||||
ED->diagnose(diag::noncopyable_types_cannot_be_resilient, ED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2804,12 +2798,6 @@ public:
|
||||
diagnoseCopyableTypeContainingMoveOnlyType(SD);
|
||||
|
||||
diagnoseIncompatibleProtocolsForMoveOnlyType(SD);
|
||||
|
||||
if (!SD->getASTContext().LangOpts.hasFeature(
|
||||
Feature::MoveOnlyResilientTypes) &&
|
||||
SD->isResilient() && SD->isNoncopyable()) {
|
||||
SD->diagnose(diag::noncopyable_types_cannot_be_resilient, SD);
|
||||
}
|
||||
}
|
||||
|
||||
/// Check whether the given properties can be @NSManaged in this class.
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-build-swift-dylib(%t/%target-library-name(MoveOnlySplit)) -enable-library-evolution %S/Inputs/moveonly_split_module_source_input.swift -emit-module -emit-module-path %t/MoveOnlySplit.swiftmodule -module-name MoveOnlySplit -DTEST_LIBRARY_EVOLUTION -enable-experimental-feature MoveOnlyResilientTypes
|
||||
// RUN: %target-build-swift-dylib(%t/%target-library-name(MoveOnlySplit)) -enable-library-evolution %S/Inputs/moveonly_split_module_source_input.swift -emit-module -emit-module-path %t/MoveOnlySplit.swiftmodule -module-name MoveOnlySplit -DTEST_LIBRARY_EVOLUTION
|
||||
// RUN: %target-codesign %t/%target-library-name(MoveOnlySplit)
|
||||
|
||||
// RUN: %target-build-swift %s -lMoveOnlySplit -I %t -L %t -o %t/main %target-rpath(%t) -enable-experimental-feature MoveOnlyResilientTypes
|
||||
// RUN: %target-build-swift %s -lMoveOnlySplit -I %t -L %t -o %t/main %target-rpath(%t)
|
||||
// RUN: %target-codesign %t/main
|
||||
// RUN: %target-run %t/main %t/%target-library-name(MoveOnlySplit) | %FileCheck -check-prefix=CHECK-LIBRARY-EVOLUTION %s
|
||||
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library -verify -enable-experimental-feature MoveOnlyResilientTypes
|
||||
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -I %t -enable-experimental-feature MoveOnlyResilientTypes
|
||||
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library -verify
|
||||
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -I %t
|
||||
// RUN: %FileCheck %s < %t/Library.swiftinterface
|
||||
|
||||
// This test makes sure that discard is emitted correctly in the interfaces.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library -enable-experimental-feature MoveOnlyResilientTypes
|
||||
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -I %t -enable-experimental-feature MoveOnlyResilientTypes
|
||||
// RUN: %target-swift-emit-module-interface(%t/Library.swiftinterface) %s -module-name Library
|
||||
// RUN: %target-swift-typecheck-module-from-interface(%t/Library.swiftinterface) -I %t
|
||||
// RUN: %FileCheck %s < %t/Library.swiftinterface
|
||||
|
||||
// this test makes sure that decls containing a move-only type are guarded by the $MoveOnly feature flag
|
||||
|
||||
@@ -5,8 +5,8 @@
|
||||
// RUN: %target-swift-frontend -emit-sil -sil-verify-all -I %t %s > /dev/null
|
||||
|
||||
// >> now again with library evolution; we expect the same result.
|
||||
// RUN: %target-swift-frontend -DSYNTHESIZE_ACCESSORS -enable-library-evolution -enable-experimental-feature MoveOnlyResilientTypes -emit-module -o %t/Hello.swiftmodule %S/Inputs/moveonly_api.swift
|
||||
// RUN: %target-swift-frontend -enable-experimental-feature MoveOnlyResilientTypes -emit-sil -sil-verify-all -I %t %s > /dev/null
|
||||
// RUN: %target-swift-frontend -DSYNTHESIZE_ACCESSORS -enable-library-evolution -emit-module -o %t/Hello.swiftmodule %S/Inputs/moveonly_api.swift
|
||||
// RUN: %target-swift-frontend -emit-sil -sil-verify-all -I %t %s > /dev/null
|
||||
|
||||
// FIXME: ideally this would also try executing the program rather than just generating SIL
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
// RUN: %target-swift-emit-silgen -enable-experimental-feature MoveOnlyPartialConsumption -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyResilientTypes -enable-library-evolution %s | %FileCheck %s
|
||||
// RUN: %target-swift-emit-sil -O -sil-verify-all -enable-experimental-feature MoveOnlyPartialConsumption -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyResilientTypes -enable-library-evolution %s
|
||||
// RUN: %target-swift-emit-silgen -enable-experimental-feature MoveOnlyPartialConsumption -enable-experimental-feature NoImplicitCopy -enable-library-evolution %s | %FileCheck %s
|
||||
// RUN: %target-swift-emit-sil -O -sil-verify-all -enable-experimental-feature MoveOnlyPartialConsumption -enable-experimental-feature NoImplicitCopy -enable-library-evolution %s
|
||||
|
||||
////////////////////////
|
||||
// MARK: Declarations //
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-swift-emit-sil -enable-experimental-feature NoImplicitCopy -sil-verify-all -verify -enable-library-evolution -enable-experimental-feature MoveOnlyResilientTypes %s
|
||||
// RUN: %target-swift-emit-sil -enable-experimental-feature NoImplicitCopy -sil-verify-all -verify -enable-library-evolution %s
|
||||
|
||||
// This test is used to validate that we properly handle library evolution code
|
||||
// until we can get all of the normal moveonly_addresschecker_diagnostics test
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-sil-opt -enable-library-evolution -module-name main -enable-sil-verify-all -sil-move-only-deinit-devirtualization -enable-experimental-feature MoveOnlyClasses -enable-experimental-feature MoveOnlyEnumDeinits -enable-experimental-feature MoveOnlyResilientTypes %s | %FileCheck %s
|
||||
// RUN: %target-sil-opt -enable-library-evolution -module-name main -enable-sil-verify-all -sil-move-only-deinit-devirtualization -enable-experimental-feature MoveOnlyClasses -enable-experimental-feature MoveOnlyEnumDeinits %s | %FileCheck %s
|
||||
|
||||
sil_stage raw
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-swift-frontend -emit-sil -verify -enable-library-evolution -enable-experimental-feature MoveOnlyResilientTypes %s
|
||||
// RUN: %target-swift-frontend -emit-sil -verify -enable-library-evolution %s
|
||||
|
||||
// Verify that call sequences that require reabstracting a noncopyable value
|
||||
// from a loadable representation to an in-memory one are properly allowed by
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// RUN: %target-swift-frontend -enable-experimental-feature MoveOnlyResilientTypes -enable-library-evolution -emit-sil %s | %FileCheck %s
|
||||
// RUN: %target-swift-frontend -enable-library-evolution -emit-sil %s | %FileCheck %s
|
||||
|
||||
public struct ResilientMemberC {}
|
||||
public struct ResilientMemberNC: ~Copyable {}
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
// 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-swift-frontend -enable-library-evolution -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
|
||||
|
||||
// "Sorry" is meaningless
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
// RUN: %target-swift-frontend -typecheck %s -enable-library-evolution -verify
|
||||
|
||||
public struct ResilientStruct : ~Copyable { // expected-error {{noncopyable struct 'ResilientStruct' must be @frozen in library evolution mode; non-@frozen public and @usableFromInline noncopyable types are not supported}}
|
||||
}
|
||||
|
||||
@frozen
|
||||
public struct FrozenStruct : ~Copyable {
|
||||
public init() {}
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
struct UsableFromInlineStruct : ~Copyable { // expected-error {{noncopyable struct 'UsableFromInlineStruct' must be @frozen in library evolution mode; non-@frozen public and @usableFromInline noncopyable types are not supported}}
|
||||
}
|
||||
|
||||
public enum ResilientEnum : ~Copyable { // expected-error {{noncopyable enum 'ResilientEnum' must be @frozen in library evolution mode; non-@frozen public and @usableFromInline noncopyable types are not supported}}
|
||||
}
|
||||
|
||||
@frozen
|
||||
public enum FrozenEnum : ~Copyable {
|
||||
}
|
||||
|
||||
@usableFromInline
|
||||
enum UsableFromInlineEnum : ~Copyable { // expected-error {{noncopyable enum 'UsableFromInlineEnum' must be @frozen in library evolution mode; non-@frozen public and @usableFromInline noncopyable types are not supported}}
|
||||
}
|
||||
|
||||
public class C {
|
||||
@usableFromInline
|
||||
var x: FrozenStruct
|
||||
|
||||
public init() {}
|
||||
|
||||
@inlinable
|
||||
convenience public init(delegating: ()) {
|
||||
self.init()
|
||||
x = FrozenStruct()
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user