Very interesting! I tested your program (and all the other examples in this thread) with a recent development snapshot and it turns out that all these examples crashes recent versions of the compiler. So something has changes since the default toolchain of Xcode 9.3 beta 4 (which is the last version I have access to that successfully compiles these programs).
(Including this again for completeness: SR-7220 )
The compiler crash looks similar for all examples:
Assertion failed: (value && "No value specified"), function forUnmanaged, file /Users/buildnode/jenkins/workspace/oss-swift-package-osx/swift/lib/SILGen/ManagedValue.h, line 91.
0 swift 0x0000000108fcd2c8 llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 40
1 swift 0x0000000108fcd9d6 SignalHandler(int) + 694
2 libsystem_platform.dylib 0x00007fff6e86df5a _sigtramp + 26
3 libsystem_platform.dylib 0x0000000000000009 _sigtramp + 2440634569
4 libsystem_c.dylib 0x00007fff6e698312 abort + 127
5 libsystem_c.dylib 0x00007fff6e660368 basename_r + 0
6 swift 0x0000000105fc9997 swift::Lowering::LogicalPathComponent::writeback(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::MaterializedLValue, bool) + 983
7 swift 0x0000000105fd9a9b (anonymous namespace)::GetterSetterComponent::writeback(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::ManagedValue, swift::Lowering::MaterializedLValue, bool) + 219
8 swift 0x0000000105fd6a26 (anonymous namespace)::LValueWritebackCleanup::emit(swift::Lowering::SILGenFunction&, swift::CleanupLocation) + 262
9 swift 0x0000000105f27668 swift::Lowering::CleanupManager::emitCleanups(swift::DiverseStackBase::stable_iterator, swift::CleanupLocation, bool) + 296
10 swift 0x0000000105f27a2b swift::Lowering::CleanupManager::emitBranchAndCleanups(swift::Lowering::JumpDest, swift::SILLocation, llvm::ArrayRef<swift::SILValue>) + 91
11 swift 0x0000000105f34e0a swift::Lowering::SwitchCaseFullExpr::exitAndBranch(swift::SILLocation, llvm::ArrayRef<swift::SILValue>) + 314
12 swift 0x0000000105fbe58d std::__1::__function::__func<swift::Lowering::SILGenFunction::emitBindOptional(swift::SILLocation, swift::Lowering::ManagedValue, unsigned int)::$_2, std::__1::allocator<swift::Lowering::SILGenFunction::emitBindOptional(swift::SILLocation, swift::Lowering::ManagedValue, unsigned int)::$_2>, void (swift::Lowering::ManagedValue, swift::Lowering::SwitchCaseFullExpr&&)>::operator()(swift::Lowering::ManagedValue&&, swift::Lowering::SwitchCaseFullExpr&&) + 61
13 swift 0x0000000105f35864 swift::Lowering::SwitchEnumBuilder::emit() && + 1812
14 swift 0x0000000105fa95d7 swift::Lowering::SILGenFunction::emitBindOptional(swift::SILLocation, swift::Lowering::ManagedValue, unsigned int) + 599
15 swift 0x0000000105fd1a08 SILGenLValue::visitBindOptionalExpr(swift::BindOptionalExpr*, swift::AccessKind, swift::Lowering::LValueOptions) + 440
16 swift 0x0000000105fcd283 swift::ASTVisitor<SILGenLValue, swift::Lowering::LValue, void, void, void, void, void, swift::AccessKind, swift::Lowering::LValueOptions>::visit(swift::Expr*, swift::AccessKind, swift::Lowering::LValueOptions) + 499
17 swift 0x0000000105fcd67f SILGenLValue::visitRec(swift::Expr*, swift::AccessKind, swift::Lowering::LValueOptions, swift::Lowering::AbstractionPattern) + 223
18 swift 0x0000000105fcfbea SILGenLValue::visitMemberRefExpr(swift::MemberRefExpr*, swift::AccessKind, swift::Lowering::LValueOptions) + 250
19 swift 0x0000000105fcd25a swift::ASTVisitor<SILGenLValue, swift::Lowering::LValue, void, void, void, void, void, swift::AccessKind, swift::Lowering::LValueOptions>::visit(swift::Expr*, swift::AccessKind, swift::Lowering::LValueOptions) + 458
20 swift 0x0000000105fccfce swift::Lowering::SILGenFunction::emitLValue(swift::Expr*, swift::AccessKind, swift::Lowering::LValueOptions) + 46
21 swift 0x0000000105fbcf86 emitSimpleAssignment(swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Expr*, swift::Expr*) + 1206
22 swift 0x0000000105fad5ea swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 5146
23 swift 0x0000000105fa1589 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 57
24 swift 0x0000000105f8231d swift::Lowering::SILGenFunction::emitOptionalSome(swift::SILLocation, swift::SILType, llvm::function_ref<swift::Lowering::ManagedValue (swift::Lowering::SILGenFunction&, swift::SILLocation, swift::Lowering::SGFContext)>, swift::Lowering::SGFContext) + 525
25 swift 0x0000000105fb2039 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 24169
26 swift 0x0000000105fa1589 swift::Lowering::SILGenFunction::emitRValueAsSingleValue(swift::Expr*, swift::Lowering::SGFContext) + 57
27 swift 0x0000000105fbaa4b void llvm::function_ref<void (llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, swift::Lowering::SGFContext)>::callback_fn<(anonymous namespace)::RValueEmitter::visitOptionalEvaluationExpr(swift::OptionalEvaluationExpr*, swift::Lowering::SGFContext)::$_14>(long, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, swift::Lowering::SGFContext) + 123
28 swift 0x0000000105fa9bca swift::Lowering::SILGenFunction::emitOptionalEvaluation(swift::SILLocation, swift::Type, llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, swift::Lowering::SGFContext, llvm::function_ref<void (llvm::SmallVectorImpl<swift::Lowering::ManagedValue>&, swift::Lowering::SGFContext)>) + 794
29 swift 0x0000000105fae0f1 swift::ASTVisitor<(anonymous namespace)::RValueEmitter, swift::Lowering::RValue, void, void, void, void, void, swift::Lowering::SGFContext>::visit(swift::Expr*, swift::Lowering::SGFContext) + 7969
30 swift 0x0000000105fa1b47 swift::Lowering::SILGenFunction::emitIgnoredExpr(swift::Expr*) + 1287
31 swift 0x0000000105f3f254 swift::Lowering::SILGenModule::visitTopLevelCodeDecl(swift::TopLevelCodeDecl*) + 388
32 swift 0x0000000105f3fa5b swift::Lowering::SILGenModule::emitSourceFile(swift::SourceFile*, unsigned int) + 827
33 swift 0x0000000105f40810 swift::SILModule::constructSIL(swift::ModuleDecl*, swift::SILOptions&, swift::FileUnit*, llvm::Optional<unsigned int>, bool) + 352
34 swift 0x0000000105f40e1f swift::performSILGeneration(swift::FileUnit&, swift::SILOptions&, llvm::Optional<unsigned int>) + 95
35 swift 0x000000010582cae6 performCompile(swift::CompilerInstance&, swift::CompilerInvocation&, llvm::ArrayRef<char const*>, int&, swift::FrontendObserver*, swift::UnifiedStatsReporter*) + 8598
36 swift 0x000000010582993e swift::performFrontend(llvm::ArrayRef<char const*>, char const*, void*, swift::FrontendObserver*) + 3310
37 swift 0x00000001057e7a33 main + 2051
38 libdyld.dylib 0x00007fff6e5ec115 start + 1
Stack dump:
0. Program arguments: /Library/Developer/Toolchains/swift-DEVELOPMENT-SNAPSHOT-2018-03-17-a.xctoolchain/usr/bin/swift -frontend -c -primary-file test.swift -target x86_64-apple-darwin17.4.0 -enable-objc-interop -color-diagnostics -module-name test -o /var/folders/50/br4kxvjd0t551h0fmtrzkwdw0000gn/T/test-280f25.o
<unknown>:0: error: unable to execute command: Abort trap: 6
<unknown>:0: error: compile command failed due to signal 6 (use -v to see invocation)