mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Test: finish noncopyable accessor test
rdar://106164128
This commit is contained in:
@@ -1,13 +0,0 @@
|
||||
|
||||
public class Message { var s: String = "hello" }
|
||||
|
||||
@_moveOnly
|
||||
public struct FileDescriptor {
|
||||
public var x: Int = 0
|
||||
public var msg: Message = Message()
|
||||
}
|
||||
|
||||
public class FileHandle {
|
||||
var file: FileDescriptor = FileDescriptor()
|
||||
}
|
||||
|
||||
@@ -1,9 +1,33 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-swift-emit-module-interface(%t.swiftinterface) %s -module-name test
|
||||
// RUN: %target-swift-typecheck-module-from-interface(%t.swiftinterface) -module-name test
|
||||
// RUN: %FileCheck --check-prefix INTERFACE %s < %t.swiftinterface
|
||||
|
||||
// FIXME: should work without syntize accessors too
|
||||
// RUN: %target-swift-frontend -DSYNTHESIZE_ACCESSORS -enable-library-evolution -module-name Hello -emit-module -o %t/Hello.swiftmodule -emit-module-interface-path %t/Hello.swiftinterface %S/Inputs/moveonly_simple.swift
|
||||
// RUN: %target-swift-frontend -module-name test -emit-silgen %s -o %t.silgen
|
||||
// RUN: %FileCheck --check-prefix SILGEN %s < %t.silgen
|
||||
|
||||
public class Message { var s: String = "hello" }
|
||||
|
||||
public struct FileDescriptor: ~Copyable {
|
||||
public var x: Int = 0
|
||||
public var msg: Message = Message()
|
||||
}
|
||||
|
||||
public class FileHandle {
|
||||
// INTERFACE: public var _stored: test.FileDescriptor
|
||||
|
||||
// SILGEN: @_hasStorage @_hasInitialValue public var _stored: FileDescriptor { get set }
|
||||
public var _stored: FileDescriptor = FileDescriptor()
|
||||
|
||||
// INTERFACE: public var file: test.FileDescriptor {
|
||||
// INTERFACE-NEXT: _read
|
||||
// INTERFACE-NEXT: _modify
|
||||
// INTERFACE-NEXT: }
|
||||
|
||||
// SILGEN: public var file: FileDescriptor { _read _modify }
|
||||
public var file: FileDescriptor {
|
||||
_read { yield _stored }
|
||||
_modify { yield &_stored }
|
||||
}
|
||||
}
|
||||
|
||||
// rdar://106164128
|
||||
// REQUIRES: rdar106164128
|
||||
|
||||
// TODO: finish this test by verifying the interface with FileCheck
|
||||
|
||||
Reference in New Issue
Block a user