Revert "add and update tests for Copyable types not having ownership modifiers"

This reverts commit 87f190be20.
This commit is contained in:
Michael Gottesman
2023-05-29 12:58:29 -07:00
parent 95cdf2a084
commit 07677c252b
12 changed files with 22 additions and 23 deletions

View File

@@ -3,7 +3,7 @@
struct borrowing {}
struct consuming {}
struct Foo: ~Copyable {}
struct Foo {}
func foo(x: borrowing Foo) {}
func bar(x: consuming Foo) {}
@@ -18,13 +18,13 @@ func worst(x: (borrowing consuming Foo) -> ()) {} // expected-error{{at most one
func zim(x: borrowing) {}
func zang(x: consuming) {}
func zung(x: borrowing consuming) {} // expected-error{{copyable types cannot be 'consuming' or 'borrowing' yet}}
func zip(x: consuming borrowing) {} // expected-error{{copyable types cannot be 'consuming' or 'borrowing' yet}}
func zung(x: borrowing consuming) {}
func zip(x: consuming borrowing) {}
func zap(x: (borrowing, consuming) -> ()) {}
func zoop(x: (borrowing consuming, consuming borrowing) -> ()) {} // expected-error 2{{copyable types cannot be 'consuming' or 'borrowing' yet}}
func zoop(x: (borrowing consuming, consuming borrowing) -> ()) {}
func worster(x: borrowing borrowing borrowing) {} // expected-error{{at most one}} // expected-error{{copyable types cannot be 'consuming' or 'borrowing' yet}}
func worstest(x: (borrowing borrowing borrowing) -> ()) {} // expected-error{{at most one}} // expected-error{{copyable types cannot be 'consuming' or 'borrowing' yet}}
func worster(x: borrowing borrowing borrowing) {} // expected-error{{at most one}}
func worstest(x: (borrowing borrowing borrowing) -> ()) {} // expected-error{{at most one}}
// Parameter specifier names are regular identifiers in other positions,
// including argument labels.
@@ -47,7 +47,7 @@ func argumentLabel(anonConsumingInClosure: (_ consuming: Int) -> ()) {}
func argumentLabel(anonSharedInClosure: (_ __shared: Int) -> ()) {}
func argumentLabel(anonOwnedInClosure: (_ __owned: Int) -> ()) {}
struct MethodModifiers: ~Copyable {
struct MethodModifiers {
mutating func mutating() {}
borrowing func borrowing() {}
consuming func consuming() {}
@@ -60,7 +60,6 @@ struct MethodModifiers: ~Copyable {
borrowing mutating consuming func tooManyD() {} // expected-error 2 {{method must not be declared both }}
}
func chalk(_ a: consuming String, // expected-error{{copyable types cannot be 'consuming' or 'borrowing' yet}}
_ b: borrowing [Int], // expected-error{{copyable types cannot be 'consuming' or 'borrowing' yet}}
_ c: __shared [String],
@@ -107,3 +106,4 @@ func consumingClosure2(_ f: consuming @escaping () -> ()) { } // expected-error
func borrowingClosure1(_ f: borrowing () -> ()) { } // expected-error {{copyable types cannot be 'consuming' or 'borrowing' yet}}
func borrowingClosure2(_ f: borrowing @escaping () -> ()) { } // expected-error {{copyable types cannot be 'consuming' or 'borrowing' yet}}

View File

@@ -1,4 +1,4 @@
// RUN: %target-typecheck-verify-swift -enable-experimental-feature NoImplicitCopy
// RUN: %target-typecheck-verify-swift
// This is a variation of `ownership_modifiers.swift` with the expected error
// lines removed, so that the file is parsed by the SwiftSyntax parser

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-emit-silgen -enable-experimental-feature NoImplicitCopy %s | %FileCheck %s
// RUN: %target-swift-emit-silgen %s | %FileCheck %s
func bar(_: String) {}

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-emit-silgen -enable-experimental-feature NoImplicitCopy %s | %FileCheck %s
// RUN: %target-swift-emit-silgen %s | %FileCheck %s
//////////////////
// Declarations //

View File

@@ -1,5 +1,5 @@
// RUN: %target-swift-emit-silgen -enable-experimental-feature NoImplicitCopy -module-name moveonly_closure %s | %FileCheck %s
// RUN: %target-swift-emit-sil -enable-experimental-feature NoImplicitCopy -module-name moveonly_closure -verify %s
// RUN: %target-swift-emit-silgen -module-name moveonly_closure %s | %FileCheck %s
// RUN: %target-swift-emit-sil -module-name moveonly_closure -verify %s
// FIXME: we should add -sil-verify-all to the below. rdar://109477976 (moveonly_escaping_closure.swift fails with -sil-verify-all)
// RUN: %target-swift-emit-sil -O -enable-experimental-feature NoImplicitCopy -module-name moveonly_closure -verify %s

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-emit-silgen -enable-experimental-feature NoImplicitCopy %s | %FileCheck %s
// RUN: %target-swift-emit-silgen %s | %FileCheck %s
// The internal `__shared` and `__owned` modifiers would always affect
// symbol mangling, even if they don't have a concrete impact on ABI. The

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-frontend -c -enable-experimental-feature NoImplicitCopy -disable-availability-checking -Xllvm --sil-print-final-ossa-module -O -module-name=main -o /dev/null %s 2>&1 | %FileCheck %s
// RUN: %target-swift-frontend -c -disable-availability-checking -Xllvm --sil-print-final-ossa-module -O -module-name=main -o /dev/null %s 2>&1 | %FileCheck %s
// REQUIRES: concurrency

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-emit-sil -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses -enable-experimental-feature MoveOnlyTuples %s
// RUN: %target-swift-emit-sil -sil-verify-all -verify -enable-experimental-feature MoveOnlyClasses -enable-experimental-feature MoveOnlyTuples %s
// This test validates that we properly emit errors if we partially invalidate
// through a type with a deinit.

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-emit-sil -sil-verify-all -verify -enable-experimental-feature NoImplicitCopy -enable-experimental-feature MoveOnlyClasses %s
// RUN: %target-swift-emit-sil -sil-verify-all -verify -enable-experimental-feature MoveOnlyClasses %s
//////////////////
// Declarations //

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-emit-sil -enable-experimental-feature NoImplicitCopy -sil-verify-all -verify %s
// RUN: %target-swift-emit-sil -sil-verify-all -verify %s
//////////////////
// Declarations //

View File

@@ -1,4 +1,4 @@
// RUN: %target-swift-emit-sil -enable-experimental-feature NoImplicitCopy -sil-verify-all -verify %s
// RUN: %target-swift-emit-sil -sil-verify-all -verify %s
//////////////////
// Declarations //

View File

@@ -44,14 +44,13 @@ func foo() {
_ = s3
}
struct MoveOnly: ~Copyable {}
struct MoveOnly : ~Copyable {}
@_eagerMove struct MoveOnlyEagerly: ~Copyable {} // expected-error {{@_eagerMove cannot be applied to NonCopyable types}}
@_eagerMove struct MoveOnlyEagerly : ~Copyable {} // expected-error {{@_eagerMove cannot be applied to NonCopyable types}}
func zoo(@_eagerMove _ : consuming MoveOnly) {} // expected-error {{@_eagerMove cannot be applied to NonCopyable types}}
// TODO: Copyable types can't be consuming right now (rdar://108383660)
//func zooo(@_noEagerMove _ : consuming C) {} // ok, only way to spell this behavior
func zooo(@_noEagerMove _ : consuming C) {} // ok, only way to spell this behavior
extension MoveOnly {
@_eagerMove // expected-error {{@_eagerMove cannot be applied to NonCopyable types}}