text:
NFC Permissions

How can we force android to ask user permissions to acess NFC module?
Am emulating a tag, and i only start the emulation process when user clicks on a button but if the user doesn't have the nfc turned on, the aplication doesn't ask for permissions.
I already looked up react native documentation but i didn't found a permission for NFC.

Just googled about Your problem and found a SO topic which could be some kind of clue:
https://stackoverflow.com/questions/7618657/how-to-check-whether-nfc-is-enabled-or-not-in-android

repo: appidea/react-native-hce


text:
Get Appium Server Log Using Client

Description
I want to get the appium server log using the c# code. I know I can store the log using the appium& > log.txt but I need for a purpose something line Driver.GetAppiumServerLog();
Environment

.NET client build version or git revision if you use some shapshot: 4.0.0.4 beta
Appium server version or git revision if you use some shapshot: 1.9.2@beta
Desktop OS/version used to run Appium if necessary:
Node.js version (unless using Appium.app|exe) or Appium CLI or Appium.app|exe:
Mobile platform/version under test: 8.0
Real device or emulator/simulator: Real

I read up on this and this blog post describes how this should be possible after this ticket has been implemented:
https://appiumpro.com/editions/88
Currently this
        private string GetAppiumServerLog()
        {
            var entries = CurrentDriver.Manage().Logs.GetLog("server");
            var log = new StringBuilder("======== APPIUM SERVER LOGS ========");
            foreach (var entry in entries)
            {
                log.Append($"{entry.Timestamp} {entry.Message}\r\n");
            }

            log.Append("================");
            return log.ToString();
        }

fails with a NullReferenceException on GetLog("server") call.
As per the blog post the option
--allow-insecure=get_system_logs

needs to be added to allow the retrieval of the Appium server logs.
Please let me know if you (@MummanaSubramanya) meant something else with this ticket.

source: gharchive/issue

repo: appium/appium-dotnet-driver

license_type: permissive

license_source: bigquery


text:
Scanner doesn't run in Windows in JetBrains extension

Tested with RubyMine on Windows with Rails sample app.
The scanner is present in the folder C:\Users\ahtro\AppData\JetBrains\appland-plugin\scanner\ but findings are not generated. If I manually execute the scanner with scan --all then findings are generated.

Is this a duplicate of https://github.com/applandinc/appmap-js/issues/726?

Yeah, looks like it is. Sorry, I didn't see that when I made this.

Duplicate of https://github.com/applandinc/appmap-js/issues/726

authors: ahtrotta jansorg

repo: applandinc/appmap-intellij-plugin

license: MIT

license_source: github-api


text:
cannot install on Apple Silicon

I am following the doc here:
https://github.com/apple/axlearn/blob/a7a738e816363ff4950b0da391206c3216e87d6d/docs/01-start.md
Failed on the final step:
pip install "axlearn[core, apple-silicon]"

ERROR: Ignored the following versions that require a different python version: 1.6.2 Requires-Python >=3.7,<3.10; 1.6.3 Requires-Python >=3.7,<3.10; 1.7.0 Requires-Python >=3.7,<3.10; 1.7.1 Requires-Python >=3.7,<3.10
ERROR: Could not find a version that satisfies the requirement tensorflow_text==2.8.2 (from axlearn[core,gcp]) (from versions: 2.17.0rc0, 2.17.0, 2.18.0rc0)
ERROR: No matching distribution found for tensorflow_text==2.8.2

MacOS: 15.0.1
Conda env: python 3.10
And when I try to build and install tensorflow_text ==2.6.1, it installs tensorflow==2.16.2. I don't know, but this may be no related.

Does it work if you install from source instead? pip install -e .[core,apple-silicon]. The pypi wheel may be slightly behind.

ERROR: Ignored the following versions that require a different python version: 1.6.2 Requires-Python >=3.7,<3.10; 1.6.3 Requires-Python >=3.7,<3.10; 1.7.0 Requires-Python >=3.7,<3.10; 1.7.1 Requires-Python >=3.7,<3.10
ERROR: Could not find a version that satisfies the requirement tfds-nightly (from seqio) (from versions: none)
ERROR: No matching distribution found for tfds-nightly

authors: chunyang-wen markblee

repo: apple/axlearn


text:
containertool: Use same gzip headers on Linux and macOS

Motivation
Packaging the same binary using the same version of containertool produces different application image layers on macOS and Linux:
linux% swift run containertool --verbose --repository registry.test:5000/hello hello-world --from scratch
...
Uploading application layer
application layer: sha256:54a282d5cd082320d2d4976e7d9a952da46e3bc4bab3ce1e0b3931ccf945b849 (80394382 bytes)
image configuration: sha256:fdcb887ef6e27a09456419b03b1d8353b15d68d088b8ea023f38af892fca69be (462 bytes)
...

macos% swift run containertool --verbose --repository registry.test:5000/hello hello-world --from scratch
...
Uploading application layer
application layer: sha256:08a21093e79423c17b58325decc48d7196481ed55276c2d168de23a75d38727e (80394382 bytes)
image configuration: sha256:2648cd8cca1cad7ec5b386e8433e36ca77a40e31859e5994260b2ef1d07f0753 (462 bytes)
...

The application layer hashes are different, even though they
contain the same binary.   The image configuration metadata blob
hashes also differ, but they contain timestamps so this will continue
to happen even after this PR is merged.    A future change could
make these timestamps default to the epoch, allowing identical
metadata blobs to be created on Linux and macOS as well.
The image layer is a gzipped TAR archive containing the executable. Saving the intermediate steps shows that the TAR archives are identical and the gzipped streams are different, but only by one byte:
% diff <(hexdump -X linux-image.tar.gz) <(hexdump -X darwin-image.tar.gz)
1c1
< 0000000  1f  8b  08  00  00  00  00  00  00  03  ed  57  eb  6e  1c  b7
---
> 0000000  1f  8b  08  00  00  00  00  00  00  13  ed  57  eb  6e  1c  b7```

The difference is in the 10th byte of the gzip header: the OS
field.     RFC
1952 defines a list of known operating
systems:
0x03 is the OS code for Unix, however the RFC was written in 1996
so Macintosh refers to the classic MacOS.   Zlib uses an updated
operating system list
https://github.com/madler/zlib/commit/ce12c5cd00628bf8f680c98123a369974d32df15
which defines 19 / 0x13 as the OS code for Darwin.
Interestingly, using gzip to compress a file directly produces identical results on macOS and Linux (-n is needed to prevent gzip from including the current timestamp on macOS):
linux% cat hello-world | gzip -n | md5sum
ef64adbee9e89e78114000442a804e0e  -

macos% cat hello-world | gzip -n | md5sum
ef64adbee9e89e78114000442a804e0e  -

Modifications
By default, Zlib uses the value of OS_CODE set at compile time. This commit uses
deflateSetHeader() to override the default gzip header, forcing the OS code to be 0x03 (Unix) on both Linux and macOS.
Result
After this change, image layers containing the same binary will use identical gzip headers and should have the same hash whether they
are built on Linux or macOS.   It is still possible that different
versions of Zlib might produce different compressed data, causing
the overall hashes to change.
Test Plan
Tested manually on macOS and Linux, verifying that image layers containing identical binaries have identical hashes.
Added a test for containertool's gzip function.

Discovered while investigating #34, however I don't think this difference is the cause of the reported problem.

source: gharchive/pull-request

repo: apple/swift-container-plugin


text:
[CF] DT_WHT is unavailable on OpenBSD.

Here we duplicate this extended conditional to not reference DT_WHT,
which is not available on OpenBSD. It is probably harmless to actually
remove DT_WHT entirely here unconditionally, but would require grokking
more context for a simple buildfix.
It also seems more readable to duplicate the entire line in the ifdef
despite being able to squish the ifdef in the clause.

Let me know if you'd prefer adding some additional preprocessor symbols in (maybe) CoreFoundation_Prefix.h instead of injecting actual OS preprocessor symbols.

Is TARGET_OS_BSD from TargetConditionals.h not appropriate?

DT_WHT is available on FreeBSD (source) and NetBSD (source), but not OpenBSD (source).
(I'm also wondering what the ideal stylistic choice is for future PRs as well; for example, Linux doesn't have xlocale, FreeBSD does, but the other BSDs do not...)

Perhaps it's better stylistically to leave granular portability decisions to CoreFoundation_Prefix.h: so, for this example,
#define __HAS_DT_WHT__ 0
#if TARGET_OS_BSD && defined(__OpenBSD__)
#define __HAS_DT_WHT__ 1
#endif

and then use HAS_DT_WHT in CFFileUtilities instead? This means macros in the dependent files are focused on features as opposed to operating systems. It does make the prefix file a lot more verbose though (but on the other hand it's already rather verbose to begin with).

I tried that approach in the past (focus on features instead of platforms) but was never happy with the result. It just results in a lot of extra macros, most of which are just aliases for "platform X".

Sounds good. I'll keep this commit as-is and use that pattern for future PRs.

@swift-ci please test

I wish that there was a better way to write this, but I suppose it will do for now.

It'll possibly look better if refactored slightly, but I'll think about circling back around to that after I'm done with all the portability tweaks.

authors: 3405691582 compnerd parkera

repo: apple/swift-corelibs-foundation


text:
Add Slice to replace Snippet Chunks (#50)

SE-0356 latest changes include parsing "slices" out of snippets.
These are not quite the same as the current "chunks", which were
a speculation that eventually formed into "slices". Deprecate chunks
and add the slice data model.
Move snippet presentation code to a line-based format: slices are represented
simply as a name and index range to pull their code lines.
Add the isVirtual property to modules, for modules that are created
implicitly to hold relationships. When snippet symbol graphs are created,
a fake module is created to hold the snippets, since snippets do not come
from any one module. This property simplifies what is basically just a
heuristic in DocC to a simple factual check.
Added round-trip decoding tests for SymbolGraph.Module.
rdar://95220716

Thanks @bitjammer! Since this change is targeting the release/5.7 branch, can you please update the PR description to follow the template from https://forums.swift.org/t/swift-5-7-release-process/56316?

@swift-ci Please test

authors: bitjammer franklinsch

repo: apple/swift-docc-symbolkit


text:
[Proposal] Improve Result with .success and recoverFailure

Hey,
I want to propose these changes to the Result type.
Implementations: https://github.com/apple/swift/pull/27908, https://github.com/apple/swift/pull/26471
Swift-evolution threads: Never-failing Result Type, Convenience member on Result when when Success is Void
But I have a problem to answer the question regarding the ABI resilience:
What does this changes do, 2 public functions and 1 static var via extensions to the frozen enum, to the ABI?

The Core Team discussed this and has determined that we do not want to bring this proposal up for review while Swift Concurrency is under discussion and may change the way in which Swift code interacts with Result. These can be reconsidered at a later time.

authors: DougGregor hfhbd

repo: apple/swift-evolution


text:
Use U_EXPORT instead of U_EXPORT2 for non-function symbol

U_EXPORT2 uses __cdecl which is for functions only.

@swift-ci test

repo: apple/swift-foundation-icu


text:
[5.1] Add setting to change the swift module loading mode for testing purposes

Cherry-pick of https://github.com/apple/swift-lldb/pull/1331

@swift-ci please test

The linux failure seems unrelated:
swift/stdlib/public/runtime/Metadata.cpp:2717:11: error: use of undeclared identifier 'description'
  assert(!description->hasObjCResilientClassStub());

@swift-ci Please test Linux

repo: apple/swift-lldb


text:
namespace ChannelOptions & fix deprecations

Motivation:
All other NIO repositories now have namespaced ChannelOptions.
Modifications:
Namespace the ChannelOptions and fix the deprecations resulting from namespacing swift-nio's ChannelOptions (and other 2.9.0 changes).
Results:
Fewer warnings.

Looks like you missed a warning.

@Lukasa doh, thanks, done.

@swift-nio-bot test this please

@swift-nio-bot test this please

@swift-nio-bot test this please

Yup, this looks like the replacement to the write methods in the benchmarks actually did substantively regress the performance.

@Lukasa indeed, we're missing import FoundationCompat :D

authors: Lukasa weissi


text:
Fix versions in documentation

The Package(url:versions:) requires a Range<Version> as argument, passing a String to it will fail the package building with this error.

cannot convert value of type 'String' to expected argument type 'Range'

Although Version itself is StringLiteralConvertible, the Range<Version> is not.
Another way to fix it would be something like .Package(url: "…", versions: "1.0.0"..."1.0.2"). But I guess we'd better to keep it simple for demonstration purpose.
See #13 and #17 as well.

The unlabeled parameter was added before we allowed string literal convertibles, so really I should make it labeled for this context.

Used #13. Thank you for your time and sorry we used the other patch.

authors: mxcl onevcat

repo: apple/swift-package-manager


text:
[Workspace] Eliminate suffix from checkouts dirname

We don't expect to ever have two checkouts with same name at a time so
there is no need of a suffix for them.
rdar://problem/46423708

@swift-ci smoke test


text:
Add xfail to ReactiveCocoa 3.0, 3.2, 4.0

Pull Request Description
A few ReactiveCocoa configurations are failing due to SR-7299.
This adds an xfail to the 3.0, 3.2, and 4.0 configurations. (Note: 3.1 has an existing xfail which may or may not still be valid.)

@swift-ci test

repo: apple/swift-source-compat-suite


text:
[Syntax] Provide a generic casting function that can cast any protocol type

This is useful for clients to be able to cast to their own protocol types. This replaces the existing casting functions that were going through existentials.

@swift-ci Please test

Build failed
Swift Test OS X Platform
Git Sha - ebb1a0c1dac923fce56ed47e9514a0ffe587ecbf

The generic cast function has a serious flaw in that it is preferred over a specific cast function that returns non-optional, when optional chaining. I've reverted to original casts and kept only the Syntax constructor that accepts an optional parameter.

@swift-ci Please test

Build failed
Swift Test OS X Platform
Git Sha - ebb1a0c1dac923fce56ed47e9514a0ffe587ecbf

authors: akyrtzi swift-ci

repo: apple/swift-syntax


text:
TaskGroup.addTask seems to not use standard _swift_retain calls

Description
It seems that that TaskGroup.addTask doesn't properly use the _swift_retain runtime calls.
We found this when testing https://github.com/ordo-one/package-benchmark that has hooks added to get metrics for the aggregate number of retain/release calls.
As you can see in the sample code here the number of superfluous releases matches the number of addTask calls exactly, so we assume it is not using the normal _swift_retain runtime hook that package-benchmark uses for measuring.
import Benchmark

let benchmarks = {
    func concurrentWork(tasks: Int) async {
        _ = await withTaskGroup(of: Void.self, returning: Void.self, body: { taskGroup in
            for _ in 0 ..< tasks {
                taskGroup.addTask {
                }
            }

            for await _ in taskGroup {}
        })
    }

    Benchmark("Retain/release deviation",
              configuration: .init(metrics: BenchmarkMetric.arc, maxDuration: .seconds(3))) { _ in
        await concurrentWork(tasks: 789)
    }
}

Steps to reproduce
hassila@max /tmp> gh repo clone ordo-one/external-reproducers
...
hassila@max /tmp> cd external-reproducers/swift/retain-release-diff/
hassila@max /t/e/s/retain-release-diff (main)> swift package benchmark
...
====================================================================================================
Baseline 'Current run'
====================================================================================================

Host 'max.local' with 10 'arm64' processors with 64 GB memory, running:
Darwin Kernel Version 22.3.0: Mon Jan 30 20:38:37 PST 2023; root:xnu-8792.81.3~2/RELEASE_ARM64_T6000

===================
retain-release-diff
===================

Retain/release deviation
╒════════════════════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╤═════════╕
│ Metric                 │      p0 │     p25 │     p50 │     p75 │     p90 │     p99 │    p100 │ Samples │
╞════════════════════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╪═════════╡
│ Releases               │    2368 │    2369 │    2369 │    2369 │    2369 │    2369 │    2373 │    3425 │
├────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Retain / Release Δ     │     789 │     789 │     789 │     789 │     789 │     789 │     793 │    3425 │
├────────────────────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┼─────────┤
│ Retains                │    1579 │    1580 │    1580 │    1580 │    1580 │    1580 │    1580 │    3425 │
╘════════════════════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╧═════════╛

Expected behavior
I expect Retain / Release Δ to be zero for this test.

Environment

Swift compiler version info
swift-driver version: 1.62.15 Apple Swift version 5.7.1 (swiftlang-5.7.1.135.3 clang-1400.0.29.51)
Target: arm64-apple-macosx13.0
Xcode version info
Xcode 14.1
Build version 14B47b
Deployment target: macOS 13

Hmm... for what it's worth swift_retain is the proper way as far as I can tell, and Task does the same. But we can give this a go

Things work just as intended and the "imbalance" in the count is just because objects START at 1 count -- so the "1 more release than retains" is exactly correct.
You could hook the object alloc hook as well:

static HeapObject *_swift_allocObject_(HeapMetadata const *metadata,
                                       size_t requiredSize,
                                       size_t requiredAlignmentMask)
                                       asm("__swift_allocObject_");

and account for that being as-if a 1 count.
Alternatively, showing the delta count just perhaps isn't a good idea to begin with perhaps?

For the record, I did hook up allocObject (as well as tryRetain) and while it removed several discrepancies, it did not seem to fix this specific case...

Hah you're right actually -- tasks don't hit this actually, perhaps you can try hooking
SWIFT_EXPORT_FROM(swift_Concurrency) SWIFT_CC(swift)
AsyncTaskAndContext swift_task_create_common(
    size_t taskCreateFlags,
    TaskOptionRecord *options,
    const Metadata *futureResultType,
    TaskContinuationFunction *function, void *closureContext,
    size_t initialContextSize);

though you'd need to only account for creates of not async let tasks, as those are not reference counted actually.

Tracing.h doesn't support hooks as currently designed. It's built to call os_signpost on Darwin and have no-op stubs elsewhere. I've chatted with @ktoso about how we can potentially allow hooking those.
On Darwin, you could use the compatibility overrides mechanism to do something similar. You can look at the compatibility library for an example of what that looks like: https://github.com/apple/swift/blob/be14c3358a1b9dfaafcc819ceab544aab273f8bb/stdlib/toolchain/Compatibility56/Overrides.cpp#L44. It's not very convenient, but it could be done.

Yeah, hopefully we can come up with something here. In the short term, if you feel like hacking up the Swift runtime, you can add code to the TracingStubs.h code to do whatever you want. Obviously not a good solution for real work, but it would let you experiment at least.

Thanks for the hint about using the compat hooks -- I'll see about introducing a cross platform hooking mechanism here soon.
I kinda feel we can repurpose the issue for this because the title isn't right but there is actual work here.

I have renamed the issue since this has become not about the group doing something wrong, but about exposing those hooks.

authors: hassila ktoso mikeash

repo: apple/swift


text:
[Xcode 14.3] Can't build project when setting SWIFT_OPTIMIZATION_LEVEL as [-O]

Description
I'm encountering problems while building the release version of my project. The debug version builds fine using the -Onone option, but when I try to build the release version using the -O option, I'm running into issues.
Specifically, there are a couple of Swift files that cannot be built with the -O option, such as those containing extension URL. I'm unsure of how to resolve this issue and would appreciate any advice or guidance on how to proceed.
Steps to reproduce
URL+Extension.swift <- can't build
extension URL {
    var queryDictionary: [String: String]? {
        var dic = [String: String]()
        if let items = URLComponents(string: absoluteString)?.queryItems {
            for item in items {
                if let value = item.value {
                    dic[item.name] = value
                }
            }
        }
        return dic.isEmpty ? nil : dic
    }
}

log
4.	While evaluating request ExecuteSILPipelineRequest(Run pipelines { PrepareOptimizationPasses, EarlyModulePasses, HighLevel,Function+EarlyLoopOpt, HighLevel,Module+StackPromote, MidLevel,Function, ClosureSpecialize, LowLevel,Function, LateLoopOpt, SIL Debug Info Generator } on SIL for NinetyNine)
5.	While running pass #17357670 SILModuleTransform "DeadFunctionAndGlobalElimination".
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           0x0000000107b23300 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 56
1  swift-frontend           0x0000000107b222e4 llvm::sys::RunSignalHandlers() + 112
2  swift-frontend           0x0000000107b23910 SignalHandler(int) + 344
3  libsystem_platform.dylib 0x000000018aeeea84 _sigtramp + 56
4  swift-frontend           0x000000010325f65c (anonymous namespace)::DeadFunctionAndGlobalEliminationPass::run() + 424
5  swift-frontend           0x000000010325f65c (anonymous namespace)::DeadFunctionAndGlobalEliminationPass::run() + 424
6  swift-frontend           0x00000001033c54a0 swift::SILPassManager::executePassPipelinePlan(swift::SILPassPipelinePlan const&) + 15312
7  swift-frontend           0x00000001033e6a04 swift::SimpleRequest<swift::ExecuteSILPipelineRequest, std::__1::tuple<> (swift::SILPipelineExecutionDescriptor), (swift::RequestFlags)1>::evaluateRequest(swift::ExecuteSILPipelineRequest const&, swift::Evaluator&) + 56
8  swift-frontend           0x00000001033ccdd4 llvm::Expected<swift::ExecuteSILPipelineRequest::OutputType> swift::Evaluator::getResultUncached<swift::ExecuteSILPipelineRequest>(swift::ExecuteSILPipelineRequest const&) + 484
9  swift-frontend           0x00000001033cf714 swift::runSILOptimizationPasses(swift::SILModule&) + 400
10 swift-frontend           0x0000000102badc10 swift::CompilerInstance::performSILProcessing(swift::SILModule*) + 524
11 swift-frontend           0x0000000102a1151c performCompileStepsPostSILGen(swift::CompilerInstance&, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >, llvm::PointerUnion<swift::ModuleDecl*, swift::SourceFile*>, swift::PrimarySpecificPaths const&, int&, swift::FrontendObserver*) + 1040
12 swift-frontend           0x0000000102a14ab8 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 3288
13 swift-frontend           0x0000000102a12944 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 4308
14 swift-frontend           0x00000001029d768c swift::mainEntry(int, char const**) + 4116
15 dyld                     0x000000018ab67f28 start + 2236

Xcode 14.2 was working fine.
Expected behavior
Build success
Screenshots

Environment

Swift compiler version: 5.8
Xcode version: 14.3
Deployment target: iOS 14.0

Hi ShawnBaek, I am having a very similar compiler error stack. I wonder how did you find out which swift files that can't be built?

I'm also experiencing this issue, it's working fine with 14.2. Every Xcode release is like a lottery now...
@ShawnBaek I'm also wondering how did you find the exact file causing the issue? As @fuermosi777 I'm also having a similar error stack but I can't find the root cause
Thank you

@ShawnBaek I cannot reproduce the crash with a Xcode 14.3 Swift 5.8 compiler. Are you sure the code in your example is not missing anything?
@fuermosi777 @corteggo The stack dump suggests that it tripped over whilst performing an optimization pass over a SIL module, which is roughly a lowered concatenation of all the files in a Swift module; I don’t know of a principled way to narrow in on this sort of crash, but if you manage to pinpoint the cause by chipping away at the codebase or have a project for us to reduce, that would be really helpful!

I am also running into this issue with our app, and it is preventing us from archiving a build for the app store. Happy to provide logs and attempt to debug as well, but it looks exactly like the one the author posted.

@AnthonyLatsis Thanks for your answer
I think so. Because there was no problem with Xcode 14.2.

@corteggo @AnthonyLatsis
I can confirm the SwiftRater issue. My project is currently using SwiftRater, and I didn't realize it but we were still on version 1.9.0. After upgrading to 2.1.0, I am able to build the project with the -O flag again.
@ShawnBaek is there any chance you are using SwiftRater in your project? If so, what version?

This worked for me as well. Thanks so much.

We're running into a similar issue trying to create a RELEASE build for the App Store. In our case, we have no dependency on the SwiftRater project. Builds work fine with Xcode 14.2

I did a bit more digging around the different SwiftRater commits, and I narrowed it down. This is the first commit that works again.
https://github.com/takecian/SwiftRater/commit/41725e21fc5bebeabfc5d210cabbed102f976277
In particular, if you comment out the block
@objc public enum SwiftRaterConditionsMetMode: Int {
    case all
    case any
}

In the SwiftRater file, it'll start throwing the compiler error. Hopefully that'll be enough to help narrow it down.

If you need, I can create a sample project pointing to a fork of the repo with a good commit and a bad commit.

@lilidotshi Thanks for sharing. But I don't use SwiftRater

@ShawnBaek I cannot reproduce the crash with a Xcode 14.3 Swift 5.8 compiler. Are you sure the code in your example is not missing anything?
@fuermosi777 @corteggo The stack dump suggests that it tripped over whilst performing an optimization pass over a SIL module, which is roughly a lowered concatenation of all the files in a Swift module; I don’t know of a principled way to narrow in on this sort of crash, but if you manage to pinpoint the cause by chipping away at the codebase or have a project for us to reduce, that would be really helpful!

@AnthonyLatsis https://github.com/pirder/OptimisationCrashDemo

Here's a swiftpm version of that repro case, repros with swift build -c release crash.zip

I still haven't resolved the issue. There are a total of 286 unused functions in our project. Is this causing the problem?

authors: AnthonyLatsis ShawnBaek corteggo fuermosi777 fullstackuniverse keith kunal30xi lilidotshi pirder


text:
Expanding a closure's type parameter pack into a tuple of metatypes can crash

Description
Performing a pack expansion on a type parameter pack present within a closure's parameters in order to materialize a tuple of its metatypes sometimes crashes the compiler. Compilation can succeed and print (File.T, DiscordLib2CrashingSometimes.T), or crash and result in two distinct backtraces. (There can potentially be more, but I have personally only observed two.)
Reproduction
protocol Protocol {}
struct T: Protocol {}

struct Command<each A: Protocol> {
    let arguments: (repeat (each A).Type)
}

func command<each A: Protocol>(_ handler: (_ arg: repeat each A) -> Void) -> Command<repeat each A> {
    return Command(arguments: (repeat (each A).self))
}

let myCommand = command { (first: T, second: T) in () }
print(myCommand.arguments)

Stack dump
Stack dump:
0.	Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-02-11-a.xctoolchain/usr/bin/swift-frontend -frontend -interpret DiscordLib2CrashingSometimes.swift -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk -empty-abi-descriptor -resource-dir /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-02-11-a.xctoolchain/usr/lib/swift -module-name DiscordLib2CrashingSometimes -target-sdk-version 14.2 -target-sdk-name macosx14.2 -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -external-plugin-path /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/local/lib/swift/host/plugins#/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/usr/bin/swift-plugin-server -plugin-path /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-02-11-a.xctoolchain/usr/lib/swift/host/plugins -plugin-path /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2024-02-11-a.xctoolchain/usr/local/lib/swift/host/plugins
1.	Apple Swift version 5.11-dev (LLVM 1bcf1d71b715d0d, Swift 009a93a0f83dd5c)
2.	Compiling with the current language version
3.	While evaluating request ASTLoweringRequest(Lowering AST to SIL for module DiscordLib2CrashingSometimes)
 #0 0x00000001087867f8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/llvm-project/llvm/lib/Support/Unix/Signals.inc:610:8
 #1 0x0000000108784ce5 llvm::sys::RunSignalHandlers() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/llvm-project/llvm/lib/Support/Signals.cpp:105:18
 #2 0x0000000108786e4e SignalHandler(int) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/llvm-project/llvm/lib/Support/Unix/Signals.inc:413:1
 #3 0x00007ff80da6937d (/usr/lib/system/libsystem_platform.dylib+0x7ff80046937d)
 #4 0x0000000000000000
 #5 0x00000001035e703a swift::Type::Type(swift::TypeBase*) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/Type.h:248:40
 #6 0x00000001035e703a swift::CanType::CanType(swift::TypeBase*) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/Type.h:447:39
 #7 0x00000001035e703a swift::CanType::CanType(swift::TypeBase*) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/Type.h:447:47
 #8 0x00000001035e703a swift::Lowering::AbstractionPattern::AbstractionPattern(swift::SubstitutionMap, swift::CanGenericSignature, swift::CanType) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/SIL/AbstractionPattern.h:588:12
 #9 0x00000001035e703a swift::Lowering::AbstractionPattern::AbstractionPattern(swift::SubstitutionMap, swift::CanGenericSignature, swift::CanType) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/SIL/AbstractionPattern.h:589:49
#10 0x00000001035e703a swift::Lowering::AbstractionPattern::getTupleElementType(unsigned int) const /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SIL/IR/AbstractionPattern.cpp:420:12
#11 0x0000000102dfa9de swift::TupleType::getElementType(unsigned int) const /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/Types.h:2539:12
#12 0x0000000102dfa9de swift::CanTypeWrapper<swift::TupleType>::getElementType(unsigned int) const /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/Types.h:2574:34
#13 0x0000000102dfa9de (anonymous namespace)::Transform::transform(swift::Lowering::RValue&&, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, swift::SILType, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenPoly.cpp:361:49
#14 0x0000000102df7782 swift::Lowering::SILGenFunction::emitOrigToSubstValue(swift::SILLocation, swift::Lowering::RValue&&, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenPoly.cpp:6424:3
#15 0x0000000102dcafba (anonymous namespace)::OrigToSubstComponent::translate(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::RValue&&, swift::Lowering::SGFContext) && /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenLValue.cpp:2619:7
#16 0x0000000102dba4a4 std::__1::vector<swift::Lowering::ManagedValue, std::__1::allocator<swift::Lowering::ManagedValue> >::__destroy_vector::operator()[abi:v160006]() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/vector:445:22
#17 0x0000000102dba4a4 std::__1::vector<swift::Lowering::ManagedValue, std::__1::allocator<swift::Lowering::ManagedValue> >::~vector[abi:v160006]() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/vector:456:67
#18 0x0000000102dba4a4 std::__1::vector<swift::Lowering::ManagedValue, std::__1::allocator<swift::Lowering::ManagedValue> >::~vector[abi:v160006]() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/vector:456:65
#19 0x0000000102dba4a4 swift::Lowering::RValue::~RValue() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/RValue.h:72:7
#20 0x0000000102dba4a4 swift::Lowering::RValue::~RValue() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/RValue.h:72:7
#21 0x0000000102dba4a4 swift::Lowering::TranslationPathComponent::get(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::SGFContext) && /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenLValue.cpp:2580:1
#22 0x0000000102dc01fa swift::Lowering::RValue::isComplete() const & /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/RValue.h:202:38
#23 0x0000000102dc01fa swift::Lowering::RValue::operator=(swift::Lowering::RValue&&) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/RValue.h:146:5
#24 0x0000000102dc01fa swift::Lowering::SILGenFunction::emitLoadOfLValue(swift::SILLocation, swift::Lowering::LValue&&, swift::Lowering::SGFContext, bool) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenLValue.cpp:5110:14
#25 0x0000000102d91095 std::__1::vector<std::__1::unique_ptr<swift::Lowering::PathComponent, std::__1::default_delete<swift::Lowering::PathComponent> >, std::__1::allocator<std::__1::unique_ptr<swift::Lowering::PathComponent, std::__1::default_delete<swift::Lowering::PathComponent> > > >::__destroy_vector::operator()[abi:v160006]() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/vector:445:22
#26 0x0000000102d91095 std::__1::vector<std::__1::unique_ptr<swift::Lowering::PathComponent, std::__1::default_delete<swift::Lowering::PathComponent> >, std::__1::allocator<std::__1::unique_ptr<swift::Lowering::PathComponent, std::__1::default_delete<swift::Lowering::PathComponent> > > >::~vector[abi:v160006]() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/vector:456:67
#27 0x0000000102d91095 std::__1::vector<std::__1::unique_ptr<swift::Lowering::PathComponent, std::__1::default_delete<swift::Lowering::PathComponent> >, std::__1::allocator<std::__1::unique_ptr<swift::Lowering::PathComponent, std::__1::default_delete<swift::Lowering::PathComponent> > > >::~vector[abi:v160006]() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/vector:456:65
#28 0x0000000102d91095 swift::Lowering::LValue::~LValue() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/LValue.h:357:7
#29 0x0000000102d91095 swift::Lowering::LValue::~LValue() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/LValue.h:357:7
#30 0x0000000102d91095 (anonymous namespace)::RValueEmitter::visitMemberRefExpr(swift::MemberRefExpr*, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenExpr.cpp:2573:1
#31 0x0000000102d8cd44 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/ExprNodes.def:0:3
#32 0x0000000102d822ec swift::Lowering::SILGenFunction::emitRValue(swift::Expr*, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenExpr.cpp:0:31
#33 0x0000000102d822ec swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenExpr.cpp:6720:10
#34 0x0000000102df7cc7 swift::Lowering::SILGenFunction::emitRValueAsOrig(swift::Expr*, swift::Lowering::AbstractionPattern, swift::Lowering::TypeLowering const&, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenPoly.cpp:0:23
#35 0x0000000102da1bc7 swift::Lowering::ManagedValue llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SGFContext)>::callback_fn<(anonymous namespace)::RValueEmitter::visitErasureExpr(swift::ErasureExpr*, swift::Lowering::SGFContext)::$_11>(long, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:5
#36 0x0000000102d67569 swift::Lowering::SILGenFunction::emitExistentialErasure(swift::SILLocation, swift::CanType, swift::Lowering::TypeLowering const&, swift::Lowering::TypeLowering const&, llvm::ArrayRef<swift::ProtocolConformanceRef>, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SGFContext)>, bool)::$_6::operator()(swift::SILValue) const /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenConvert.cpp:870:29
#37 0x0000000102d67569 void llvm::function_ref<void (swift::SILValue)>::callback_fn<swift::Lowering::SILGenFunction::emitExistentialErasure(swift::SILLocation, swift::CanType, swift::Lowering::TypeLowering const&, swift::Lowering::TypeLowering const&, llvm::ArrayRef<swift::ProtocolConformanceRef>, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SGFContext)>, bool)::$_6>(long, swift::SILValue) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/llvm-project/llvm/include/llvm/ADT/STLFunctionalExtras.h:45:12
#38 0x0000000102d493f2 swift::Lowering::SGFContext::getAddressForInPlaceInitialization(swift::Lowering::SILGenFunction&, swift::SILLocation) const /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SGFContext.h:95:15
#39 0x0000000102d493f2 swift::Lowering::SILGenBuilder::bufferForExpr(swift::SILLocation, swift::SILType, swift::Lowering::TypeLowering const&, swift::Lowering::SGFContext, llvm::function_ref<void (swift::SILValue)>) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenBuilder.cpp:387:30
#40 0x0000000102d62d2e swift::Lowering::SILGenFunction::emitExistentialErasure(swift::SILLocation, swift::CanType, swift::Lowering::TypeLowering const&, swift::Lowering::TypeLowering const&, llvm::ArrayRef<swift::ProtocolConformanceRef>, swift::Lowering::SGFContext, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SGFContext)>, bool) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenConvert.cpp:0:14
#41 0x0000000102d9875c (anonymous namespace)::RValueEmitter::visitErasureExpr(swift::ErasureExpr*, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenExpr.cpp:2149:25
#42 0x0000000102d8cf2b swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/ExprNodes.def:0:3
#43 0x0000000102d7f2fc swift::Lowering::RValue::isInContext() const & /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/RValue.h:211:57
#44 0x0000000102d7f2fc swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, std::__1::optional<swift::SILLocation>) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenExpr.cpp:413:14
#45 0x0000000102ce7f8b swift::Lowering::ArgumentSource::forwardInto(swift::Lowering::SILGenFunction&, swift::Lowering::Initialization*) && /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/ArgumentSource.cpp:125:1
#46 0x0000000102ce853b swift::Lowering::ArgumentSource::forwardInto(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::Lowering::Initialization*, swift::Lowering::TypeLowering const&) && /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/ArgumentSource.cpp:0:22
#47 0x0000000102d9efd8 swift::Lowering::ArgumentSource::~ArgumentSource() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/ArgumentSource.h:115:22
#48 0x0000000102d9efd8 swift::Lowering::ArgumentSource::~ArgumentSource() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/ArgumentSource.h:114:21
#49 0x0000000102d9efd8 (anonymous namespace)::RValueEmitter::visitCollectionExpr(swift::CollectionExpr*, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenExpr.cpp:4445:5
#50 0x0000000102d8cc7c swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/ExprNodes.def:0:0
#51 0x0000000102d822ec swift::Lowering::SILGenFunction::emitRValue(swift::Expr*, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenExpr.cpp:0:31
#52 0x0000000102d822ec swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenExpr.cpp:6720:10
#53 0x0000000102d2a8a0 swift::isConsumedParameter(swift::ParameterConvention) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/Types.h:4096:3
#54 0x0000000102d2a8a0 swift::SILParameterInfo::isConsumed() const /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/Types.h:4243:12
#55 0x0000000102d2a8a0 (anonymous namespace)::ArgEmitter::emitDirect(swift::Lowering::ArgumentSource&&, swift::SILType, swift::Lowering::AbstractionPattern, swift::SILParameterInfo, std::__1::optional<swift::AnyFunctionType::Param>) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenApply.cpp:3855:18
#56 0x0000000102d2a8a0 (anonymous namespace)::ArgEmitter::emit(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenApply.cpp:3546:5
#57 0x0000000102d17be4 (anonymous namespace)::ArgEmitter::emitSingleArg(swift::Lowering::ArgumentSource&&, swift::Lowering::AbstractionPattern, std::__1::optional<swift::AnyFunctionType::Param>) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenApply.cpp:3409:5
#58 0x0000000102d28b15 (anonymous namespace)::ArgEmitter::emitPreparedArgs(swift::Lowering::PreparedArguments&&, swift::Lowering::AbstractionPattern) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenApply.cpp:0:9
#59 0x0000000102d36643 (anonymous namespace)::CallSite::emit(swift::Lowering::SILGenFunction&, swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, (anonymous namespace)::ParamLowering&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, llvm::SmallVectorImpl<(anonymous namespace)::DelayedArgument>&, swift::ForeignInfo const&) && /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenApply.cpp:0:13
#60 0x0000000102d35d5e llvm::ArrayRef<swift::SILParameterInfo>::empty() const /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/llvm-project/llvm/include/llvm/ADT/ArrayRef.h:160:40
#61 0x0000000102d35d5e (anonymous namespace)::ParamLowering::~ParamLowering() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenApply.cpp:4691:5
#62 0x0000000102d35d5e (anonymous namespace)::ParamLowering::~ParamLowering() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenApply.cpp:4690:20
#63 0x0000000102d35d5e (anonymous namespace)::CallEmission::emitArgumentsForNormalApply(swift::Lowering::AbstractionPattern, swift::CanTypeWrapper<swift::SILFunctionType>, swift::ForeignInfo const&, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, std::__1::optional<swift::SILLocation>&) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenApply.cpp:5371:3
#64 0x0000000102d1bd25 (anonymous namespace)::CallEmission::applyNormalCall(swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenApply.cpp:5097:26
#65 0x0000000102d1bd25 (anonymous namespace)::CallEmission::applyFirstLevelCallee(swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenApply.cpp:5044:10
#66 0x0000000102d1bd25 (anonymous namespace)::CallEmission::apply(swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenApply.cpp:4845:18
#67 0x0000000102d197f2 swift::Lowering::SILGenFunction::emitApplyExpr(swift::ApplyExpr*, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenApply.cpp:6144:1
#68 0x0000000102d8cc59 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/ExprNodes.def:0:0
#69 0x0000000102d82a0f std::__1::vector<swift::Lowering::ManagedValue, std::__1::allocator<swift::Lowering::ManagedValue> >::__destroy_vector::operator()[abi:v160006]() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/vector:445:22
#70 0x0000000102d82a0f std::__1::vector<swift::Lowering::ManagedValue, std::__1::allocator<swift::Lowering::ManagedValue> >::~vector[abi:v160006]() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/vector:456:67
#71 0x0000000102d82a0f std::__1::vector<swift::Lowering::ManagedValue, std::__1::allocator<swift::Lowering::ManagedValue> >::~vector[abi:v160006]() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/vector:456:65
#72 0x0000000102d82a0f swift::Lowering::RValue::~RValue() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/RValue.h:72:7
#73 0x0000000102d82a0f swift::Lowering::RValue::~RValue() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/RValue.h:72:7
#74 0x0000000102d82a0f swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenExpr.cpp:6714:3
#75 0x0000000102e32ff3 swift::Lowering::SILGenTopLevel::visitTopLevelCodeDecl(swift::TopLevelCodeDecl*) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenTopLevel.cpp:0:11
#76 0x0000000102e3101b swift::Lowering::SILGenTopLevel::visitSourceFile(swift::SourceFile*) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenTopLevel.cpp:380:16
#77 0x0000000102e3053d swift::DiverseStackBase::stable_iterator::isValid() const /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/Basic/DiverseStack.h:119:20
#78 0x0000000102e3053d swift::Lowering::Scope::~Scope() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/Scope.h:78:15
#79 0x0000000102e3053d swift::Lowering::Scope::~Scope() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/Scope.h:77:12
#80 0x0000000102e3053d swift::Lowering::SILGenModule::emitEntryPoint(swift::SourceFile*, swift::SILFunction*) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenTopLevel.cpp:88:3
#81 0x0000000102e327e1 swift::Lowering::SILGenModule::emitEntryPoint(swift::SourceFile*) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGenTopLevel.cpp:0:3
#82 0x0000000102d090ce (anonymous namespace)::SILGenModuleRAII::emitSourceFile(swift::SourceFile*) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGen.cpp:1991:11
#83 0x0000000102d090ce swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGen.cpp:2142:13
#84 0x0000000102e1fe41 std::__1::__optional_destruct_base<llvm::SmallVector<swift::SymbolSource, 1u>, false>::~__optional_destruct_base[abi:v160006]() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:247:13
#85 0x0000000102e1fe41 std::__1::__optional_storage_base<llvm::SmallVector<swift::SymbolSource, 1u>, false>::~__optional_storage_base() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:322:8
#86 0x0000000102e1fe41 std::__1::__optional_copy_base<llvm::SmallVector<swift::SymbolSource, 1u>, false>::~__optional_copy_base() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:495:8
#87 0x0000000102e1fe41 std::__1::__optional_move_base<llvm::SmallVector<swift::SymbolSource, 1u>, false>::~__optional_move_base() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:523:8
#88 0x0000000102e1fe41 std::__1::__optional_copy_assign_base<llvm::SmallVector<swift::SymbolSource, 1u>, false>::~__optional_copy_assign_base() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:556:8
#89 0x0000000102e1fe41 std::__1::__optional_move_assign_base<llvm::SmallVector<swift::SymbolSource, 1u>, false>::~__optional_move_assign_base() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:588:8
#90 0x0000000102e1fe41 std::__1::optional<llvm::SmallVector<swift::SymbolSource, 1u> >::~optional() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:631:7
#91 0x0000000102e1fe41 std::__1::optional<llvm::SmallVector<swift::SymbolSource, 1u> >::~optional() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:631:7
#92 0x0000000102e1fe41 swift::ASTLoweringDescriptor::~ASTLoweringDescriptor() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/SILGenRequests.h:50:8
#93 0x0000000102e1fe41 swift::ASTLoweringDescriptor::~ASTLoweringDescriptor() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/SILGenRequests.h:50:8
#94 0x0000000102e1fe41 std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> > swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> > (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/SimpleRequest.h:267:5
#95 0x0000000102e1fe41 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> > (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/SimpleRequest.h:290:20
#96 0x0000000102d0eda9 swift::ASTLoweringRequest::OutputType swift::Evaluator::getResultUncached<swift::ASTLoweringRequest, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()>(swift::ASTLoweringRequest const&, swift::ASTLoweringRequest::OutputType swift::evaluateOrFatal<swift::ASTLoweringRequest>(swift::Evaluator&, swift::ASTLoweringRequest)::'lambda'()) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/Evaluator.h:324:14
#97 0x0000000102d09a79 std::__1::__optional_destruct_base<llvm::SmallVector<swift::SymbolSource, 1u>, false>::~__optional_destruct_base[abi:v160006]() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:247:13
#98 0x0000000102d09a79 std::__1::__optional_storage_base<llvm::SmallVector<swift::SymbolSource, 1u>, false>::~__optional_storage_base() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:322:8
#99 0x0000000102d09a79 std::__1::__optional_copy_base<llvm::SmallVector<swift::SymbolSource, 1u>, false>::~__optional_copy_base() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:495:8
#100 0x0000000102d09a79 std::__1::__optional_move_base<llvm::SmallVector<swift::SymbolSource, 1u>, false>::~__optional_move_base() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:523:8
#101 0x0000000102d09a79 std::__1::__optional_copy_assign_base<llvm::SmallVector<swift::SymbolSource, 1u>, false>::~__optional_copy_assign_base() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:556:8
#102 0x0000000102d09a79 std::__1::__optional_move_assign_base<llvm::SmallVector<swift::SymbolSource, 1u>, false>::~__optional_move_assign_base() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:588:8
#103 0x0000000102d09a79 std::__1::optional<llvm::SmallVector<swift::SymbolSource, 1u> >::~optional() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:631:7
#104 0x0000000102d09a79 std::__1::optional<llvm::SmallVector<swift::SymbolSource, 1u> >::~optional() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/optional:631:7
#105 0x0000000102d09a79 swift::ASTLoweringDescriptor::~ASTLoweringDescriptor() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/SILGenRequests.h:50:8
#106 0x0000000102d09a79 swift::ASTLoweringDescriptor::~ASTLoweringDescriptor() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/SILGenRequests.h:50:8
#107 0x0000000102d09a79 std::__1::__tuple_leaf<0ul, swift::ASTLoweringDescriptor, false>::~__tuple_leaf() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/tuple:293:7
#108 0x0000000102d09a79 std::__1::__tuple_impl<std::__1::__tuple_indices<0ul>, swift::ASTLoweringDescriptor>::~__tuple_impl() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/tuple:479:37
#109 0x0000000102d09a79 std::__1::__tuple_impl<std::__1::__tuple_indices<0ul>, swift::ASTLoweringDescriptor>::~__tuple_impl() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/tuple:479:37
#110 0x0000000102d09a79 std::__1::tuple<swift::ASTLoweringDescriptor>::~tuple() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/tuple:566:28
#111 0x0000000102d09a79 std::__1::tuple<swift::ASTLoweringDescriptor>::~tuple() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/tuple:566:28
#112 0x0000000102d09a79 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> > (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::~SimpleRequest() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/SimpleRequest.h:252:7
#113 0x0000000102d09a79 swift::ASTLoweringRequest::~ASTLoweringRequest() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/SILGenRequests.h:111:7
#114 0x0000000102d09a79 swift::ASTLoweringRequest::~ASTLoweringRequest() /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/include/swift/AST/SILGenRequests.h:111:7
#115 0x0000000102d09a79 swift::performASTLowering(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/SILGen/SILGen.cpp:2165:3
#116 0x000000010262a317 std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >::release[abi:v160006]() /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__memory/unique_ptr.h:288:26
#117 0x000000010262a317 std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >::unique_ptr[abi:v160006](std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >&&) /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__memory/unique_ptr.h:211:20
#118 0x000000010262a317 std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >::unique_ptr[abi:v160006](std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule> >&&) /Applications/Xcode-beta.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX14.2.sdk/usr/include/c++/v1/__memory/unique_ptr.h:211:80
#119 0x000000010262a317 swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/FrontendTool/FrontendTool.cpp:882:52
#120 0x000000010263d7cf withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/FrontendTool/FrontendTool.cpp:1304:25
#121 0x000000010262cc47 performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/FrontendTool/FrontendTool.cpp:0:12
#122 0x000000010262cc47 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/FrontendTool/FrontendTool.cpp:1515:19
#123 0x000000010262b96e swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/FrontendTool/FrontendTool.cpp:2470:19
#124 0x000000010244aecb run_driver(llvm::StringRef, llvm::ArrayRef<char const*>, llvm::ArrayRef<char const*>) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/DriverTool/driver.cpp:0:0
#125 0x000000010244aecb swift::mainEntry(int, char const**) /Users/ec2-user/jenkins/workspace/oss-swift-package-macos/swift/lib/DriverTool/driver.cpp:531:10
#126 0x0000000215fb2386

Expected behavior
I expect the code to print (DiscordLib2CrashingSometimes.T, DiscordLib2CrashingSometimes.T) all the time.
Environment
Apple Swift version 5.11-dev (LLVM 1bcf1d71b715d0d, Swift 009a93a0f83dd5c)
Target: x86_64-apple-macosx14.0
Additional information
The stack dump provided is only one of the observed stack traces. Here is the other one: run_other.txt
Also, I noticed that by removing the second parameter in the code like this:
-let myCommand = command { (first: T, second: T) in () }
+let myCommand = command { (first: T) in () }

You get a different (albeit consistent, phew) compilation error. This might be a separate issue, but I figured I'd note it.

Target: x86_64-apple-macosx14.0

I installed a trunk toolchain (with symbols) in an effort to build with the latest version of the compiler, but it's going through Rosetta (?) for some reason; I am on an Mac with Apple silicon.
The code still intermittently crashes (or suceeds) on the latest stable Xcode at the time of writing, but with (yet) another different stack dump. Luckily, there only seems to be one failure path here:
swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: arm64-apple-macosx14.0
Stack dump: run_swift592.txt
Again, it could be an unrelated or since-solved issue, but I figured I'd note it anyways.

No apparent non-determinism to the crash with a 8bb684628593220 compiler. Reduced example:
struct S<each A> {
  let metatypes: (repeat (each A).Type)

  init() {
    self.metatypes = (repeat (each A).self)
  }
}
let _ = S<Int, Bool>().metatypes

Stack dump:
0.	Program arguments: bin/swift-frontend -debug-diagnostic-names -interpret /Users/mac/Desktop/test.swift
1.	Swift version 5.11-dev (LLVM 87ace14daa2139a, Swift 8bb684628593220)
2.	Compiling with the current language version
3.	While evaluating request ASTLoweringRequest(Lowering AST to SIL for module test)
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           0x000000011586fad8 llvm::sys::PrintStackTrace(llvm::raw_ostream&, int) + 40
1  swift-frontend           0x000000011586df25 llvm::sys::RunSignalHandlers() + 85
2  swift-frontend           0x000000011587012e SignalHandler(int) + 270
3  libsystem_platform.dylib 0x00007ff81bbae37d _sigtramp + 29
4  libsystem_platform.dylib 0x0000000000000001 _sigtramp + 18446603370115701921
5  swift-frontend           0x000000010ce50f4a swift::CanType::isActuallyCanonicalOrNull() const + 138
6  swift-frontend           0x000000010ce50e60 swift::CanType::CanType(swift::Type) + 32
7  swift-frontend           0x000000010ce50e2d swift::CanType::CanType(swift::Type) + 29
8  swift-frontend           0x000000010d5b81e4 swift::CanTypeWrapper<swift::TupleType>::getElementType(unsigned int) const + 52
9  swift-frontend           0x000000010ef58d86 getCanTupleElementType(swift::CanType, unsigned int) + 70
10 swift-frontend           0x000000010ef58af9 swift::Lowering::AbstractionPattern::getTupleElementType(unsigned int) const + 553
11 swift-frontend           0x000000010df4ada3 (anonymous namespace)::Transform::transform(swift::Lowering::RValue&&, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, swift::SILType, swift::Lowering::SGFContext) + 1875
12 swift-frontend           0x000000010df47947 swift::Lowering::SILGenFunction::emitTransformedValue(swift::SILLocation, swift::Lowering::RValue&&, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::AbstractionPattern, swift::CanType, swift::SILType, swift::Lowering::SGFContext) + 391
13 swift-frontend           0x000000010df4778e swift::Lowering::SILGenFunction::emitOrigToSubstValue(swift::SILLocation, swift::Lowering::RValue&&, swift::Lowering::AbstractionPattern, swift::CanType, swift::SILType, swift::Lowering::SGFContext) + 366
14 swift-frontend           0x000000010df475e8 swift::Lowering::SILGenFunction::emitOrigToSubstValue(swift::SILLocation, swift::Lowering::RValue&&, swift::Lowering::AbstractionPattern, swift::CanType, swift::Lowering::SGFContext) + 296
15 swift-frontend           0x000000010dee192a (anonymous namespace)::OrigToSubstComponent::translate(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::RValue&&, swift::Lowering::SGFContext) && + 266
16 swift-frontend           0x000000010dec4a43 swift::Lowering::TranslationPathComponent::get(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::SGFContext) && + 227
17 swift-frontend           0x000000010decd55d swift::Lowering::SILGenFunction::emitLoadOfLValue(swift::SILLocation, swift::Lowering::LValue&&, swift::Lowering::SGFContext, bool) + 1757
18 swift-frontend           0x000000010de643e0 (anonymous namespace)::RValueEmitter::visitMemberRefExpr(swift::MemberRefExpr*, swift::Lowering::SGFContext) + 496
19 swift-frontend           0x000000010de53a90 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 976
20 swift-frontend           0x000000010de44271 swift::Lowering::SILGenFunction::emitRValue(swift::Expr*, swift::Lowering::SGFContext) + 209
21 swift-frontend           0x000000010de44075 swift::Lowering::SILGenFunction::emitExprInto(swift::Expr*, swift::Lowering::Initialization*, std::__1::optional<swift::SILLocation>) + 357
22 swift-frontend           0x000000010de0f51f swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int, bool)::$_0::operator()(swift::Expr*, swift::VarDecl*, bool, std::__1::unique_ptr<swift::Lowering::Initialization, std::__1::default_delete<swift::Lowering::Initialization>>&) const + 671
23 swift-frontend           0x000000010de0ef09 swift::Lowering::SILGenFunction::emitPatternBinding(swift::PatternBindingDecl*, unsigned int, bool) + 1481
24 swift-frontend           0x000000010de0f5f6 swift::Lowering::SILGenFunction::visitPatternBindingDecl(swift::PatternBindingDecl*, bool) + 150
25 swift-frontend           0x000000010de244e2 swift::ASTVisitor<swift::Lowering::SILGenFunction, void, void, void, void, void, void>::visit(swift::Decl*) + 1522
26 swift-frontend           0x000000010dfba9ea swift::Lowering::SILGenTopLevel::visitTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 714
27 swift-frontend           0x000000010dfba1ef swift::ASTVisitor<swift::Lowering::SILGenTopLevel, void, void, void, void, void, void>::visit(swift::Decl*) + 1391
28 swift-frontend           0x000000010dfb798d swift::Lowering::SILGenTopLevel::visitSourceFile(swift::SourceFile*) + 189
29 swift-frontend           0x000000010dfb6d68 swift::Lowering::SILGenModule::emitEntryPoint(swift::SourceFile*, swift::SILFunction*) + 1800
30 swift-frontend           0x000000010dfb999c swift::Lowering::SILGenModule::emitEntryPoint(swift::SourceFile*) + 316
31 swift-frontend           0x000000010dd394ab (anonymous namespace)::SILGenModuleRAII::emitSourceFile(swift::SourceFile*) + 91
32 swift-frontend           0x000000010dd3911e swift::ASTLoweringRequest::evaluate(swift::Evaluator&, swift::ASTLoweringDescriptor) const + 910
33 swift-frontend           0x000000010df96bae std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::callDerived<0ul>(swift::Evaluator&, std::__1::integer_sequence<unsigned long, 0ul>) const + 142
34 swift-frontend           0x000000010df96ac8 swift::SimpleRequest<swift::ASTLoweringRequest, std::__1::unique_ptr<swift::SILModule, std::__1::default_delete<swift::SILModule>> (swift::ASTLoweringDescriptor), (swift::RequestFlags)9>::evaluateRequest(swift::ASTLoweringRequest const&, swift::Evaluator&) + 40
35 swift-frontend           0x000000010dd56d0a llvm::Expected<swift::ASTLoweringRequest::OutputType> swift::Evaluator::getResultUncached<swift::ASTLoweringRequest>(swift::ASTLoweringRequest const&) + 330
36 swift-frontend           0x000000010dd39d88 llvm::Expected<swift::ASTLoweringRequest::OutputType> swift::Evaluator::operator()<swift::ASTLoweringRequest, (void*)0>(swift::ASTLoweringRequest const&) + 40
37 swift-frontend           0x000000010dd39c80 swift::performASTLowering(swift::ModuleDecl*, swift::Lowering::TypeConverter&, swift::SILOptions const&, swift::IRGenOptions const*) + 256
38 swift-frontend           0x000000010cfa040b swift::performCompileStepsPostSema(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 283
39 swift-frontend           0x000000010cfd1863 performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*)::$_28::operator()(swift::CompilerInstance&) const + 147
40 swift-frontend           0x000000010cfd17bd bool llvm::function_ref<bool (swift::CompilerInstance&)>::callback_fn<performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*)::$_28>(long, swift::CompilerInstance&) + 29
41 swift-frontend           0x000000010cfd0c81 llvm::function_ref<bool (swift::CompilerInstance&)>::operator()(swift::CompilerInstance&) const + 33
42 swift-frontend           0x000000010cfcfba8 withSemanticAnalysis(swift::CompilerInstance&, swift::FrontendObserver*, llvm::function_ref<bool (swift::CompilerInstance&)>, bool) + 392
43 swift-frontend           0x000000010cfc8286 performAction(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 1222
44 swift-frontend           0x000000010cfa38a6 performCompile(swift::CompilerInstance&, int&, swift::FrontendObserver*) + 262
45 swift-frontend           0x000000010cfa228f swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 2783
46 swift-frontend           0x000000010ce4f9ff run_driver(llvm::StringRef, llvm::ArrayRef<char const*>, llvm::ArrayRef<char const*>) + 2431
47 swift-frontend           0x000000010ce4e627 swift::mainEntry(int, char const**) + 1543
48 swift-frontend           0x000000010ce4dbd2 main + 34
49 dyld                     0x00007ff81b7f83a6 start + 1942
Segmentation fault: 11

Revisiting this with the Swift 5.10 toolchain shipping in Xcode 15.3 (15E204a), the compiler crashes seem to be non-determinate on my end with the original reproduction code:

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

However, your minimized example crashes in a deterministic fashion.
Thanks for looking into this.

authors: AnthonyLatsis slice