2016-12-23 1 views
2

저는 실제로 신속하게 학습하고 있으며 스위치 제어 흐름을 테스트 중입니다. 나는 IBM Swift Sandbox에이 코드를보십시오 : 그것은 모두 잘 작동대문자와 소문자를 비교할 때 Swift 코드가 왜 폭발합니까?

let const = "Z" 

switch const { 

case "a" , 
    "A": print("La primera letra del abecedario") 
case "z": print("La ultima letra del abecedario") 
default: print("NPI de que letra se trate") 

} 

const = { "A", "A", "F", "Z"} 테스트. 이 const = "Z"와 잘 작동 것 같습니다,

terminate called after throwing an instance of 'std::system_error' 
    what(): Resource temporarily unavailable 
0 swift-build-tool 0x000000000050bade llvm::sys::PrintStackTrace(llvm::raw_ostream&) + 46 
1 swift-build-tool 0x000000000050ca49 
2 swift-build-tool 0x000000000050cd53 
3 libpthread.so.0 0x00007f960ca22330 
4 libc.so.6  0x00007f960bc5fc37 gsignal + 55 
5 libc.so.6  0x00007f960bc63028 abort + 328 
6 libstdc++.so.6 0x00007f960c56a535 __gnu_cxx::__verbose_terminate_handler() + 341 
7 libstdc++.so.6 0x00007f960c5686d6 
8 libstdc++.so.6 0x00007f960c568703 
9 libstdc++.so.6 0x00007f960c568922 
10 libstdc++.so.6 0x00007f960c5ba800 std::__throw_system_error(int) + 128 
11 libstdc++.so.6 0x00007f960c5bbd68 std::thread::_M_start_thread(std::shared_ptr<std::thread::_Impl_base>) + 584 
12 swift-build-tool 0x0000000000494d6d 
13 swift-build-tool 0x0000000000494b0d 
14 swift-build-tool 0x0000000000494a01 llbuild::buildsystem::createLaneBasedExecutionQueue(llbuild::buildsystem::BuildExecutionQueueDelegate&, int) + 49 
15 swift-build-tool 0x0000000000490ba8 llbuild::buildsystem::BuildSystemFrontendDelegate::createExecutionQueue() + 264 
16 swift-build-tool 0x00000000004b98e9 
17 swift-build-tool 0x00000000004b9823 llbuild::buildsystem::BuildSystem::build(llvm::StringRef) + 67 
18 swift-build-tool 0x000000000049150d llbuild::buildsystem::BuildSystemFrontend::build(llvm::StringRef) + 1405 
19 swift-build-tool 0x000000000048e086 
20 swift-build-tool 0x000000000048dc7a main + 170 
21 libc.so.6  0x00007f960bc4af45 __libc_start_main + 245 
22 swift-build-tool 0x000000000048db04 
swift-build: error: Child process exited with signal 
+0

이것은 컴파일러 버그입니다. 그것을보고하고 계속 나아가 라. 나를위한 Xcode 8.2에서는 재현 할 수 없습니다. – Sulthan

+0

방금 ​​XCode 버전 8.2 (8C38)의 놀이터에서이 코드를 테스트했습니다. 모든 것은'const == "Z"'와 함께 예상대로 작동합니다. 파손 된 데이터를 폐기하고 Xcode를 업그레이드 하시겠습니까? – courteouselk

+0

실제로 맥을 가지고 있지 않기 때문에 실제로 블루 뮤직을 사용하고 있습니다. –

답변

0

이제 샌드 박스에서 코드를 시도 : const는 "Z"입니다 그러나 나는이 error 얻을. 샌드 박스 끝 부분에 오류가 발생했습니다. 휴일 동안 소수의 서버에 문제가 발생했으며 문제를 해결하기 위해 노력하고 있습니다. 귀하의 코드가 올바른 것 같습니다.

관련 문제