mirror of
https://github.com/apple/swift.git
synced 2025-12-14 20:36:38 +01:00
Fix remangling isolated(any) function types from type metadata.
This commit is contained in:
@@ -758,6 +758,9 @@ swift::_swift_buildDemanglingForMetadata(const Metadata *type,
|
||||
Dem.createNode(Node::Kind::GlobalActorFunctionType);
|
||||
globalActorNode->addChild(globalActorTypeNode, Dem);
|
||||
funcNode->addChild(globalActorNode, Dem);
|
||||
} else if (func->getExtendedFlags().isIsolatedAny()) {
|
||||
funcNode->addChild(Dem.createNode(
|
||||
Node::Kind::IsolatedAnyFunctionType), Dem);
|
||||
}
|
||||
switch (func->getDifferentiabilityKind().Value) {
|
||||
case FunctionMetadataDifferentiabilityKind::NonDifferentiable:
|
||||
|
||||
42
test/Runtime/metadata_printing.swift
Normal file
42
test/Runtime/metadata_printing.swift
Normal file
@@ -0,0 +1,42 @@
|
||||
// RUN: %empty-directory(%t)
|
||||
// RUN: %target-build-swift -target %target-future-triple -parse-stdlib %s -module-name main -o %t/a.out
|
||||
// RUN: %target-codesign %t/a.out
|
||||
// RUN: %target-run %t/a.out
|
||||
// REQUIRES: executable_test
|
||||
// REQUIRES: concurrency
|
||||
// UNSUPPORTED: use_os_stdlib
|
||||
// UNSUPPORTED: back_deployment_runtime
|
||||
|
||||
import Swift
|
||||
import StdlibUnittest
|
||||
import _Concurrency
|
||||
|
||||
let MetadataPrintingTests = TestSuite("MetadataPrinting")
|
||||
|
||||
class NonSendable {
|
||||
var x: Int = 0
|
||||
}
|
||||
|
||||
func expect<T>(type: T.Type, printsAs string: String) {
|
||||
expectEqual(string, "\(type)")
|
||||
}
|
||||
|
||||
MetadataPrintingTests.test("@isolated(any) functions") {
|
||||
expect(type: (@isolated(any) () -> ()).self,
|
||||
printsAs: "@isolated(any) () -> ()")
|
||||
expect(type: (@isolated(any) () -> NonSendable).self,
|
||||
printsAs: "@isolated(any) () -> NonSendable")
|
||||
expect(type: (@isolated(any) () -> sending NonSendable).self,
|
||||
printsAs: "@isolated(any) () -> sending NonSendable")
|
||||
}
|
||||
|
||||
MetadataPrintingTests.test("global actor functions") {
|
||||
expect(type: (@MainActor () -> ()).self,
|
||||
printsAs: "@MainActor () -> ()")
|
||||
expect(type: (@MainActor () -> NonSendable).self,
|
||||
printsAs: "@MainActor () -> NonSendable")
|
||||
expect(type: (@MainActor () -> sending NonSendable).self,
|
||||
printsAs: "@MainActor () -> sending NonSendable")
|
||||
}
|
||||
|
||||
runAllTests()
|
||||
Reference in New Issue
Block a user