Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-5336] Crash in pattern matching (value extracting as Any) on enum without associated value #47910

Closed
jdhealy opened this issue Jun 29, 2017 · 1 comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself

Comments

@jdhealy
Copy link
Contributor

jdhealy commented Jun 29, 2017

Previous ID SR-5336
Radar None
Original Reporter @jdhealy
Type Bug
Status Closed
Resolution Done
Environment

swiftlang-900.0.45.6, swiftlang-802.0.53, probably more

Additional Detail from JIRA
Votes 0
Component/s Compiler
Labels Bug
Assignee None
Priority Medium

md5: 8ac3aba926029d08757ad7e58c5d5762

Issue Description:

No expectations of this actually being real-world code, but reporting it because it crashes.

/Applications/Xcode-beta.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swiftc -emit-sil - <<-'EOF'
let possibleBool: Bool? = .none
switch (possibleBool) {
case .some(let bool as Any), .none(let bool as Any): dump(bool)
default: break
}
EOF

Crash Logs

0  swift                    0x0000000111cba31a PrintStackTraceSignalHandler(void*) + 42
1  swift                    0x0000000111cb9756 SignalHandler(int) + 662
2  libsystem_platform.dylib 0x00007fffa99adb3a _sigtramp + 26
3  libsystem_platform.dylib 000000000000000000 _sigtramp + 1449469152
4  swift                    0x000000010ef736de void llvm::function_ref<void ((anonymous namespace)::PatternMatchEmission&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, (anonymous namespace)::ClauseRow&)>::callback_fn<swift::Lowering::SILGenFunction::emitSwitchStmt(swift::SwitchStmt*)::$_1>(long, (anonymous namespace)::PatternMatchEmission&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, (anonymous namespace)::ClauseRow&) + 1390
5  swift                    0x000000010ef745b8 (anonymous namespace)::PatternMatchEmission::emitDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, std::__1::function<void (swift::SILLocation)> const&) + 2824
6  swift                    0x000000010ef7e930 std::__1::__function::__func<(anonymous namespace)::PatternMatchEmission::emitSpecializedDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, unsigned int&, unsigned int, std::__1::function<void (swift::SILLocation)> const&)::$_7, std::__1::allocator<(anonymous namespace)::PatternMatchEmission::emitSpecializedDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, unsigned int&, unsigned int, std::__1::function<void (swift::SILLocation)> const&)::$_7>, void (llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>, std::__1::function<void (swift::SILLocation)> const&)>::operator()(llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>&&, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>&&, std::__1::function<void (swift::SILLocation)> const&) + 3680
7  swift                    0x000000010ef7d1df std::__1::__function::__func<(anonymous namespace)::PatternMatchEmission::emitIsDispatch(llvm::ArrayRef<(anonymous namespace)::RowToSpecialize>, swift::Lowering::ConsumableManagedValue, std::__1::function<void (llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>, std::__1::function<void (swift::SILLocation)> const&)> const&, std::__1::function<void (swift::SILLocation)> const&)::$_10, std::__1::allocator<(anonymous namespace)::PatternMatchEmission::emitIsDispatch(llvm::ArrayRef<(anonymous namespace)::RowToSpecialize>, swift::Lowering::ConsumableManagedValue, std::__1::function<void (llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>, std::__1::function<void (swift::SILLocation)> const&)> const&, std::__1::function<void (swift::SILLocation)> const&)::$_10>, void (swift::Lowering::ManagedValue)>::operator()(swift::Lowering::ManagedValue&&) + 95
8  swift                    0x000000010ef27dae swift::Lowering::SILGenFunction::emitCheckedCastBranchOld(swift::SILLocation, swift::Lowering::ConsumableManagedValue, swift::Type, swift::CanType, swift::Lowering::SGFContext, std::__1::function<void (swift::Lowering::ManagedValue)>, std::__1::function<void ()>) + 2894
9  swift                    0x000000010ef77caf (anonymous namespace)::PatternMatchEmission::emitSpecializedDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, unsigned int&, unsigned int, std::__1::function<void (swift::SILLocation)> const&) + 8047
10 swift                    0x000000010ef73f58 (anonymous namespace)::PatternMatchEmission::emitDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, std::__1::function<void (swift::SILLocation)> const&) + 1192
11 swift                    0x000000010ef7e930 std::__1::__function::__func<(anonymous namespace)::PatternMatchEmission::emitSpecializedDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, unsigned int&, unsigned int, std::__1::function<void (swift::SILLocation)> const&)::$_7, std::__1::allocator<(anonymous namespace)::PatternMatchEmission::emitSpecializedDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, unsigned int&, unsigned int, std::__1::function<void (swift::SILLocation)> const&)::$_7>, void (llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>, std::__1::function<void (swift::SILLocation)> const&)>::operator()(llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>&&, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>&&, std::__1::function<void (swift::SILLocation)> const&) + 3680
12 swift                    0x000000010ef79450 (anonymous namespace)::PatternMatchEmission::emitSpecializedDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, unsigned int&, unsigned int, std::__1::function<void (swift::SILLocation)> const&) + 14096
13 swift                    0x000000010ef73f58 (anonymous namespace)::PatternMatchEmission::emitDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, std::__1::function<void (swift::SILLocation)> const&) + 1192
14 swift                    0x000000010ef72a76 swift::Lowering::SILGenFunction::emitSwitchStmt(swift::SwitchStmt*) + 2358
15 swift                    0x000000010eecc991 swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 385
16 swift                    0x000000010eecbb2b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 1115
17 swift                    0x000000010eecd4bc swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 860
18 swift                    0x000000010e68691d performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 12941
19 swift                    0x000000010e681e24 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 7332
20 swift                    0x000000010e637ab8 main + 12248
21 libdyld.dylib            0x00007fffa979e235 start + 1
0  swift                    0x000000010ee154f7 PrintStackTraceSignalHandler(void*) + 39
1  swift                    0x000000010ee149a6 SignalHandler(int) + 646
2  libsystem_platform.dylib 0x00007fffa99adb3a _sigtramp + 26
3  swift                    0x000000010ede8b77 (anonymous namespace)::RawMemoryObject::readBytes(unsigned char*, unsigned long long, unsigned long long) const + 55
4  swift                    0x000000010c867172 (anonymous namespace)::LowerType::visitAnyStructType(swift::CanType, swift::StructDecl*) + 50
5  swift                    0x000000010c86677c swift::Lowering::TypeConverter::getTypeLoweringForUncachedLoweredType(swift::Lowering::TypeConverter::TypeKey) + 76
6  swift                    0x000000010c8686ed swift::Lowering::TypeConverter::getTypeLowering(swift::SILType) + 221
7  swift                    0x000000010c40674f swift::Lowering::ManagedValue::forwardInto(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::SILValue) + 143
8  swift                    0x000000010c463f1e (anonymous namespace)::LetValueInitialization::copyOrInitValueInto(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, bool) + 158
9  swift                    0x000000010c40b3ce void copyOrInitValuesInto<((anonymous namespace)::ImplodeKind)1>(swift::Lowering::Initialization*, llvm::ArrayRef<swift::Lowering::ManagedValue>&, swift::CanType, swift::SILLocation, swift::Lowering::SILGenFunction&) + 734
10 swift                    0x000000010c40b0e1 swift::Lowering::RValue::forwardInto(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::Initialization*) && + 81
11 swift                    0x000000010c4b666a (anonymous namespace)::PatternMatchEmission::bindVariable(swift::SILLocation, swift::VarDecl*, swift::Lowering::ConsumableManagedValue, swift::CanType, bool, bool) + 282
12 swift                    0x000000010c4b1a53 (anonymous namespace)::PatternMatchEmission::emitDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, std::__1::function<void (swift::SILLocation)> const&) + 4115
13 swift                    0x000000010c4b94d3 std::__1::__function::__func<(anonymous namespace)::PatternMatchEmission::emitSpecializedDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, unsigned int&, unsigned int, std::__1::function<void (swift::SILLocation)> const&)::$_7, std::__1::allocator<(anonymous namespace)::PatternMatchEmission::emitSpecializedDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, unsigned int&, unsigned int, std::__1::function<void (swift::SILLocation)> const&)::$_7>, void (llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>, std::__1::function<void (swift::SILLocation)> const&)>::operator()(llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>&&, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>&&, std::__1::function<void (swift::SILLocation)> const&) + 3219
14 swift                    0x000000010c4b81aa std::__1::__function::__func<(anonymous namespace)::PatternMatchEmission::emitIsDispatch(llvm::ArrayRef<(anonymous namespace)::RowToSpecialize>, swift::Lowering::ConsumableManagedValue, std::__1::function<void (llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>, std::__1::function<void (swift::SILLocation)> const&)> const&, std::__1::function<void (swift::SILLocation)> const&)::$_10, std::__1::allocator<(anonymous namespace)::PatternMatchEmission::emitIsDispatch(llvm::ArrayRef<(anonymous namespace)::RowToSpecialize>, swift::Lowering::ConsumableManagedValue, std::__1::function<void (llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>, std::__1::function<void (swift::SILLocation)> const&)> const&, std::__1::function<void (swift::SILLocation)> const&)::$_10>, void (swift::Lowering::ManagedValue)>::operator()(swift::Lowering::ManagedValue&&) + 90
15 swift                    0x000000010c47148e (anonymous namespace)::CheckedCastEmitter::emitConditional(swift::Lowering::ManagedValue, swift::CastConsumptionKind, swift::Lowering::SGFContext, std::__1::function<void (swift::Lowering::ManagedValue)> const&, std::__1::function<void ()> const&) + 2638
16 swift                    0x000000010c471a9c swift::Lowering::SILGenFunction::emitCheckedCastBranch(swift::SILLocation, swift::Lowering::ConsumableManagedValue, swift::Type, swift::CanType, swift::Lowering::SGFContext, std::__1::function<void (swift::Lowering::ManagedValue)>, std::__1::function<void ()>) + 140
17 swift                    0x000000010c4b4f83 (anonymous namespace)::PatternMatchEmission::emitDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, std::__1::function<void (swift::SILLocation)> const&) + 17731
18 swift                    0x000000010c4b94d3 std::__1::__function::__func<(anonymous namespace)::PatternMatchEmission::emitSpecializedDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, unsigned int&, unsigned int, std::__1::function<void (swift::SILLocation)> const&)::$_7, std::__1::allocator<(anonymous namespace)::PatternMatchEmission::emitSpecializedDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, unsigned int&, unsigned int, std::__1::function<void (swift::SILLocation)> const&)::$_7>, void (llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>, std::__1::function<void (swift::SILLocation)> const&)>::operator()(llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>&&, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>&&, std::__1::function<void (swift::SILLocation)> const&) + 3219
19 swift                    0x000000010c4b3df4 (anonymous namespace)::PatternMatchEmission::emitDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, std::__1::function<void (swift::SILLocation)> const&) + 13236
20 swift                    0x000000010c4afc03 swift::Lowering::SILGenFunction::emitSwitchStmt(swift::SwitchStmt*) + 2419
21 swift                    0x000000010c421d0e swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 398
22 swift                    0x000000010c420ecb swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 1483
23 swift                    0x000000010c422aa9 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 1593
24 swift                    0x000000010bc33604 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 42516
25 swift                    0x000000010bbe2d6c main + 9052
26 libdyld.dylib            0x00007fffa979e235 start + 1
Stack dump:
0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -emit-sil -primary-file - -target x86_64-apple-macosx10.9 -enable-objc-interop -module-name main -o - 
0  swift                    0x00000001085694f7 PrintStackTraceSignalHandler(void*) + 39
1  swift                    0x00000001085689a6 SignalHandler(int) + 646
2  libsystem_platform.dylib 0x00007fffa99adb3a _sigtramp + 26
3  swift                    0x000000010853cb77 (anonymous namespace)::RawMemoryObject::readBytes(unsigned char*, unsigned long long, unsigned long long) const + 55
4  swift                    0x0000000105fbb172 (anonymous namespace)::LowerType::visitAnyStructType(swift::CanType, swift::StructDecl*) + 50
5  swift                    0x0000000105fba77c swift::Lowering::TypeConverter::getTypeLoweringForUncachedLoweredType(swift::Lowering::TypeConverter::TypeKey) + 76
6  swift                    0x0000000105fbc6ed swift::Lowering::TypeConverter::getTypeLowering(swift::SILType) + 221
7  swift                    0x0000000105b5a74f swift::Lowering::ManagedValue::forwardInto(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::SILValue) + 143
8  swift                    0x0000000105bb7f1e (anonymous namespace)::LetValueInitialization::copyOrInitValueInto(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, bool) + 158
9  swift                    0x0000000105b5f3ce void copyOrInitValuesInto<((anonymous namespace)::ImplodeKind)1>(swift::Lowering::Initialization*, llvm::ArrayRef<swift::Lowering::ManagedValue>&, swift::CanType, swift::SILLocation, swift::Lowering::SILGenFunction&) + 734
10 swift                    0x0000000105b5f0e1 swift::Lowering::RValue::forwardInto(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::Initialization*) && + 81
11 swift                    0x0000000105c0a66a (anonymous namespace)::PatternMatchEmission::bindVariable(swift::SILLocation, swift::VarDecl*, swift::Lowering::ConsumableManagedValue, swift::CanType, bool, bool) + 282
12 swift                    0x0000000105c05a53 (anonymous namespace)::PatternMatchEmission::emitDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, std::__1::function<void (swift::SILLocation)> const&) + 4115
13 swift                    0x0000000105c0d4d3 std::__1::__function::__func<(anonymous namespace)::PatternMatchEmission::emitSpecializedDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, unsigned int&, unsigned int, std::__1::function<void (swift::SILLocation)> const&)::$_7, std::__1::allocator<(anonymous namespace)::PatternMatchEmission::emitSpecializedDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, unsigned int&, unsigned int, std::__1::function<void (swift::SILLocation)> const&)::$_7>, void (llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>, std::__1::function<void (swift::SILLocation)> const&)>::operator()(llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>&&, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>&&, std::__1::function<void (swift::SILLocation)> const&) + 3219
14 swift                    0x0000000105c0c1aa std::__1::__function::__func<(anonymous namespace)::PatternMatchEmission::emitIsDispatch(llvm::ArrayRef<(anonymous namespace)::RowToSpecialize>, swift::Lowering::ConsumableManagedValue, std::__1::function<void (llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>, std::__1::function<void (swift::SILLocation)> const&)> const&, std::__1::function<void (swift::SILLocation)> const&)::$_10, std::__1::allocator<(anonymous namespace)::PatternMatchEmission::emitIsDispatch(llvm::ArrayRef<(anonymous namespace)::RowToSpecialize>, swift::Lowering::ConsumableManagedValue, std::__1::function<void (llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>, std::__1::function<void (swift::SILLocation)> const&)> const&, std::__1::function<void (swift::SILLocation)> const&)::$_10>, void (swift::Lowering::ManagedValue)>::operator()(swift::Lowering::ManagedValue&&) + 90
15 swift                    0x0000000105bc548e (anonymous namespace)::CheckedCastEmitter::emitConditional(swift::Lowering::ManagedValue, swift::CastConsumptionKind, swift::Lowering::SGFContext, std::__1::function<void (swift::Lowering::ManagedValue)> const&, std::__1::function<void ()> const&) + 2638
16 swift                    0x0000000105bc5a9c swift::Lowering::SILGenFunction::emitCheckedCastBranch(swift::SILLocation, swift::Lowering::ConsumableManagedValue, swift::Type, swift::CanType, swift::Lowering::SGFContext, std::__1::function<void (swift::Lowering::ManagedValue)>, std::__1::function<void ()>) + 140
17 swift                    0x0000000105c08f83 (anonymous namespace)::PatternMatchEmission::emitDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, std::__1::function<void (swift::SILLocation)> const&) + 17731
18 swift                    0x0000000105c0d4d3 std::__1::__function::__func<(anonymous namespace)::PatternMatchEmission::emitSpecializedDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, unsigned int&, unsigned int, std::__1::function<void (swift::SILLocation)> const&)::$_7, std::__1::allocator<(anonymous namespace)::PatternMatchEmission::emitSpecializedDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, unsigned int&, unsigned int, std::__1::function<void (swift::SILLocation)> const&)::$_7>, void (llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>, std::__1::function<void (swift::SILLocation)> const&)>::operator()(llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>&&, llvm::ArrayRef<(anonymous namespace)::SpecializedRow>&&, std::__1::function<void (swift::SILLocation)> const&) + 3219
19 swift                    0x0000000105c07df4 (anonymous namespace)::PatternMatchEmission::emitDispatch((anonymous namespace)::ClauseMatrix&, llvm::ArrayRef<swift::Lowering::ConsumableManagedValue>, std::__1::function<void (swift::SILLocation)> const&) + 13236
20 swift                    0x0000000105c03c03 swift::Lowering::SILGenFunction::emitSwitchStmt(swift::SwitchStmt*) + 2419
21 swift                    0x0000000105b75d0e swift::ASTVisitor<swift::Lowering::SILGenModule, void, void, void, void, void, void>::visit(swift::Decl*) + 398
22 swift                    0x0000000105b74ecb swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 1483
23 swift                    0x0000000105b76aa9 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool, bool) + 1593
24 swift                    0x0000000105387604 swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 42516
25 swift                    0x0000000105336d6c main + 9052
26 libdyld.dylib            0x00007fffa979e235 start + 1
Stack dump:
0.  Program arguments: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/swift -frontend -emit-sil -primary-file - -target x86_64-apple-macosx10.9 -enable-objc-interop -module-name main -o - 
@jdhealy
Copy link
Contributor Author

jdhealy commented Jun 29, 2017

/Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2017-06-12-a.xctoolchain/usr/bin/swiftc -emit-sil - <<-'EOF'
let possibleBool: Bool? = .none
switch (possibleBool) {
case .some(let bool as Any), .none(let bool as Any): dump(bool)
default: break
}
EOF
<stdin>:3:31: error: pattern with associated values does not match enum case 'none'
case .some(let bool as Any), .none(let bool as Any): dump(bool)
                           ^
<stdin>:3:31: note: remove associated values to make the pattern match
case .some(let bool as Any), .none(let bool as Any): dump(bool)
                           ^   ~~~~~~~~~~~~~~~~~

<stdin>:3:40: error: pattern variable bound to type '<<error type>>', expected type 'Any'
case .some(let bool as Any), .none(let bool as Any): dump(bool)

Just checked a toolchain and saw the expected behavior, very cool. Closing this.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. compiler The Swift compiler in itself
Projects
None yet
Development

No branches or pull requests

1 participant