I was building a class for a sqlite library, and suddenly the compiler hang forever.
I finally get a test case for it, and found is related to a dictionary parsing. This is the minimal code:
import Foundation import GRDB
class DeudaCliente : Record {
var id: Int64
var codigo: String
var nombre: String
var cobro: String
var direccion: String
var telefono: String
var orden: Int32
var calificacion: String
var fechaIngreso: NSDate
var fecha: NSDate
var capital: NSDecimalNumber
var interes: NSDecimalNumber
var cuota: NSDecimalNumber
var valor: NSDecimalNumber
var valorPagar: NSDecimalNumber
var saldo: NSDecimalNumber
var atrasados: Int32
/// Initialize from a database row
required init(_ row: Row) {
id = row.value(named: "id")
codigo = row.value(named: "codigo")
nombre = row.value(named: "nombre")
cobro = row.value(named: "cobro")
direccion = row.value(named: "direccion")
telefono = row.value(named: "telefono")
orden = row.value(named: "orden")
calificacion = row.value(named: "calificacion")
fechaIngreso = row.value(named: "fechaIngreso")
fecha = row.value(named: "fecha")
interes = row.value(named: "interes")
cuota = row.value(named: "cuota")
valor = row.value(named: "valor")
valorPagar = row.value(named: "valorPagar")
saldo = row.value(named: "saldo")
capital = row.value(named: "capital")
atrasados = row.value(named: "atrasados")
super.init(row)
}
/// The values persisted in the database
override var persistentDictionary: [String: DatabaseValueConvertible?]
{
return [
"id": id,
"nombre": nombre,
"codigo": codigo,
"cobro": cobro,
"direccion": direccion,
"telefono": telefono,
"orden": orden,
"calificacion": calificacion,
"fechaIngreso": fechaIngreso,
"fecha": fecha, //THE COMPILER SLOWDOWN HERE
"interes": interes,
"cuota": cuota, //THE COMPILER HANG HERE
"valor": valor,
"valorPagar": valorPagar,
"saldo": saldo,
"capital": capital,
"atrasados": atrasados
]
}
}
The weird thing is I change the values after the key "fecha" for scalars like 1, "a", etc the compiler work.
Also: The indexing take forever too after "cuota" and the service SourceKitService start to report +300% CPU, Increasing memory (I have count up to 6GB)
This on El capitan, xcode Version 7.2.1 (7C1002)