Skip to content

Instantly share code, notes, and snippets.

@rnapier
Last active August 29, 2015 14:13
Show Gist options
  • Save rnapier/107b17522b4ec73126f0 to your computer and use it in GitHub Desktop.
Save rnapier/107b17522b4ec73126f0 to your computer and use it in GitHub Desktop.
Why does this hang at line 13? (Xcode 6.2 6C86e)
final class Box<T> {
let unbox: T
init(_ value: T) { self.unbox = value }
}
enum List<T> {
case Empty
case Cons(T, Box<List<T>>) // <- Converting this to Cons(Box<T>, Box<List<T>>) fixes it (thanks @CodeFi_)
}
println("START")
let b: Box<List<Int>> = Box(List.Empty) // Hangs here at runtime. Never gets to FINISHED
println("FINISH")
// Stack at hung point:
#0 0x00007fff9895c132 in __psynch_cvwait ()
#1 0x00007fff966f1ea0 in _pthread_cond_wait ()
#2 0x00007fff9a4a2c95 in std::__1::condition_variable::wait(std::__1::unique_lock<std::__1::mutex>&) ()
#3 0x0000000100197dd2 in swift_getGenericMetadata ()
#4 0x0000000100197f75 in swift_getGenericMetadata1 ()
#5 0x0000000100179eeb in create_generic_metadata1 ()
#6 0x000000010019f549 in std::__1::__function::__func<swift::swift_getGenericMetadata::$_0, std::__1::allocator<swift::swift_getGenericMetadata::$_0>, (anonymous namespace)::GenericCacheEntry* ()>::operator()() ()
#7 0x0000000100197e37 in swift_getGenericMetadata ()
#8 0x0000000100197f75 in swift_getGenericMetadata1 ()
#9 0x000000010017c145 in type metadata accessor for List.List<Swift.Int> ()
#10 0x000000010017c0e0 in type metadata accessor for List.Box<List.List<Swift.Int>> ()
#11 0x0000000100179740 in top_level_code at /Users/rnapier/Documents/Talks/CocoaConf/Array To Zipper/List/List/main.swift:13
#12 0x0000000100179f6a in main ()
#13 0x00007fff974e65c9 in start ()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment