GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • All gists
  • Back to GitHub
  • Sign in
  • Sign up
  • Code
  • Revisions 9
  • Stars 53
  • Forks 2
  • Terms
  • Privacy
  • Security
  • Status
  • Community
  • Docs

This view

  • Original page
  • New address

GeezerVison is showing gist.github.com — swift-list-features: List Swift compiler upcoming and experimental feature flags. If you're using Swift 6.2 or later, `swift -print-supported-features` does something very similar, but only for the compiler version you have installed. · swift-has-feature: Check if a given compiler knows a specific feature flag, and whether it's an upcoming or experimental flag.

Instantly share code, notes, and snippets.

@ole

ole/swift-has-feature.sh

Last active June 24, 2026 03:11
Show Gist options
  • Download ZIP
  • Star 53 (53) You must be signed in to star a gist
  • Fork 2 (2) You must be signed in to fork a gist
  • Clone this repository at <script src="https://gist.github.com/ole/478874632fca61869928a0cc0a956972.js"></script>
  • Save ole/478874632fca61869928a0cc0a956972 to your computer and use it in GitHub Desktop.
Clone this repository at <script src="https://gist.github.com/ole/478874632fca61869928a0cc0a956972.js"></script>
Save ole/478874632fca61869928a0cc0a956972 to your computer and use it in GitHub Desktop.
Download ZIP
swift-list-features: List Swift compiler upcoming and experimental feature flags. If you're using Swift 6.2 or later, `swift -print-supported-features` does something very similar, but only for the compiler version you have installed. · swift-has-feature: Check if a given compiler knows a specific feature flag, and whether it's an upcoming or ex…
Raw
swift-has-feature.sh
#!/bin/zsh
# Test if the Swift compiler knows about a particular language feature.
#
# Usage:
#
# swift-has-feature [--swift SWIFT_PATH] [--language-version LANGUAGE_VERSION] FEATURE
#
# The feature should be an upcoming or experimental language feature,
# such as `"StrictConcurrency"` or `"ExistentialAny"`.
#
# Use swift-list-features.sh to list all known features of a given compiler version.
read -r -d '' usage << EOF
$(tput bold)USAGE:$(tput sgr0) swift-has-feature [--swift <path_to_swift>] [--language-version <language_version>] <feature>
Test if the Swift compiler knows about a particular language feature.
$(tput bold)OPTIONS$(tput sgr0)
feature A named Swift language feature, such as "StrictConcurrency".
Use swift-list-features.sh to list all known features.
--swift <path_to_swift> Path to the Swift compiler you want to test.
Default: "swift".
--language-version <version> Set the language version you want to test.
We pass this to the compiler with the -swift-version flag.
Default: whatever the Swift compiler uses by default.
$(tput bold)EXAMPLES$(tput sgr0)
swift-has-feature ExistentialAny
swift-has-feature --language-version 6 StrictConcurrency
swift-has-feature --swift /Library/Developer/Toolchains/swift-latest.xctoolchain/usr/bin/swift --language-version 6 StrictConcurrency
EOF
zmodload zsh/zutil
zparseopts -D -F -- -swift:=arg_swift_path -language-version:=arg_language_version || exit 1
if test -z "$1"; then
echo "$usage"
exit
fi
if test -z "${arg_swift_path[*]}"; then
swift_path=("swift")
else
# $arg_swift_path is an array of the form ("--swift" "/path/to/swift -arguments")
# Take the last argument.
swift_path=${arg_swift_path[-1]}
fi
swift_args=()
if test -n "${arg_language_version[*]}"; then
# $arg_language_version is an array of the form ("--language_version" "6").
# Take the last argument.
language_version=${arg_language_version[-1]}
swift_args+=("-swift-version" "$language_version")
fi
# Print compiler and language version.
echo -n "$(tput bold)Swift compiler version:$(tput sgr0) "
"$swift_path" --version
if test -z "${arg_swift_path[*]}"; then
echo "(Pass --swift <path_to_swift> to test a different compiler executable.)"
fi
echo ""
echo "$(tput bold)Language version:$(tput sgr0) ${language_version:-"(default)"}"
if test -z "$language_version"; then
echo "(Pass --language-version <version> to set the language version.)"
fi
echo ""
# Swift code to test if a feature is known to the compiler.
read -r -d '' swift_script << EOF
import Foundation
#if hasFeature($1)
exit(EXIT_SUCCESS)
#else
exit(EXIT_FAILURE)
#endif
EOF
echo "$(tput setaf 3)Running Swift compiler…$(tput sgr0)"
# Compile and run the Swift code multiple times with different compiler flags.
echo "$swift_script" | "$swift_path" "${swift_args[@]}" -
is_builtin=$? # 0 == The feature is always on, no feature flags needed.
echo "$swift_script" | "$swift_path" "${swift_args[@]}" -enable-upcoming-feature "$1" -
is_upcoming=$? # 0 == It's an upcoming feature flag.
echo "$swift_script" | "$swift_path" "${swift_args[@]}" -enable-experimental-feature "$1" -
is_experimental=$? # 0 == It's an experimental feature flag.
echo "$(tput setaf 3)Done.$(tput sgr0)"
echo ""
# Print the result.
read -r -d '' output_upcoming << EOF
$(tput bold)Result:$(tput sgr0) '$1' is an $(tput bold)upcoming$(tput sgr0) feature flag.
Usage:
• swiftc $(tput bold)-enable-upcoming-feature $1$(tput sgr0)
• SwiftPM $(tput bold).enableUpcomingFeature($1)$(tput sgr0)
EOF
read -r -d '' output_experimental << EOF
$(tput bold)Result:$(tput sgr0) '$1' is an $(tput bold)experimental$(tput sgr0) feature flag.
Usage:
• swiftc $(tput bold)-enable-experimental-feature $1$(tput sgr0)
• SwiftPM $(tput bold).enableExperimentalFeature($1)$(tput sgr0)
EOF
if test $is_builtin -eq 0; then
echo "$(tput bold)Result:$(tput sgr0) The feature '$1' is $(tput bold)enabled unconditionally$(tput sgr0) in this language version. You can use it without passing any feature flags."
elif test $is_upcoming -eq 0; then
echo "$output_upcoming"
elif test $is_experimental -eq 0; then
echo "$output_experimental"
else
echo "$(tput bold)Result:$(tput sgr0) Unknown feature flag '$1'. The Swift compiler doesn’t know this feature."
exit 1
fi
Raw
swift-list-features.sh
#!/bin/bash
# List Swift language features the compiler knows about.
#
# Usage:
#
# swift-list-features [version] # default: main branch
#
# Examples:
#
# swift-list-features # Queries main branch
# swift-list-features 6.1 # Queries release/6.1 branch
#
# The output is in CSV format (delimiter: comma, including a header row).
# This allows you to format/filter/process the output by piping it into other
# tools.
#
# NOTE: See also `swift -print-supported-features` (introduced in Swift 6.2).
# It outputs essentially the same information about upcoming and experimental
# features in JSON format. But only for the compiler version you have installed,
# so this script is still useful for comparing multiple compiler versions.
#
# Examples:
#
# 1) Print a nicely formatted table using [xan](https://github.com/medialab/xan):
#
# ```sh
# swift-list-features.sh 6.1 | xan view --all
# ```
#
# 2) Also sort the output by type and language mode, and tell xan to group the table by type:
#
# ```sh
# swift-list-features.sh main | xan sort -s "type,language_mode" | xan view --all --groupby "type"
# ```
#
# 3) Print SwiftPM-compatible settings for all features with a given language mode:
#
# ```sh
# swift-list-features.sh main \
# | xan filter 'type eq "Upcoming" && language_mode eq "7"' \
# | xan select name | xan behead \
# | sed 's/^/.enableUpcomingFeature("/; s/$/"),/'
# ```
#
# Example output:
#
# ```
# .enableUpcomingFeature("ExistentialAny"),
# .enableUpcomingFeature("InferIsolatedConformances"),
# .enableUpcomingFeature("InternalImportsByDefault"),
# .enableUpcomingFeature("MemberImportVisibility"),
# .enableUpcomingFeature("NonisolatedNonsendingByDefault"),
# ```
#
# This script uses curl to download the file in which the language features
# are defined from the Swift repo and uses Clang to parse it.
#
# Original author: Gor Gyolchanyan
# <https://forums.swift.org/t/how-to-test-if-swiftc-supports-an-upcoming-experimental-feature/69095/10>
#
# Enhanced/modified by: Ole Begemann
swift_version=$1
if test -z "$swift_version" || test "$swift_version" = "main"; then
branch="main"
else
branch="release/${swift_version}"
fi
GITHUB_URL="https://raw.githubusercontent.com/apple/swift/${branch}/include/swift/Basic/Features.def"
FEATURES_DEF_FILE="$(curl --fail-with-body --silent "${GITHUB_URL}")"
curlStatus=$?
if test $curlStatus -ne 0; then
echo "$FEATURES_DEF_FILE"
echo "Error: failed to download '$GITHUB_URL'. Invalid URL?"
exit $curlStatus
fi
echo "type,name,language_mode,se_number,available_in_prod,description"
clang --preprocess --no-line-commands -nostdinc -x c - <<EOF | sort | sed 's/,SE-0,/,,/'
#define LANGUAGE_FEATURE(FeatureName, SENumber, Description, ...) ,FeatureName,,SE-SENumber,,Description
#define OPTIONAL_LANGUAGE_FEATURE(FeatureName, SENumber, Description, ...) Optional,FeatureName,,SE-SENumber,,Description
#define UPCOMING_FEATURE(FeatureName, SENumber, Version) Upcoming,FeatureName,Version,SE-SENumber,,
#define EXPERIMENTAL_FEATURE(FeatureName, AvailableInProd) Experimental,FeatureName,,,AvailableInProd,
${FEATURES_DEF_FILE}
EOF
@ole

ole commented Feb 16, 2024 •
edited
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown
Author

(last updated: 2025-05-19)

Example output of swift-list-features for Swift 6.1, piped into xan to get a nicely formatted table:

$ swift-list-features.sh 6.1 | xan view --all

Displaying 6 cols from 165 rows of <stdin>
┌─────┬──────────────┬────────────────────────────────────────────┬───────────────┬───────────┬───────────────────┬────────────────────────────────────────────┐
│ -   │ type         │ name                                       │ language_mode │ se_number │ available_in_prod │ description                                │
├─────┼──────────────┼────────────────────────────────────────────┼───────────────┼───────────┼───────────────────┼────────────────────────────────────────────┤
│ 0   │ <empty>      │ Actors                                     │ <empty>       │ <empty>   │ <empty>           │ actors                                     │
│ 1   │ <empty>      │ AssociatedTypeAvailability                 │ <empty>       │ <empty>   │ <empty>           │ Availability on associated types           │
│ 2   │ <empty>      │ AssociatedTypeImplements                   │ <empty>       │ <empty>   │ <empty>           │ @_implements on associated types           │
│ 3   │ <empty>      │ AsyncAwait                                 │ <empty>       │ SE-296    │ <empty>           │ async/await                                │
│ 4   │ <empty>      │ AsyncSequenceFailure                       │ <empty>       │ <empty>   │ <empty>           │ Failure associated type on AsyncSequence … │
│ 5   │ <empty>      │ AttachedMacros                             │ <empty>       │ SE-389    │ <empty>           │ Attached macros                            │
│ 6   │ <empty>      │ BitwiseCopyable                            │ <empty>       │ SE-426    │ <empty>           │ BitwiseCopyable protocol                   │
│ 7   │ <empty>      │ BitwiseCopyable2                           │ <empty>       │ SE-426    │ <empty>           │ BitwiseCopyable feature                    │
│ 8   │ <empty>      │ BodyMacros                                 │ <empty>       │ SE-415    │ <empty>           │ Function body macros                       │
│ 9   │ <empty>      │ BorrowingSwitch                            │ <empty>       │ SE-432    │ <empty>           │ Noncopyable type pattern matching          │
│ 10  │ <empty>      │ BuiltinAddressOfRawLayout                  │ <empty>       │ <empty>   │ <empty>           │ Builtin.addressOfRawLayout                 │
│ 11  │ <empty>      │ BuiltinAllocVector                         │ <empty>       │ <empty>   │ <empty>           │ Builtin.allocVector                        │
│ 12  │ <empty>      │ BuiltinAssumeAlignment                     │ <empty>       │ <empty>   │ <empty>           │ Builtin.assumeAlignment                    │
│ 13  │ <empty>      │ BuiltinBuildComplexEqualityExecutor        │ <empty>       │ <empty>   │ <empty>           │ Executor-building for 'complexEquality ex… │
│ 14  │ <empty>      │ BuiltinBuildExecutor                       │ <empty>       │ <empty>   │ <empty>           │ Executor-building builtins                 │
│ 15  │ <empty>      │ BuiltinBuildMainExecutor                   │ <empty>       │ <empty>   │ <empty>           │ MainActor executor building builtin        │
│ 16  │ <empty>      │ BuiltinBuildTaskExecutorRef                │ <empty>       │ <empty>   │ <empty>           │ TaskExecutor-building builtins             │
│ 17  │ <empty>      │ BuiltinContinuation                        │ <empty>       │ <empty>   │ <empty>           │ Continuation builtins                      │
│ 18  │ <empty>      │ BuiltinCreateAsyncDiscardingTaskInGroup    │ <empty>       │ <empty>   │ <empty>           │ Task create in discarding task group buil… │
│ 19  │ <empty>      │ BuiltinCreateAsyncDiscardingTaskInGroupWi… │ <empty>       │ <empty>   │ <empty>           │ Task create in discarding task group with… │
│ 20  │ <empty>      │ BuiltinCreateAsyncTaskInGroup              │ <empty>       │ <empty>   │ <empty>           │ Task create in task group builtin with ex… │
│ 21  │ <empty>      │ BuiltinCreateAsyncTaskInGroupWithExecutor  │ <empty>       │ <empty>   │ <empty>           │ Task create in task group builtin with ex… │
│ 22  │ <empty>      │ BuiltinCreateAsyncTaskOwnedTaskExecutor    │ <empty>       │ <empty>   │ <empty>           │ Task create with owned TaskExecutor        │
│ 23  │ <empty>      │ BuiltinCreateAsyncTaskWithExecutor         │ <empty>       │ <empty>   │ <empty>           │ Task create builtin with extra executor p… │
│ 24  │ <empty>      │ BuiltinCreateTask                          │ <empty>       │ <empty>   │ <empty>           │ Builtin.createTask and Builtin.createDisc… │
│ 25  │ <empty>      │ BuiltinCreateTaskGroupWithFlags            │ <empty>       │ <empty>   │ <empty>           │ Builtin.createTaskGroupWithFlags           │
│ 26  │ <empty>      │ BuiltinExecutor                            │ <empty>       │ <empty>   │ <empty>           │ Builtin.Executor type                      │
│ 27  │ <empty>      │ BuiltinHopToActor                          │ <empty>       │ <empty>   │ <empty>           │ Builtin.HopToActor                         │
│ 28  │ <empty>      │ BuiltinIntLiteralAccessors                 │ <empty>       │ SE-368    │ <empty>           │ Builtin.IntLiteral accessors               │
│ 29  │ <empty>      │ BuiltinJob                                 │ <empty>       │ <empty>   │ <empty>           │ Builtin.Job type                           │
│ 30  │ <empty>      │ BuiltinStackAlloc                          │ <empty>       │ <empty>   │ <empty>           │ Builtin.stackAlloc                         │
│ 31  │ <empty>      │ BuiltinStoreRaw                            │ <empty>       │ <empty>   │ <empty>           │ Builtin.storeRaw                           │
│ 32  │ <empty>      │ BuiltinTaskGroupWithArgument               │ <empty>       │ <empty>   │ <empty>           │ TaskGroup builtins                         │
│ 33  │ <empty>      │ BuiltinTaskRunInline                       │ <empty>       │ <empty>   │ <empty>           │ Builtin.taskRunInline                      │
│ 34  │ <empty>      │ BuiltinUnprotectedAddressOf                │ <empty>       │ <empty>   │ <empty>           │ Builtin.unprotectedAddressOf               │
│ 35  │ <empty>      │ BuiltinUnprotectedStackAlloc               │ <empty>       │ <empty>   │ <empty>           │ Builtin.unprotectedStackAlloc              │
│ 36  │ <empty>      │ ConcurrentFunctions                        │ <empty>       │ <empty>   │ <empty>           │ @concurrent functions                      │
│ 37  │ <empty>      │ ConformanceSuppression                     │ <empty>       │ SE-426    │ <empty>           │ Suppressible inferred conformances         │
│ 38  │ <empty>      │ EffectfulProp                              │ <empty>       │ SE-310    │ <empty>           │ Effectful properties                       │
│ 39  │ <empty>      │ ExpressionMacroDefaultArguments            │ <empty>       │ SE-422    │ <empty>           │ Expression macro as caller-side default a… │
│ 40  │ <empty>      │ ExtensionMacroAttr                         │ <empty>       │ <empty>   │ <empty>           │ @attached(extension)                       │
│ 41  │ <empty>      │ ExtensionMacros                            │ <empty>       │ SE-402    │ <empty>           │ Extension macros                           │
│ 42  │ <empty>      │ FreestandingExpressionMacros               │ <empty>       │ SE-382    │ <empty>           │ Expression macros                          │
│ 43  │ <empty>      │ FreestandingMacros                         │ <empty>       │ SE-397    │ <empty>           │ freestanding declaration macros            │
│ 44  │ <empty>      │ GlobalActors                               │ <empty>       │ SE-316    │ <empty>           │ Global actors                              │
│ 45  │ <empty>      │ ImplicitSelfCapture                        │ <empty>       │ <empty>   │ <empty>           │ @_implicitSelfCapture attribute            │
│ 46  │ <empty>      │ InheritActorContext                        │ <empty>       │ <empty>   │ <empty>           │ @_inheritActorContext attribute            │
│ 47  │ <empty>      │ IsolatedAny                                │ <empty>       │ SE-431    │ <empty>           │ @isolated(any) function types              │
│ 48  │ <empty>      │ IsolatedAny2                               │ <empty>       │ SE-431    │ <empty>           │ @isolated(any) function types              │
│ 49  │ <empty>      │ LexicalLifetimes                           │ <empty>       │ <empty>   │ <empty>           │ @_eagerMove/@_noEagerMove/@_lexicalLifeti… │
│ 50  │ <empty>      │ Macros                                     │ <empty>       │ <empty>   │ <empty>           │ Macros                                     │
│ 51  │ <empty>      │ MarkerProtocol                             │ <empty>       │ <empty>   │ <empty>           │ @_marker protocol                          │
│ 52  │ <empty>      │ MoveOnly                                   │ <empty>       │ SE-390    │ <empty>           │ noncopyable types                          │
│ 53  │ <empty>      │ MoveOnlyPartialConsumption                 │ <empty>       │ SE-429    │ <empty>           │ Partial consumption of noncopyable values  │
│ 54  │ <empty>      │ MoveOnlyResilientTypes                     │ <empty>       │ SE-390    │ <empty>           │ non-@frozen noncopyable types with librar… │
│ 55  │ <empty>      │ NewCxxMethodSafetyHeuristics               │ <empty>       │ <empty>   │ <empty>           │ Only import C++ methods that return point… │
│ 56  │ <empty>      │ NoAsyncAvailability                        │ <empty>       │ SE-340    │ <empty>           │ @available(*, noasync)                     │
│ 57  │ <empty>      │ NoncopyableGenerics                        │ <empty>       │ SE-427    │ <empty>           │ Noncopyable generics                       │
│ 58  │ <empty>      │ NoncopyableGenerics2                       │ <empty>       │ SE-427    │ <empty>           │ Noncopyable generics alias                 │
│ 59  │ <empty>      │ NonescapableTypes                          │ <empty>       │ SE-446    │ <empty>           │ Nonescapable types                         │
│ 60  │ <empty>      │ ObjCImplementation                         │ <empty>       │ SE-436    │ <empty>           │ @objc @implementation extensions           │
│ 61  │ <empty>      │ OptionalIsolatedParameters                 │ <empty>       │ SE-420    │ <empty>           │ Optional isolated parameters               │
│ 62  │ <empty>      │ ParameterPacks                             │ <empty>       │ SE-393    │ <empty>           │ Value and type parameter packs             │
│ 63  │ <empty>      │ PrimaryAssociatedTypes2                    │ <empty>       │ SE-346    │ <empty>           │ Primary associated types                   │
│ 64  │ <empty>      │ RethrowsProtocol                           │ <empty>       │ <empty>   │ <empty>           │ @rethrows protocol                         │
│ 65  │ <empty>      │ RetroactiveAttribute                       │ <empty>       │ SE-364    │ <empty>           │ @retroactive                               │
│ 66  │ <empty>      │ Sendable                                   │ <empty>       │ <empty>   │ <empty>           │ Sendable and @Sendable                     │
│ 67  │ <empty>      │ SendingArgsAndResults                      │ <empty>       │ SE-430    │ <empty>           │ Sending arg and results                    │
│ 68  │ <empty>      │ SpecializeAttributeWithAvailability        │ <empty>       │ <empty>   │ <empty>           │ @_specialize attribute with availability   │
│ 69  │ <empty>      │ TypedThrows                                │ <empty>       │ SE-413    │ <empty>           │ Typed throws                               │
│ 70  │ <empty>      │ UnavailableFromAsync                       │ <empty>       │ <empty>   │ <empty>           │ @_unavailableFromAsync                     │
│ 71  │ <empty>      │ UnsafeInheritExecutor                      │ <empty>       │ <empty>   │ <empty>           │ @_unsafeInheritExecutor                    │
│ 72  │ Experimental │ AccessLevelOnImport                        │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 73  │ Experimental │ AdditiveArithmeticDerivedConformances      │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 74  │ Experimental │ AllowNonResilientAccessInPackage           │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 75  │ Experimental │ AllowUnsafeAttribute                       │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 76  │ Experimental │ AssumeResilientCxxTypes                    │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 77  │ Experimental │ BuiltinMacros                              │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 78  │ Experimental │ BuiltinModule                              │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 79  │ Experimental │ CImplementation                            │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 80  │ Experimental │ ClientBypassResilientAccessInPackage       │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 81  │ Experimental │ ClosureIsolation                           │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 82  │ Experimental │ CodeItemMacros                             │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 83  │ Experimental │ ConsumeSelfInDeinit                        │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 84  │ Experimental │ CoroutineAccessors                         │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 85  │ Experimental │ CoroutineAccessorsAllocateInCallee         │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 86  │ Experimental │ CoroutineAccessorsUnwindOnCallerError      │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 87  │ Experimental │ DebugDescriptionMacro                      │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 88  │ Experimental │ DifferentiableProgramming                  │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 89  │ Experimental │ DoExpressions                              │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 90  │ Experimental │ Embedded                                   │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 91  │ Experimental │ Extern                                     │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 92  │ Experimental │ ExtractConstantsFromMembers                │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 93  │ Experimental │ FixedArrays                                │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 94  │ Experimental │ FlowSensitiveConcurrencyCaptures           │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 95  │ Experimental │ ForwardModeDifferentiation                 │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 96  │ Experimental │ FullTypedThrows                            │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 97  │ Experimental │ GenerateBindingsForThrowingFunctionsInCXX  │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 98  │ Experimental │ GenerateForceToMainActorThunks             │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 99  │ Experimental │ GroupActorErrors                           │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 100 │ Experimental │ ImplicitLastExprResults                    │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 101 │ Experimental │ ImplicitSome                               │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 102 │ Experimental │ ImportSymbolicCXXDecls                     │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 103 │ Experimental │ IsolatedDeinit                             │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 104 │ Experimental │ LayoutPrespecialization                    │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 105 │ Experimental │ LayoutStringValueWitnesses                 │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 106 │ Experimental │ LayoutStringValueWitnessesInstantiation    │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 107 │ Experimental │ LazyImmediate                              │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 108 │ Experimental │ LifetimeDependence                         │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 109 │ Experimental │ MacrosOnImports                            │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 110 │ Experimental │ MoveOnlyClasses                            │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 111 │ Experimental │ MoveOnlyEnumDeinits                        │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 112 │ Experimental │ MoveOnlyPartialReinitialization            │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 113 │ Experimental │ MoveOnlyTuples                             │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 114 │ Experimental │ NamedOpaqueTypes                           │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 115 │ Experimental │ NoImplicitCopy                             │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 116 │ Experimental │ ObjCImplementationWithResilientStorage     │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 117 │ Experimental │ OldOwnershipOperatorSpellings              │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 118 │ Experimental │ OneWayClosureParameters                    │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 119 │ Experimental │ OpaqueTypeErasure                          │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 120 │ Experimental │ PackageCMO                                 │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 121 │ Experimental │ ParserASTGen                               │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 122 │ Experimental │ ParserRoundTrip                            │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 123 │ Experimental │ ParserValidation                           │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 124 │ Experimental │ PlaygroundExtendedCallbacks                │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 125 │ Experimental │ PreambleMacros                             │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 126 │ Experimental │ RawLayout                                  │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 127 │ Experimental │ ReferenceBindings                          │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 128 │ Experimental │ ReinitializeConsumeInMultiBlockDefer       │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 129 │ Experimental │ SafeInterop                                │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 130 │ Experimental │ SameElementRequirements                    │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 131 │ Experimental │ SE427NoInferenceOnExtension                │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 132 │ Experimental │ SendableCompletionHandlers                 │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 133 │ Experimental │ Sensitive                                  │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 134 │ Experimental │ Span                                       │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 135 │ Experimental │ StaticAssert                               │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 136 │ Experimental │ StaticExclusiveOnly                        │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 137 │ Experimental │ StructLetDestructuring                     │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 138 │ Experimental │ SuppressedAssociatedTypes                  │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 139 │ Experimental │ SymbolLinkageMarkers                       │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 140 │ Experimental │ ThenStatements                             │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 141 │ Experimental │ TrailingComma                              │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 142 │ Experimental │ TupleConformances                          │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 143 │ Experimental │ UnspecifiedMeansMainActorIsolated          │ <empty>       │ <empty>   │ false             │ <empty>                                    │
│ 144 │ Experimental │ ValueGenerics                              │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 145 │ Experimental │ Volatile                                   │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 146 │ Experimental │ WarnUnsafe                                 │ <empty>       │ <empty>   │ true              │ <empty>                                    │
│ 147 │ Upcoming     │ BareSlashRegexLiterals                     │ 6             │ SE-354    │ <empty>           │ <empty>                                    │
│ 148 │ Upcoming     │ ConciseMagicFile                           │ 6             │ SE-274    │ <empty>           │ <empty>                                    │
│ 149 │ Upcoming     │ DeprecateApplicationMain                   │ 6             │ SE-383    │ <empty>           │ <empty>                                    │
│ 150 │ Upcoming     │ DisableOutwardActorInference               │ 6             │ SE-401    │ <empty>           │ <empty>                                    │
│ 151 │ Upcoming     │ DynamicActorIsolation                      │ 6             │ SE-423    │ <empty>           │ <empty>                                    │
│ 152 │ Upcoming     │ ExistentialAny                             │ 7             │ SE-335    │ <empty>           │ <empty>                                    │
│ 153 │ Upcoming     │ ForwardTrailingClosures                    │ 6             │ SE-286    │ <empty>           │ <empty>                                    │
│ 154 │ Upcoming     │ GlobalActorIsolatedTypesUsability          │ 6             │ SE-0434   │ <empty>           │ <empty>                                    │
│ 155 │ Upcoming     │ GlobalConcurrency                          │ 6             │ SE-412    │ <empty>           │ <empty>                                    │
│ 156 │ Upcoming     │ ImplicitOpenExistentials                   │ 6             │ SE-352    │ <empty>           │ <empty>                                    │
│ 157 │ Upcoming     │ ImportObjcForwardDeclarations              │ 6             │ SE-384    │ <empty>           │ <empty>                                    │
│ 158 │ Upcoming     │ InferSendableFromCaptures                  │ 6             │ SE-418    │ <empty>           │ <empty>                                    │
│ 159 │ Upcoming     │ InternalImportsByDefault                   │ 7             │ SE-409    │ <empty>           │ <empty>                                    │
│ 160 │ Upcoming     │ IsolatedDefaultValues                      │ 6             │ SE-411    │ <empty>           │ <empty>                                    │
│ 161 │ Upcoming     │ MemberImportVisibility                     │ 7             │ SE-444    │ <empty>           │ <empty>                                    │
│ 162 │ Upcoming     │ NonfrozenEnumExhaustivity                  │ 6             │ SE-192    │ <empty>           │ <empty>                                    │
│ 163 │ Upcoming     │ RegionBasedIsolation                       │ 6             │ SE-414    │ <empty>           │ <empty>                                    │
│ 164 │ Upcoming     │ StrictConcurrency                          │ 6             │ SE-0337   │ <empty>           │ <empty>                                    │
├─────┼──────────────┼────────────────────────────────────────────┼───────────────┼───────────┼───────────────────┼────────────────────────────────────────────┤
│ -   │ type         │ name                                       │ language_mode │ se_number │ available_in_prod │ description                                │
└─────┴──────────────┴────────────────────────────────────────────┴───────────────┴───────────┴───────────────────┴────────────────────────────────────────────┘
Displaying 6 cols from 165 rows of <stdin>

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@ole

ole commented May 12, 2024

Copy link
Copy Markdown
Author

Example outputs for swift-has-feature. Note the differences between --language-version 6 and leaving the language version at its default (5) with the Swift 6.0 compiler:

Swift 5.10

$ swift-has-feature.sh StrictConcurrency
Swift compiler version: swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Target: arm64-apple-macosx14.0
(Pass --swift <path_to_swift> to test a different compiler executable.)

Language version: (default)
(Pass --language-version <version> to set the language version.)

Running Swift compiler…
Done.

Result: 'StrictConcurrency' is an experimental feature flag.
Usage:
• swiftc    -enable-experimental-feature StrictConcurrency
• SwiftPM   .enableExperimentalFeature(StrictConcurrency)

Swift 6.0 (language version: 5)

swift-has-feature.sh --swift /Library/Developer/Toolchains/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-04-30-a.xctoolchain/usr/bin/swift StrictConcurrency
Swift compiler version: Apple Swift version 6.0-dev (LLVM 7b8e6346027d2b1, Swift 763421cee31dc8f)
Target: arm64-apple-macosx14.0

Language version: (default)
(Pass --language-version <version> to set the language version.)

Running Swift compiler…
Done.

Result: 'StrictConcurrency' is an upcoming feature flag.
Usage:
• swiftc    -enable-upcoming-feature StrictConcurrency
• SwiftPM   .enableUpcomingFeature(StrictConcurrency)

Swift 6.0 (language version: 6)

$ swift-has-feature.sh --swift /Library/Developer/Toolchains/swift-6.0-DEVELOPMENT-SNAPSHOT-2024-04-30-a.xctoolchain/usr/bin/swift --language-version 6 StrictConcurrency
Swift compiler version: Apple Swift version 6.0-dev (LLVM 7b8e6346027d2b1, Swift 763421cee31dc8f)
Target: arm64-apple-macosx14.0

Language version: 6

Running Swift compiler…
<unknown>:0: error: upcoming feature 'StrictConcurrency' is already enabled as of Swift version 6
Done.

Result: The feature 'StrictConcurrency' is enabled unconditionally in this language version. You can use it without passing any feature flags.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You are visitor 01402605 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.