mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
In Swift, only value types can have mutating instance member functions or computed properties. The importer logic was violating this invariant when generating setters for bit fields of shared references. Fixes #80182
22 lines
539 B
Swift
22 lines
539 B
Swift
// RUN: %target-run-simple-swift(-I %S/Inputs -Xfrontend -cxx-interoperability-mode=default -Xcc -std=c++20 -Xfrontend -disable-availability-checking)
|
|
//
|
|
// REQUIRES: executable_test
|
|
|
|
import MethodCallsFunction
|
|
import StdlibUnittest
|
|
|
|
var MembersTestSuite = TestSuite("MembersTestSuite")
|
|
|
|
MembersTestSuite.test("method calls function") {
|
|
expectEqual(42, callMethod(41))
|
|
}
|
|
|
|
func doSomethingWith(_ s: Cell) { s.set_marked(true) }
|
|
|
|
MembersTestSuite.test("method sets bitfield") {
|
|
let s = createCell()
|
|
doSomethingWith(s)
|
|
}
|
|
|
|
runAllTests()
|