Segmentation fault: 11 (on associatedtype constraint with enum)

Xcode: Version 11.3.1 (11C504)
Swift Language Version: 5

Code:

import Foundation

protocol ChangeReason: RawRepresentable, Equatable {

}

enum State<T>: Equatable where T: ChangeReason {

case foo(reason: T?= nil )

}

protocol Link {

associatedtype Reason: ChangeReason

}

enum BleLinkStateReason: Int, ChangeReason {

typealias RawValue = Int

case bar

}

protocol BleLink: Link where Reason == BleLinkStateReason {

associatedtype Reason: BleLinkStateReason

}

Stack dump:
0. Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -c -primary-file /Projects/TestTerminal/TestTerminal/main.swift -emit-module-path /Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Intermediates.noindex/TestTerminal.build/Debug/TestTerminal.build/Objects-normal/x86_64/main~partial.swiftmodule -emit-module-doc-path /Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Intermediates.noindex/TestTerminal.build/Debug/TestTerminal.build/Objects-normal/x86_64/main~partial.swiftdoc -serialize-diagnostics-path /Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Intermediates.noindex/TestTerminal.build/Debug/TestTerminal.build/Objects-normal/x86_64/main.dia -emit-dependencies-path /Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Intermediates.noindex/TestTerminal.build/Debug/TestTerminal.build/Objects-normal/x86_64/main.d -emit-reference-dependencies-path /Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Intermediates.noindex/TestTerminal.build/Debug/TestTerminal.build/Objects-normal/x86_64/main.swiftdeps -target x86_64-apple-macos10.14 -enable-objc-interop -sdk /Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.15.sdk -I /Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Products/Debug -F /Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Products/Debug -enable-testing -g -module-cache-path /Library/Developer/Xcode/DerivedData/ModuleCache.noindex -swift-version 5 -enforce-exclusivity=checked -Onone -D DEBUG -serialize-debugging-options -Xcc -working-directory -Xcc /Projects/TestTerminal -enable-anonymous-context-mangled-names -Xcc -I/Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Intermediates.noindex/TestTerminal.build/Debug/TestTerminal.build/swift-overrides.hmap -Xcc -iquote -Xcc /Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Intermediates.noindex/TestTerminal.build/Debug/TestTerminal.build/TestTerminal-generated-files.hmap -Xcc -I/Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Intermediates.noindex/TestTerminal.build/Debug/TestTerminal.build/TestTerminal-own-target-headers.hmap -Xcc -I/Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Intermediates.noindex/TestTerminal.build/Debug/TestTerminal.build/TestTerminal-all-target-headers.hmap -Xcc -iquote -Xcc /Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Intermediates.noindex/TestTerminal.build/Debug/TestTerminal.build/TestTerminal-project-headers.hmap -Xcc -I/Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Products/Debug/include -Xcc -I/Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Intermediates.noindex/TestTerminal.build/Debug/TestTerminal.build/DerivedSources-normal/x86_64 -Xcc -I/Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Intermediates.noindex/TestTerminal.build/Debug/TestTerminal.build/DerivedSources/x86_64 -Xcc -I/Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Intermediates.noindex/TestTerminal.build/Debug/TestTerminal.build/DerivedSources -Xcc -DDEBUG=1 -module-name TestTerminal -o /Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Build/Intermediates.noindex/TestTerminal.build/Debug/TestTerminal.build/Objects-normal/x86_64/main.o -index-store-path /Library/Developer/Xcode/DerivedData/TestTerminal-dczoxeadorsrqffoieetctzlqcdy/Index/DataStore -index-system-modules

  1. While type-checking 'BleLink' (at /Projects/TestTerminal/TestTerminal/main.swift:20:1)
  2. While validating 'BleLink' (at /Projects/TestTerminal/TestTerminal/main.swift:20:1)
    0 swift 0x0000000107742a63 PrintStackTraceSignalHandler(void*) + 51
    1 swift 0x0000000107742236 SignalHandler(int) + 358
    2 libsystem_platform.dylib 0x00007fff587c6b5d _sigtramp + 29
    3 libsystem_platform.dylib 000000000000000000 _sigtramp + 2810418368
    4 swift 0x00000001042d8402 formProtocolRelativeType(swift::ProtocolDecl*, swift::Type, swift::Type) + 354
    5 swift 0x00000001042d8402 formProtocolRelativeType(swift::ProtocolDecl*, swift::Type, swift::Type) + 354
    6 swift 0x00000001042d7967 swift::GenericSignatureBuilder::FloatingRequirementSource::getSource(swift::GenericSignatureBuilder&, swift::Type) const + 455
    7 swift 0x00000001042d58a3 swift::GenericSignatureBuilder::addTypeRequirement(llvm::PointerUnion<swift::GenericSignatureBuilder::PotentialArchetype*, swift::Type>, llvm::PointerUnion<swift::GenericSignatureBuilder::PotentialArchetype*, swift::Type>, swift::GenericSignatureBuilder::FloatingRequirementSource, swift::GenericSignatureBuilder::UnresolvedHandlingKind, swift::ModuleDecl*) + 3123
    8 swift 0x00000001042de89b swift::GenericSignatureBuilder::ConstraintResult llvm::function_ref<swift::GenericSignatureBuilder::ConstraintResult (swift::Type, swift::TypeRepr const*)>::callback_fn<swift::GenericSignatureBuilder::addInheritedRequirements(swift::TypeDecl*, llvm::PointerUnion<swift::GenericSignatureBuilder::PotentialArchetype*, swift::Type>, swift::GenericSignatureBuilder::RequirementSource const*, swift::ModuleDecl*)::$_34>(long, swift::Type, swift::TypeRepr const*) + 475
    9 swift 0x00000001042dea0b std::__1::__function::__func<visitInherited(llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>, llvm::function_ref<swift::GenericSignatureBuilder::ConstraintResult (swift::Type, swift::TypeRepr const*)>)::$_73, std::__1::allocator<visitInherited(llvm::PointerUnion<swift::TypeDecl*, swift::ExtensionDecl*>, llvm::function_ref<swift::GenericSignatureBuilder::ConstraintResult (swift::Type, swift::TypeRepr const*)>)::$_73>, void (swift::Type, swift::TypeRepr const*)>::operator()(swift::Type&&, swift::TypeRepr const*&&) + 155
    10 swift 0x00000001042dcf0d swift::GenericSignatureBuilder::addInheritedRequirements(swift::TypeDecl*, llvm::PointerUnion<swift::GenericSignatureBuilder::PotentialArchetype*, swift::Type>, swift::GenericSignatureBuilder::RequirementSource const*, swift::ModuleDecl*) + 621
    11 swift 0x00000001042dabab swift::GenericSignatureBuilder::expandConformanceRequirement(swift::GenericSignatureBuilder::ResolvedType, swift::ProtocolDecl*, swift::GenericSignatureBuilder::RequirementSource const*, bool) + 1243
    12 swift 0x00000001042d55c1 swift::GenericSignatureBuilder::addTypeRequirement(llvm::PointerUnion<swift::GenericSignatureBuilder::PotentialArchetype*, swift::Type>, llvm::PointerUnion<swift::GenericSignatureBuilder::PotentialArchetype*, swift::Type>, swift::GenericSignatureBuilder::FloatingRequirementSource, swift::GenericSignatureBuilder::UnresolvedHandlingKind, swift::ModuleDecl*) + 2385
    13 swift 0x00000001042dc8df swift::GenericSignatureBuilder::addRequirement(swift::Requirement const&, swift::RequirementRepr const*, swift::GenericSignatureBuilder::FloatingRequirementSource, swift::SubstitutionMap const*, swift::ModuleDecl*) + 1199
    14 swift 0x00000001042873c1 swift::ProtocolDecl::computeRequirementSignature() + 2049
    15 swift 0x0000000103f1c6cb swift::TypeChecker::validateGenericTypeSignature(swift::GenericTypeDecl*) + 75
    16 swift 0x0000000103ee493d swift::TypeChecker::validateDecl(swift::ValueDecl*) + 893
    17 swift 0x0000000103edddc1 (anonymous namespace)::DeclChecker::visit(swift::Decl*) + 2241
    18 swift 0x0000000103f9dbc6 swift::performTypeChecking(swift::SourceFile&, swift::TopLevelContext&, swift::OptionSet<swift::TypeCheckingFlags, unsigned int>, unsigned int, unsigned int, unsigned int, unsigned int, unsigned int) + 1702
    19 swift 0x0000000103690117 swift::CompilerInstance::performSemaUpTo(swift::SourceFile::ASTStage_t) + 4679
    20 swift 0x0000000103383d66 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 806
    21 swift 0x0000000103380234 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 6820
    22 swift 0x000000010330d733 main + 1219
    23 libdyld.dylib 0x00007fff585db3d5 start + 1
    24 libdyld.dylib 0x0000000000000047 start + 2812431475
    error: Segmentation fault: 11 (in target 'TestTerminal' from project 'TestTerminal')

Huh, I thought this was fixed (SR-12072), but perhaps we regressed. Do you find filing a bug report at bugs.swift.org?

I filed a bug report (SR-12199)

1 Like