Created
October 14, 2014 09:03
-
-
Save valfer/6b6066b90a78eab04d4f to your computer and use it in GitHub Desktop.
This class causes a compiler crash with signal 11, tested with XCode 6.0.1 (6A317) and XCode 6.1 (6A1046a)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// CrashCompilerClass.swift | |
// CompilerCrash | |
// | |
// Created by Valerio Ferrucci on 14/10/14. | |
// Copyright (c) 2014 Valerio Ferrucci. All rights reserved. | |
// | |
import Foundation | |
typealias MyObject = AnyObject | |
typealias MyObjectArray = [MyObject] | |
protocol MyObjectDecodable { | |
class func decode(obj: MyObject) -> Self? | |
} | |
func apply <A,B>(a : A?, f : A->B?) -> B? { | |
if let _a = a { | |
return f(_a) | |
} else { | |
return .None | |
} | |
} | |
class CrashCompilerClass<A:MyObjectDecodable> { | |
var callback : (A->())? = nil | |
func loopOnArray(objArray: MyObjectArray?) -> NSError? { | |
var error : NSError? | |
if let _objArray = objArray { | |
for obj in _objArray { | |
let obj1 = obj as? A | |
let obj2 = apply(obj,A.decode) | |
if let _obj2 = obj2 { | |
self.callback!(_obj2) | |
} | |
} | |
} | |
return error | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment