The Swift Programming Language

Swift logo

Swift Programming Language

Architecture main Package
macOS x86_64 Build Status Build Status
Ubuntu 16.04 x86_64 Build Status Build Status
Ubuntu 18.04 x86_64 Build Status Build Status
Ubuntu 20.04 x86_64 Build Status Build Status
CentOS 8 x86_64 Build Status Build Status
CentOS 7 x86_64 Build Status Build Status
Amazon Linux 2 x86_64 Build Status Build Status

Swift Community-Hosted CI Platforms

OS Architecture Build
Ubuntu 16.04 PPC64LE Build Status
Ubuntu 18.04 AArch64 Build Status
Ubuntu 20.04 AArch64 Build Status
Ubuntu 20.04 wasm32 Build Status
Android ARMv7 Build Status
Android AArch64 Build Status
Windows 2019 (VS 2017) x86_64 Build Status
Windows 2019 (VS 2019) x86_64 Build Status

Welcome to Swift

Swift is a high-performance system programming language. It has a clean and modern syntax, offers seamless access to existing C and Objective-C code and frameworks, and is memory safe by default.

Although inspired by Objective-C and many other languages, Swift is not itself a C-derived language. As a complete and independent language, Swift packages core features like flow control, data structures, and functions, with high-level constructs like objects, protocols, closures, and generics. Swift embraces modules, eliminating the need for headers and the code duplication they entail.

To learn more about the programming language, visit swift.org.

Contributing to Swift

Contributions to Swift are welcomed and encouraged! Please see the Contributing to Swift guide.

To be a truly great community, Swift.org needs to welcome developers from all walks of life, with different backgrounds, and with a wide range of experience. A diverse and friendly community will have more great ideas, more unique perspectives, and produce more great code. We will work diligently to make the Swift community welcoming to everyone.

To give clarity of what is expected of our members, Swift has adopted the code of conduct defined by the Contributor Covenant. This document is used across many open source communities, and we think it articulates our values well. For more, see the Code of Conduct.

Getting Started

If you are interested in:

We also have an FAQ that answers common questions.

Swift Toolchains

Building

Swift toolchains are created using the script build-toolchain. This script is used by swift.org's CI to produce snapshots and can allow for one to locally reproduce such builds for development or distribution purposes. A typical invocation looks like the following:

  $ ./swift/utils/build-toolchain $BUNDLE_PREFIX

where $BUNDLE_PREFIX is a string that will be prepended to the build date to give the bundle identifier of the toolchain's Info.plist. For instance, if $BUNDLE_PREFIX was com.example, the toolchain produced will have the bundle identifier com.example.YYYYMMDD. It will be created in the directory you run the script with a filename of the form: swift-LOCAL-YYYY-MM-DD-a-osx.tar.gz.

Beyond building the toolchain, build-toolchain also supports the following (non-exhaustive) set of useful options::

  • --dry-run: Perform a dry run build. This is off by default.
  • --test: Test the toolchain after it has been compiled. This is off by default.
  • --distcc: Use distcc to speed up the build by distributing the c++ part of the swift build. This is off by default.
  • --sccache: Use sccache to speed up subsequent builds of the compiler by caching more c++ build artifacts. This is off by default.

More options may be added over time. Please pass --help to build-toolchain to see the full set of options.

Installing into Xcode

On macOS if one wants to install such a toolchain into Xcode:

  1. Untar and copy the toolchain to one of /Library/Developer/Toolchains/ or ~/Library/Developer/Toolchains/. E.x.:
  $ sudo tar -xzf swift-LOCAL-YYYY-MM-DD-a-osx.tar.gz -C /
  $ tar -xzf swift-LOCAL-YYYY-MM-DD-a-osx.tar.gz -C ~/

The script also generates an archive containing debug symbols which can be installed over the main archive allowing symbolication of any compiler crashes.

  $ sudo tar -xzf swift-LOCAL-YYYY-MM-DD-a-osx-symbols.tar.gz -C /
  $ tar -xzf swift-LOCAL-YYYY-MM-DD-a-osx-symbols.tar.gz -C ~/
  1. Specify the local toolchain for Xcode's use via Xcode->Toolchains.

Build Failures

Try the suggestions in Troubleshooting build issues.

Make sure you are using the correct release of Xcode.

If you have changed Xcode versions but still encounter errors that appear to be related to the Xcode version, try passing --clean to build-script.

When a new version of Xcode is released, you can update your build without recompiling the entire project by passing --reconfigure to build-script.

Learning More

Be sure to look at the documentation index for a bird's eye view of the available documentation. In particular, the documents titled Debugging the Swift Compiler and Continuous Integration for Swift are very helpful to understand before submitting your first PR.

Comments
  • +0 Guaranteed Arguments

    +0 Guaranteed Arguments

    This PR contains the final work to convert the compiler to +0. There are still some tests failing, but I would like to get start performing PR testing of the branch.

  • test: migrate tests to Python3 by default

    test: migrate tests to Python3 by default

    This changes the python interpreter used to invoke the tests to Python3. Python2 has been EOL'ed by the Python Software Foundation. This migration enables the Swift test suite to run with Python 3 instead.

    Replace this paragraph with a description of your changes and rationale. Provide links to external references/discussions if appropriate.

    Resolves SR-NNNN.

  • [DO NOT MERGE] [WIP] StringGuts

    [DO NOT MERGE] [WIP] StringGuts

    An initial implementation of a more resilient 2-word representation for String. It uses BridgeObject (for now) to achieve a high degree of resilience. In the future, we'll add more small string forms, establish UnsafeString, and generally rejigger String's views to be properly layered on top.

    Notes:

    • Self slices are currently implemented by forming _NSContiguousStrings to hold the sliced up _StringCore. This incurs overhead. Long term, we could support owned self slices, but for now it would be fruitful to try to eliminate all uses of self-slicing _StringCore from the stdlib. The most common occurrence (but by no means the only) is through _ephemeralString. Instead, for anything that can't possibly escape, we should convert to an UnsafeString, guarantee the lifetime, and slice that up.

    • We cannot utilize small representations effectively until we start to wean ourselves off of _LegacyStringCore. Ideally (depending on project planning needs) we would be fully weaned off before adding small representations. We'd also like to get close to performance parity where it matters prior, to better gauge the impact of such optimizations.

    • The spiritual predecessor to this effort is at https://github.com/dabrahams/swift/commits/string-recore, and while the physical implementation differs, that's a great demonstration of what we're trying to accomplish.

  • Change diagnostic error thrown for when string interpolations aren't closed by a parenthesis

    Change diagnostic error thrown for when string interpolations aren't closed by a parenthesis

    This pull request changes the diagnostic error thrown when a string interpolation isn't closed by a parenthesis properly (ie: let x = "g \(")

    Previously, it would blurt out unterminated string literal, with these changes it'll instead throw expected ')' at end of string interpolation

  • [metadata prespecialization] Support for classes.

    [metadata prespecialization] Support for classes.

    When generic metadata for a class is requested in the same module where the class is defined, rather than a call to the generic metadata accessor or to a variant of typeForMangledNode, a call to a new accessor--a canonical specialized generic metadata accessor--is emitted. The new function is defined schematically as follows:

        MetadataResponse `canonical specialized metadata accessor for C<K>`(MetadataRequest request) {
          (void)`canonical specialized metadata accessor for superclass(C<K>)`(::Complete)
          (void)`canonical specialized metadata accessor for generic_argument_class(C<K>, 1)`(::Complete)
          ...
          (void)`canonical specialized metadata accessor for generic_argument_class(C<K>, count)`(::Complete)
          auto *metadata = objc_opt_self(`canonical specialized metadata for C<K>`);
          return {metadata, MetadataState::Complete};
        }
    

    To enable these new canonical specialized generic metadata accessors, metadata for generic classes is prespecialized as needed. So are the metaclasses and the corresponding rodata.

    Previously, the lazy objc naming hook was registered during process execution when the first generic class metadata was instantiated. Since that instantiation may occur "before process launch" (i.e. if the generic metadata is prespecialized), the lazy naming hook is now installed at process launch.

  • Add support for calling C++ constructors

    Add support for calling C++ constructors

    A problem that we have to deal with when calling C++ constructors is that the ABI of a C++ constructor depends not only on the signature of the constructor but on the class on which it is defined. For example, it can be necessary to pass additional “implicit” arguments to constructors of virtual base classes.

    It is therefore fundamentally not possible for SignatureExpansion (which doesn’t have access to the CXXConstructorDecl) to reliably produce the correct LLVM signature from only the type of the constructor. The approach we take is to try to get most of the way in SignatureExpansion by marking the SIL function return type with the @out attribute, representing the fact that C++ constructors take a this points to the object to be initialized.

    This produces an “assumed” constructor ABI in SignatureExpansion that assumes there are no implicit arguments and that the return type of the constructor ABI is void (and indeed there is no way to represent anything else in the SIL type). If this assumed ABI doesn’t match the actual ABI, we insert a thunk in IRGen.

    The thunk is marked alwaysinline, so it doesn’t incur any runtime overhead, but some compile-time overhead is required for LLVM to inline the thunk. If this turns out to be excessive, we can introduce what is essentially a peephole optimization for a full apply of a function_refthat refers to a C++ constructor and directly emit the constructor call in this case (along with any required implicit arguments) instead of calling the thunk. I’ve chosen not to tackle that in this PR though as it’s already large enough.

    On some ABIs (e.g. Itanium x64), we get lucky and the ABI for a complete constructor call always matches the assumed ABI.

    In addition to the core C++ constructor functionality, this PR adds some a couple of small required features:

    • Conversion of thin to a Clang void type
    • Handling of formal indirect results in SignatureExpansion::expandExternalSignatureTypes()
  • Smol String

    Smol String

    Add in small strings, plumb all APIs through, etc. There's some current performance issues, namely that small string support introduces branching and our default implementation technique involves spilling to the stack and calling _UnmanagedString methods. The first is unavoidable (although we're planning a better overall branching strategy to reduce this impact), the second is TODO.

  • [CS] Use fixes to diagnose instance member on type (or vice versa) access

    [CS] Use fixes to diagnose instance member on type (or vice versa) access

    This PR migrates instance member on type and type member on instance diagnostics handling to use the new diagnostics framework (fixes) and create more reliable and accurate diagnostics in such scenarios.

  • [SE-0283] Implement Equatable, Comparable, and Hashable conformance for Tuples

    [SE-0283] Implement Equatable, Comparable, and Hashable conformance for Tuples

    From: https://forums.swift.org/t/hacking-equatable-conformance-on-void/25975

    The tests right now are kind of lackluster, what else can I be testing with this? What else can be improved upon in this implementation? Is there an edge case that I hadn't thought about?

    cc: @jckarter @rjmccall

  • [SR-381] API to lookup a Type given a top-level class name

    [SR-381] API to lookup a Type given a top-level class name

    | | | |------------------|-----------------| |Previous ID | SR-381 | |Radar | None | |Original Reporter | @lhoward | |Type | New Feature | |Status | Closed | |Resolution | Done |

    Additional Detail from JIRA

    | | | |------------------|-----------------| |Votes | 1 | |Component/s | Standard Library | |Labels | New Feature, AffectsABI, Runtime | |Assignee | @jckarter | |Priority | Medium |

    md5: 13f1c2ae7174aab8983f1dde3a976c53

    blocks:

    • SR-377 Implement NSKeyed[Un]Archiver

    relates to:

    • SR-412 Linux: Cannot define C function pointer that returns metaclass

    Issue Description:

    This may be useful to implement NSStringFromClass()-compatible behaviour which is necessary in order to implement NSKeyedArchiver. I am using the attached workaround at the moment but obviously it is very fragile.

  • [DNM] String interpolation rework

    [DNM] String interpolation rework

    Implements apple/swift-evolution#904.

    This is the implementation of the string interpolation rework. It is now feature-complete, but there are still a few things on my to-do list:

    • ~~It's performing similarly to the current design overall, although individual benchmarks vary wildly—from 1.80x for StringInterpolationSmall to 0.59x for FloatingPointPrinting_Float_interpolated. (Some of the improvements in tests which have little to do with string interpolation are probably thanks to new overloads of String.init(describing:) I added to preserve source compatibility.) We want it to be faster than the status quo. I haven't dug deeply into this yet, and I'd like a second opinion from the CI.~~

    • I'm wondering if it would be useful for DefaultStringInterpolation to become moveonly in the future, and if so, if that could be done without breaking ABI compatibility. @rjmccall, what do you think?

    • There are a couple of test failures I'm not sure what to do with:

      • ~~Constraints/rdar42678836.swift was apparently added three days ago and has already had its message change twice. @slavapestov, @xedin, can we pin down what this test ought to do?~~

      • IDE/complete_at_top_level.swift fails because we don't suggest a Void function in a string interpolation. I think that comes from this line, which looks like it's intended to prevent you from completing a Void function where a value is expected, but I'm just guessing at its purpose. Can anyone clear up my confusion and help me figure out what this should be doing? (@nkcsgexi wrote this, but it was years ago.)

    @swift-ci Please benchmark

    cc @milseman

  • "Instance member cannot be used on type" diagnostic message could be more specific

    Motivation

    It took me far too long to understand why the compiler was giving me this error (I was quickly trying something a bit less trivial than this example involving async/await, and thought the issue was around the execution context):

    @main public struct Scraper
    {
        public static func main()
        {
            let data = fetch()     //  Instance member 'fetch' cannot be used on type 'Scraper'
                       ^~~~~
        }
        
        func fetch() -> Data
        {
            return Data()
        }
    }
    

    Solution

    A more precise wording, something like "Instance method cannot be called from static context", would be much more helpful.

  • Decls in expanded macros trigger source buffer assertions

    Decls in expanded macros trigger source buffer assertions

    As I'm implementing declaration macros I noticed that decls in any macro expansions (including those of expression macros) won't type check.

    Description

    Steps to reproduce

    public class NestedDeclInExprMacro: ExpressionMacro {
      public static func expansion(
        of macro: MacroExpansionExprSyntax, in context: inout MacroExpansionContext
      ) -> ExprSyntax {
        return """
        { () -> Void in
          struct Foo { }
          return ()
        }
        """
      }
    }
    
    @expression macro nestedDeclInExpr: () -> Void = #externalMacro(module: "MacroDefinition", type: "NestedDeclInExprMacro")
    
    func testNestedDeclInExpr() {
      let _: () -> Void = #nestedDeclInExpr
    }
    

    This results in the following assertion. That is, when evaluating ParseMembersRequest the lever is always assuming the source is the original source buffer.

    Assertion failed: (Loc.Value.getPointer() >= Buffer->getBuffer().begin() && Loc.Value.getPointer() <= Buffer->getBuffer().end() && "Location is not from the specified buffer"), function getLocOffsetInBuffer, file SourceLoc.cpp, line 204.
    Please submit a bug report (https://swift.org/contributing/#reporting-bugs) and include the crash backtrace.
    Stack dump:
    0.	Program arguments: ...
    1. /Users/rxwei/Development/Swift/swift-source/build/Ninja-ReleaseAssert+swift-DebugAssert/swift-macosx-arm64/lib/swift/host -module-name MacroUser -DTEST_DIAGNOSTICS
    2.	Swift version 5.8-dev (LLVM 0d61c0fcb536d14, Swift 3374d9871e3c44b)
    3.	Compiling with effective version 4.1.50
    4.	While evaluating request TypeCheckSourceFileRequest(source_file "/Users/rxwei/Development/Swift/swift-source/swift/test/Macros/macro_expand.swift")
    5.	While evaluating request TypeCheckFunctionBodyRequest(MacroUser.(file).testNestedDeclInExpr()@/Users/rxwei/Development/Swift/swift-source/swift/test/Macros/macro_expand.swift:94:6)
    6.	While type-checking statement at [/Users/rxwei/Development/Swift/swift-source/swift/test/Macros/macro_expand.swift:94:29 - line:96:1] RangeText="{
      let _: () -> Void = #nestedDeclInExpr
    "
    7.	While type-checking declaration 0x1448dfff8 (at /Users/rxwei/Development/Swift/swift-source/swift/test/Macros/macro_expand.swift:95:3)
    8.	While type-checking expression at [/Users/rxwei/Development/Swift/swift-source/swift/test/Macros/macro_expand.swift:95:23 - line:95:24] RangeText="#"
    9.	While type-checking-target starting at /Users/rxwei/Development/Swift/swift-source/swift/test/Macros/macro_expand.swift:95:23
    10.	While type checking expanded expression macro expression at [macro:nestedDeclInExpr:/Users/rxwei/Development/Swift/swift-source/swift/test/Macros/macro_expand.swift:95:23-95:40:1:1 - line:4:1] RangeText="{ () -> Void in
      struct Foo { }
      return ()
    "
    11.	While type-checking expression at [macro:nestedDeclInExpr:/Users/rxwei/Development/Swift/swift-source/swift/test/Macros/macro_expand.swift:95:23-95:40:1:1 - line:4:1] RangeText="{ () -> Void in
      struct Foo { }
      return ()
    "
    12.	While type-checking-target starting at macro:nestedDeclInExpr:/Users/rxwei/Development/Swift/swift-source/swift/test/Macros/macro_expand.swift:95:23-95:40:1:1
    13.	While walking into 'Foo' (at macro:nestedDeclInExpr:/Users/rxwei/Development/Swift/swift-source/swift/test/Macros/macro_expand.swift:95:23-95:40:2:3)
    14.	While evaluating request ParseMembersRequest(MacroUser.(file).testNestedDeclInExpr().explicit closure [email protected]:nestedDeclInExpr:/Users/rxwei/Development/Swift/swift-source/swift/test/Macros/macro_expand.swift:95:23-95:40:2:10)
    Stack dump without symbol names (ensure you have llvm-symbolizer in your PATH or set the environment var `LLVM_SYMBOLIZER_PATH` to point to it):
    0  swift-frontend           0x000000010b41a570 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
    1  swift-frontend           0x000000010b419488 llvm::sys::RunSignalHandlers() + 112
    2  swift-frontend           0x000000010b41abfc SignalHandler(int) + 344
    3  libsystem_platform.dylib 0x00000001997e41c4 _sigtramp + 56
    4  libsystem_pthread.dylib  0x00000001997b5c38 pthread_kill + 288
    5  libsystem_c.dylib        0x00000001996c3b28 abort + 180
    6  libsystem_c.dylib        0x00000001996c2e84 err + 0
    7  swift-frontend           0x0000000107956f08 swift::SourceManager::getLocOffsetInBuffer(swift::SourceLoc, unsigned int) const + 336
    8  swift-frontend           0x0000000106ca4834 swift::Lexer::getBufferPtrForSourceLoc(swift::SourceLoc) const + 56
    9  swift-frontend           0x0000000106becb00 swift::Lexer::getStateForBeginningOfTokenLoc(swift::SourceLoc) const + 44
    10 swift-frontend           0x0000000106c9b4a8 swift::Parser::getParserPosition(swift::SourceLoc, swift::SourceLoc) + 48
    11 swift-frontend           0x0000000106c268cc swift::Parser::parseDeclListDelayed(swift::IterableDeclContext*) + 344
    12 swift-frontend           0x0000000106cc046c swift::ParseMembersRequest::evaluate(swift::Evaluator&, swift::IterableDeclContext*) const + 556
    13 swift-frontend           0x0000000106cc1a5c swift::FingerprintAndMembers swift::SimpleRequest<swift::ParseMembersRequest, swift::FingerprintAndMembers (swift::IterableDeclContext*), (swift::RequestFlags)2>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const + 88
    14 swift-frontend           0x0000000106cc18f0 swift::SimpleRequest<swift::ParseMembersRequest, swift::FingerprintAndMembers (swift::IterableDeclContext*), (swift::RequestFlags)2>::evaluateRequest(swift::ParseMembersRequest const&, swift::Evaluator&) + 40
    15 swift-frontend           0x00000001073a90a8 llvm::Expected<swift::ParseMembersRequest::OutputType> swift::Evaluator::getResultUncached<swift::ParseMembersRequest>(swift::ParseMembersRequest const&) + 288
    16 swift-frontend           0x00000001073a8ebc llvm::Expected<swift::ParseMembersRequest::OutputType> swift::Evaluator::getResultCached<swift::ParseMembersRequest, (void*)0>(swift::ParseMembersRequest const&) + 220
    17 swift-frontend           0x00000001073a8b80 llvm::Expected<swift::ParseMembersRequest::OutputType> swift::Evaluator::operator()<swift::ParseMembersRequest, (void*)0>(swift::ParseMembersRequest const&) + 68
    18 swift-frontend           0x0000000107396ca0 swift::ParseMembersRequest::OutputType swift::evaluateOrDefault<swift::ParseMembersRequest>(swift::Evaluator&, swift::ParseMembersRequest, swift::ParseMembersRequest::OutputType) + 76
    19 swift-frontend           0x0000000107396c28 swift::IterableDeclContext::getParsedMembers() const + 116
    20 swift-frontend           0x0000000107396a4c swift::IterableDeclContext::loadAllMembers() const + 84
    21 swift-frontend           0x00000001073969d4 swift::IterableDeclContext::getMembers() const + 28
    22 swift-frontend           0x0000000106f45f90 (anonymous namespace)::Traversal::visitNominalTypeDecl(swift::NominalTypeDecl*) + 392
    23 swift-frontend           0x0000000106f44820 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visitStructDecl(swift::StructDecl*) + 32
    24 swift-frontend           0x0000000106f44004 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Decl*) + 240
    25 swift-frontend           0x0000000106f43eb4 (anonymous namespace)::Traversal::visit(swift::Decl*) + 60
    26 swift-frontend           0x0000000106f43e68 (anonymous namespace)::Traversal::doIt(swift::Decl*)::'lambda'()::operator()() const + 36
    27 swift-frontend           0x0000000106f43e34 bool llvm::function_ref<bool ()>::callback_fn<(anonymous namespace)::Traversal::doIt(swift::Decl*)::'lambda'()>(long) + 24
    28 swift-frontend           0x00000001078b8420 llvm::function_ref<bool ()>::operator()() const + 32
    29 swift-frontend           0x0000000106f3e07c (anonymous namespace)::Traversal::traverse(swift::ASTWalker::PreWalkAction, llvm::function_ref<bool ()>, llvm::function_ref<swift::ASTWalker::PostWalkAction ()>) + 156
    30 swift-frontend           0x0000000106f38c68 (anonymous namespace)::Traversal::doIt(swift::Decl*) + 208
    31 swift-frontend           0x0000000106f3fe84 (anonymous namespace)::Traversal::visitBraceStmt(swift::BraceStmt*) + 356
    32 swift-frontend           0x0000000106f3fa84 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Stmt*) + 96
    33 swift-frontend           0x0000000106f3f9c8 (anonymous namespace)::Traversal::visit(swift::Stmt*) + 60
    34 swift-frontend           0x0000000106f3f980 (anonymous namespace)::Traversal::doIt(swift::Stmt*)::'lambda'(swift::Stmt*)::operator()(swift::Stmt*) const + 36
    35 swift-frontend           0x0000000106f3f950 swift::Stmt* llvm::function_ref<swift::Stmt* (swift::Stmt*)>::callback_fn<(anonymous namespace)::Traversal::doIt(swift::Stmt*)::'lambda'(swift::Stmt*)>(long, swift::Stmt*) + 32
    36 swift-frontend           0x0000000106f3f840 llvm::function_ref<swift::Stmt* (swift::Stmt*)>::operator()(swift::Stmt*) const + 40
    37 swift-frontend           0x0000000106f3f664 swift::Stmt* (anonymous namespace)::Traversal::traverse<swift::Stmt>(swift::ASTWalker::PreWalkResult<swift::Stmt*>, llvm::function_ref<swift::Stmt* (swift::Stmt*)>, llvm::function_ref<swift::ASTWalker::PostWalkResult<swift::Stmt*> (swift::Stmt*)>) + 360
    38 swift-frontend           0x0000000106f38678 (anonymous namespace)::Traversal::doIt(swift::Stmt*) + 144
    39 swift-frontend           0x0000000106f3b16c (anonymous namespace)::Traversal::visitClosureExpr(swift::ClosureExpr*) + 248
    40 swift-frontend           0x0000000106f397c8 swift::ASTVisitor<(anonymous namespace)::Traversal, swift::Expr*, swift::Stmt*, bool, swift::Pattern*, bool, void>::visit(swift::Expr*) + 976
    41 swift-frontend           0x0000000106f3939c (anonymous namespace)::Traversal::visit(swift::Expr*) + 60
    42 swift-frontend           0x0000000106f39354 (anonymous namespace)::Traversal::doIt(swift::Expr*)::'lambda'(swift::Expr*)::operator()(swift::Expr*) const + 36
    43 swift-frontend           0x0000000106f39324 swift::Expr* llvm::function_ref<swift::Expr* (swift::Expr*)>::callback_fn<(anonymous namespace)::Traversal::doIt(swift::Expr*)::'lambda'(swift::Expr*)>(long, swift::Expr*) + 32
    44 swift-frontend           0x00000001074828b0 llvm::function_ref<swift::Expr* (swift::Expr*)>::operator()(swift::Expr*) const + 40
    45 swift-frontend           0x0000000106f3910c swift::Expr* (anonymous namespace)::Traversal::traverse<swift::Expr>(swift::ASTWalker::PreWalkResult<swift::Expr*>, llvm::function_ref<swift::Expr* (swift::Expr*)>, llvm::function_ref<swift::ASTWalker::PostWalkResult<swift::Expr*> (swift::Expr*)>) + 360
    46 swift-frontend           0x0000000106f38598 (anonymous namespace)::Traversal::doIt(swift::Expr*) + 144
    47 swift-frontend           0x0000000106f384c8 swift::Expr::walk(swift::ASTWalker&) + 56
    48 swift-frontend           0x000000010619e3cc (anonymous namespace)::ConstraintGenerator::visitClosureExpr(swift::ClosureExpr*) + 192
    49 swift-frontend           0x000000010619da94 (anonymous namespace)::ConstraintWalker::walkToExprPre(swift::Expr*) + 612
    50 swift-frontend           0x0000000106f38540 (anonymous namespace)::Traversal::doIt(swift::Expr*) + 56
    51 swift-frontend           0x0000000106f384c8 swift::Expr::walk(swift::ASTWalker&) + 56
    52 swift-frontend           0x000000010619a084 generateConstraintsFor(swift::constraints::ConstraintSystem&, swift::Expr*, swift::DeclContext*) + 88
    53 swift-frontend           0x0000000106198dfc swift::constraints::ConstraintSystem::generateConstraints(swift::Expr*, swift::DeclContext*, bool) + 92
    54 swift-frontend           0x0000000106198614 swift::constraints::ConstraintSystem::generateConstraints(swift::constraints::SolutionApplicationTarget&, swift::FreeTypeVariableBinding) + 472
    55 swift-frontend           0x0000000106243c90 swift::constraints::ConstraintSystem::solveImpl(swift::constraints::SolutionApplicationTarget&, swift::FreeTypeVariableBinding) + 396
    56 swift-frontend           0x0000000106243474 swift::constraints::ConstraintSystem::solve(swift::constraints::SolutionApplicationTarget&, swift::FreeTypeVariableBinding) + 224
    57 swift-frontend           0x00000001065c98fc swift::TypeChecker::typeCheckTarget(swift::constraints::SolutionApplicationTarget&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 784
    58 swift-frontend           0x00000001065c95d0 swift::TypeChecker::typeCheckExpression(swift::constraints::SolutionApplicationTarget&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 224
    59 swift-frontend           0x00000001065c9410 swift::TypeChecker::typeCheckExpression(swift::Expr*&, swift::DeclContext*, swift::constraints::ContextualTypeInfo, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 188
    60 swift-frontend           0x00000001066c2240 swift::expandMacroExpr(swift::DeclContext*, swift::Expr*, swift::ConcreteDeclRef, swift::Type) + 2712
    61 swift-frontend           0x0000000106130e48 (anonymous namespace)::ExprRewriter::visitMacroExpansionExpr(swift::MacroExpansionExpr*) + 388
    62 swift-frontend           0x0000000106128dc4 swift::ASTVisitor<(anonymous namespace)::ExprRewriter, swift::Expr*, void, void, void, void, void>::visit(swift::Expr*) + 2488
    63 swift-frontend           0x000000010612839c (anonymous namespace)::ExprRewriter::walkToExprPost(swift::Expr*) + 36
    64 swift-frontend           0x0000000106121608 (anonymous namespace)::ExprWalker::walkToExprPost(swift::Expr*) + 40
    65 swift-frontend           0x0000000106f3f4f0 (anonymous namespace)::Traversal::doIt(swift::Expr*)::'lambda0'(swift::Expr*)::operator()(swift::Expr*) const + 48
    66 swift-frontend           0x0000000106f3f4b4 swift::ASTWalker::PostWalkResult<swift::Expr*> llvm::function_ref<swift::ASTWalker::PostWalkResult<swift::Expr*> (swift::Expr*)>::callback_fn<(anonymous namespace)::Traversal::doIt(swift::Expr*)::'lambda0'(swift::Expr*)>(long, swift::Expr*) + 32
    67 swift-frontend           0x0000000106f392c4 llvm::function_ref<swift::ASTWalker::PostWalkResult<swift::Expr*> (swift::Expr*)>::operator()(swift::Expr*) const + 40
    68 swift-frontend           0x0000000106f3913c swift::Expr* (anonymous namespace)::Traversal::traverse<swift::Expr>(swift::ASTWalker::PreWalkResult<swift::Expr*>, llvm::function_ref<swift::Expr* (swift::Expr*)>, llvm::function_ref<swift::ASTWalker::PostWalkResult<swift::Expr*> (swift::Expr*)>) + 408
    69 swift-frontend           0x0000000106f38598 (anonymous namespace)::Traversal::doIt(swift::Expr*) + 144
    70 swift-frontend           0x0000000106f384c8 swift::Expr::walk(swift::ASTWalker&) + 56
    71 swift-frontend           0x00000001061173f8 (anonymous namespace)::ExprWalker::rewriteTarget(swift::constraints::SolutionApplicationTarget) + 172
    72 swift-frontend           0x00000001061170f4 swift::constraints::ConstraintSystem::applySolution(swift::constraints::Solution&, swift::constraints::SolutionApplicationTarget) + 680
    73 swift-frontend           0x00000001065c9988 swift::TypeChecker::typeCheckTarget(swift::constraints::SolutionApplicationTarget&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 924
    74 swift-frontend           0x00000001065c95d0 swift::TypeChecker::typeCheckExpression(swift::constraints::SolutionApplicationTarget&, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 224
    75 swift-frontend           0x00000001065cae44 swift::TypeChecker::typeCheckBinding(swift::Pattern*&, swift::Expr*&, swift::DeclContext*, swift::Type, swift::PatternBindingDecl*, unsigned int, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 384
    76 swift-frontend           0x00000001065cb294 swift::TypeChecker::typeCheckPatternBinding(swift::PatternBindingDecl*, unsigned int, swift::Type, swift::OptionSet<swift::TypeCheckExprFlags, unsigned int>) + 404
    77 swift-frontend           0x0000000106665a70 (anonymous namespace)::DeclChecker::visitPatternBindingDecl(swift::PatternBindingDecl*) + 904
    78 swift-frontend           0x0000000106660208 swift::ASTVisitor<(anonymous namespace)::DeclChecker, void, void, void, void, void, void>::visit(swift::Decl*) + 1408
    79 swift-frontend           0x00000001066566ac (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 220
    80 swift-frontend           0x0000000106656574 swift::TypeChecker::typeCheckDecl(swift::Decl*, bool) + 92
    81 swift-frontend           0x000000010689493c (anonymous namespace)::StmtChecker::typeCheckASTNode(swift::ASTNode&) + 836
    82 swift-frontend           0x000000010689ae1c (anonymous namespace)::StmtChecker::visitBraceStmt(swift::BraceStmt*) + 464
    83 swift-frontend           0x000000010689aa68 swift::ASTVisitor<(anonymous namespace)::StmtChecker, void, swift::Stmt*, void, void, void, void>::visit(swift::Stmt*) + 96
    84 swift-frontend           0x0000000106896724 bool (anonymous namespace)::StmtChecker::typeCheckStmt<swift::BraceStmt>(swift::BraceStmt*&) + 156
    85 swift-frontend           0x000000010689600c (anonymous namespace)::StmtChecker::typeCheckBody(swift::BraceStmt*&) + 36
    86 swift-frontend           0x0000000106895af8 swift::TypeCheckFunctionBodyRequest::evaluate(swift::Evaluator&, swift::AbstractFunctionDecl*) const + 1592
    87 swift-frontend           0x0000000106865838 swift::BraceStmt* swift::SimpleRequest<swift::TypeCheckFunctionBodyRequest, swift::BraceStmt* (swift::AbstractFunctionDecl*), (swift::RequestFlags)12>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const + 76
    88 swift-frontend           0x0000000106860da8 swift::SimpleRequest<swift::TypeCheckFunctionBodyRequest, swift::BraceStmt* (swift::AbstractFunctionDecl*), (swift::RequestFlags)12>::evaluateRequest(swift::TypeCheckFunctionBodyRequest const&, swift::Evaluator&) + 32
    89 swift-frontend           0x000000010731bca0 llvm::Expected<swift::TypeCheckFunctionBodyRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckFunctionBodyRequest>(swift::TypeCheckFunctionBodyRequest const&) + 280
    90 swift-frontend           0x000000010731bae8 llvm::Expected<swift::TypeCheckFunctionBodyRequest::OutputType> swift::Evaluator::getResultCached<swift::TypeCheckFunctionBodyRequest, (void*)0>(swift::TypeCheckFunctionBodyRequest const&) + 188
    91 swift-frontend           0x000000010731b834 llvm::Expected<swift::TypeCheckFunctionBodyRequest::OutputType> swift::Evaluator::operator()<swift::TypeCheckFunctionBodyRequest, (void*)0>(swift::TypeCheckFunctionBodyRequest const&) + 68
    92 swift-frontend           0x0000000107041d18 swift::TypeCheckFunctionBodyRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckFunctionBodyRequest>(swift::Evaluator&, swift::TypeCheckFunctionBodyRequest, swift::TypeCheckFunctionBodyRequest::OutputType) + 64
    93 swift-frontend           0x0000000107041ccc swift::AbstractFunctionDecl::getTypecheckedBody() const + 84
    94 swift-frontend           0x000000010691670c typeCheckDelayedFunctions(swift::SourceFile&) + 160
    95 swift-frontend           0x00000001069164e8 swift::TypeCheckSourceFileRequest::evaluate(swift::Evaluator&, swift::SourceFile*) const + 568
    96 swift-frontend           0x00000001068663e4 std::__1::tuple<> swift::SimpleRequest<swift::TypeCheckSourceFileRequest, std::__1::tuple<> (swift::SourceFile*), (swift::RequestFlags)12>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const + 76
    97 swift-frontend           0x0000000106861200 swift::SimpleRequest<swift::TypeCheckSourceFileRequest, std::__1::tuple<> (swift::SourceFile*), (swift::RequestFlags)12>::evaluateRequest(swift::TypeCheckSourceFileRequest const&, swift::Evaluator&) + 32
    98 swift-frontend           0x000000010691aa40 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::getResultUncached<swift::TypeCheckSourceFileRequest>(swift::TypeCheckSourceFileRequest const&) + 316
    99 swift-frontend           0x000000010691a86c llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::getResultCached<swift::TypeCheckSourceFileRequest, (void*)0>(swift::TypeCheckSourceFileRequest const&) + 184
    100 swift-frontend           0x000000010691a714 llvm::Expected<swift::TypeCheckSourceFileRequest::OutputType> swift::Evaluator::operator()<swift::TypeCheckSourceFileRequest, (void*)0>(swift::TypeCheckSourceFileRequest const&) + 68
    101 swift-frontend           0x00000001069161bc swift::TypeCheckSourceFileRequest::OutputType swift::evaluateOrDefault<swift::TypeCheckSourceFileRequest>(swift::Evaluator&, swift::TypeCheckSourceFileRequest, swift::TypeCheckSourceFileRequest::OutputType) + 60
    102 swift-frontend           0x0000000106916174 swift::performTypeChecking(swift::SourceFile&) + 68
    103 swift-frontend           0x0000000104765cd0 swift::CompilerInstance::performSema()::$_7::operator()(swift::SourceFile&) const + 28
    104 swift-frontend           0x0000000104765ca4 bool llvm::function_ref<bool (swift::SourceFile&)>::callback_fn<swift::CompilerInstance::performSema()::$_7>(long, swift::SourceFile&) + 32
    105 swift-frontend           0x0000000104749c2c llvm::function_ref<bool (swift::SourceFile&)>::operator()(swift::SourceFile&) const + 40
    106 swift-frontend           0x000000010474995c swift::CompilerInstance::forEachFileToTypeCheck(llvm::function_ref<bool (swift::SourceFile&)>) + 184
    107 swift-frontend           0x0000000104749888 swift::CompilerInstance::performSema() + 116
    108 swift-frontend           0x00000001044dae1c withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 160
    109 swift-frontend           0x00000001044d6018 performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 960
    110 swift-frontend           0x00000001044b4d14 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 220
    111 swift-frontend           0x00000001044b3db8 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2088
    112 swift-frontend           0x0000000104426990 run_driver(llvm::StringRef, llvm::ArrayRef<char const*>, llvm::ArrayRef<char const*>) + 748
    113 swift-frontend           0x0000000104425c60 swift::mainEntry(int, char const**) + 1148
    114 swift-frontend           0x00000001043fd310 main + 36
    115 dyld                     0x0000000199457f34 start + 2248
    
  • Can't inherit from a protocol with primary associated types using the

    Can't inherit from a protocol with primary associated types using the "generic" notation

    It doesn't seem possible for a struct to inherit a protocol with primary associated type using this primary associated type in the declaration. In other words, the following doesn't compile:

    protocol P<A> {
      associatedtype A
    }
    struct B {}
    
    struct T: P<B> {} // Error: Cannot inherit from protocol type with generic argument 'P<B>'
    

    This configuration was however explicitly mentioned in SE-0346, so I don't know if this is a bug, a regression, or feature that was not implemented at the end.

    Environment

    • Swift compiler version info: swift-driver version: 1.62.15 Apple Swift version 5.7.2 (swiftlang-5.7.2.135.5 clang-1400.0.29.51)
    • Xcode version info: Version 14.2 (14C18)
    • Deployment target: macOS 13.1
  • [GenericEnvironment] Only include opened pack elements within a given shape class in an opened element generic environment.

    [GenericEnvironment] Only include opened pack elements within a given shape class in an opened element generic environment.

    This changes opened pack element generic environments to store a shape equivalence class, and only include opened element parameters for originating packs in that shape class in the generic signature.

Related tags
PLP Project Programming Language | Programming for projects and computer science and research on computer and programming.
PLP Project Programming Language | Programming for projects and computer science and research on computer and programming.

PLPv2b PLP Project Programming Language Programming Language for projects and computer science and research on computer and programming. What is PLP L

Aug 20, 2022
StarkScript - or the Stark programming language - is a compiled C-based programming language that aims to offer the same usability as that of JavaScript's and TypeScript's

StarkScript StarkScript - or the Stark programming language - is a compiled C-based programming language that aims to offer the same usability as that

May 10, 2022
Swift Framework for Apple Health Integration with Terra Enabling Developers LTD.

TerraSwift This library allows developers to connect to TERRA ENABLING DEVELOPERS LTD. through Swift (implemented with Swift5.0). This library uses He

Oct 14, 2022
PoC of Swift for [email protected]

FastlyEdgeExample An example project to deploy Swift code to Fastly's [email protected] Requirements SwiftWasm toolchain fastly CLI How to deploy $ fastly

May 21, 2022
frost is a programming language with a focus on low-friction systems programming.

❄️ frost frost programming language About frost is a programming language with a focus on low-friction systems programming.

Nov 12, 2021
The Wren Programming Language. Wren is a small, fast, class-based concurrent scripting language.

Wren is a small, fast, class-based concurrent scripting language Think Smalltalk in a Lua-sized package with a dash of Erlang and wrapped up in a fami

Dec 30, 2022
Competitive Programming - Programming👨‍💻 Questions on BinarySearch💻, LeetCode💻, CodeChef💻, Codeforces💻,DSA 450
Competitive Programming - Programming👨‍💻  Questions on BinarySearch💻, LeetCode💻, CodeChef💻, Codeforces💻,DSA 450

?? Hacktoberfest2021 ?? This repository is open to all members of the GitHub community. Any member can contribute. Contribute according to the steps g

Jan 7, 2023
J is an array programming language

J: From C to C++20 J is an array programming language created by Ken Iverson and Roger Hui (see image below).

Oct 28, 2022
A minimal viable programming language on top of liblgpp

This project aims to implement a minimal viable programming language on top of liblgpp. setup The project requires a C++17 compiler, CMake and liblgpp

Jun 28, 2021
A perfect blend of C, Java, and Python tailored for those who desire a simple yet powerful programming language.

Fastcode A perfect blend of C, Java, and Python tailored for those who desire a simple yet powerful programming language. FastCode is a procedural/str

Aug 19, 2022
Loop is an object oriented programming language
Loop is an object oriented programming language

Loop Loop is an object oriented programming language. How do I build and run loop? Make sure, you installed the requirements for clang and make: Debia

Aug 9, 2021
C implementation of the Monkey programming language.
C implementation of the Monkey programming language.

Development of this interpreter continues here: dannyvankooten/pepper-lang C implementation of the Monkey programming language. Bytecode compiler and

Dec 30, 2022
A programming language made in C

1. Fang A programming language made in C 1.1. Meaning Fang stands for "Feline Language". In hopes of it being cool like a cat! On top of it, you can b

Apr 8, 2021
AHHH: a programming language for the dreadful
AHHH: a programming language for the dreadful

AHHH: a programming language for the dreadful Screaming into the Void but make it Turing Complete AHHH is an esoteric programming language inspired by

Dec 18, 2022
Pandex is a light but FAST programming language written in C . Pandex goal is that be hard & it's good for eductional goals

The Pandex programming language version 1.0.0.3 Pandex versions release type The Pandex version has four numbers. the first number holds 1 ( or 0 in s

May 23, 2022
Arobase is a simple programming language with a c-like syntax.
Arobase is a simple programming language with a c-like syntax.

Arobase Arobase is a simple programming language with a c-like syntax. Requirements gcc gas (gnu as) ld A 64 bits linux distribution (generated assemb

Nov 28, 2022
C+- is a personal project trying to make a programming language.
C+- is a personal project trying to make a programming language.

C+- A personal project trying to be a programming language with close resemblence to C/C++ (probably gonna fail at that).

Nov 22, 2022
Simple String_View implementation for C programming language.

Simple String_View implementation for C programming language.

Dec 21, 2022