---
title: "Conversion from `@isolated(any)` function type to synchronous function type (ConversionFromIsolatedAnyToSynchronous)"
framework: swift-compiler
role: article
role_heading: Article
path: swift-compiler/documentation/diagnostics/conversion-from-isolated-any-to-synchronous
---

# Conversion from `@isolated(any)` function type to synchronous function type (ConversionFromIsolatedAnyToSynchronous)

## Overview

Overview A function value with type @isolated(any) carries its actor isolation dynamically. Calling such a function from a context that does not share its isolation requires hopping to the function’s actor, which can only be done from an asynchronous context. As a result, an @isolated(any) function value cannot be converted to a synchronous, non-@isolated(any) function type. @MainActor func updateUI() { /* ... */ }

func runInBackground(_ work: @escaping @Sendable () -> ()) {   DispatchQueue.global().async { work() } }

func schedule(_ work: @escaping @isolated(any) @Sendable () -> ()) {   runInBackground(work) // warning: converting @isolated(any) function of type '@isolated(any) @Sendable () -> ()' to synchronous function type '@Sendable () -> ()' is not allowed }

schedule(updateUI) In the example, updateUI() would run on a background thread instead of the main actor which could result in a data race. This conversion is currently diagnosed as a warning that will become an error in a future Swift language mode. To opt in to treating it as an error today, pass -Werror ConversionFromIsolatedAnyToSynchronous. To resolve the diagnostic, convert the function value to an async function type and use await when invoking the function, or remove the @isolated(any) attribute from the source type if it is not needed.

## See Also

- [@dynamicCallable implementation requirements (DynamicCallable)](swift-compiler/documentation/diagnostics/dynamic-callable-requirements.md)
- [Add @preconcurrency import (AddPreconcurrencyImport)](swift-compiler/documentation/diagnostics/add-preconcurrency-import.md)
- [Always enabled availability domains (AlwaysAvailableDomain)](swift-compiler/documentation/diagnostics/always-available-domain.md)
- [Argument matching for trailing closures (TrailingClosureMatching)](swift-compiler/documentation/diagnostics/trailing-closure-matching.md)
- [Calling a mutating async actor-isolated method (ActorIsolatedMutatingAsync)](swift-compiler/documentation/diagnostics/actor-isolated-mutating-async.md)
- [Calling an actor-isolated method from a synchronous nonisolated context (ActorIsolatedCall)](swift-compiler/documentation/diagnostics/actor-isolated-call.md)
- [Captures in a `@Sendable` closure (SendableClosureCaptures)](swift-compiler/documentation/diagnostics/sendable-closure-captures.md)
- [Compilation caching (CompilationCaching)](swift-compiler/documentation/diagnostics/compilation-caching.md)
- [Conforming to `StringInterpolationProtocol` (StringInterpolationConformance)](swift-compiler/documentation/diagnostics/string-interpolation-conformance.md)
- [Cross-isolation data race (RegionIsolationCrossIsolationDataRace)](swift-compiler/documentation/diagnostics/region-isolation-cross-isolation-data-race.md)
- [Deprecated declaration warnings (DeprecatedDeclaration)](swift-compiler/documentation/diagnostics/deprecated-declaration.md)
- [Deprecated implementation-only imports (ImplementationOnlyDeprecated)](swift-compiler/documentation/diagnostics/implementation-only-deprecated.md)
- [Dynamic exclusivity (DynamicExclusivity)](swift-compiler/documentation/diagnostics/dynamic-exclusivity.md)
- [Embedded Swift language restrictions (EmbeddedRestrictions)](swift-compiler/documentation/diagnostics/embedded-restrictions.md)
- [Existential Types and Performance (ExistentialType)](swift-compiler/documentation/diagnostics/existential-type.md)
