Enum not recognized or crashes compiler

swift

(Aaron Bratcher) #1

Given the code below, I get a compilation error Type mismatch, expected “ContentType” on line 31: entries[.homePage] = homeEntries

If I change it to ContentType.homePage, the compiler crashes. (Crash log below code example)

Fire version 10.0.2305

enum ContentType {
    case homePage, essentialPlaces, localbusinesses, locations, events, contacts, cityNews, visitors, custom
}

protocol TableCell {
    var title: String { get set }
    var bodyText: String { get set }
}

class BasicCell: TableCell {
    var title: String = ""
    var bodyText: String = ""

    init(title: String, bodyText: String) {
        self.title = title
        self.bodyText = bodyText
    }
}

class Tester {
    var entries: [ContentType: [TableCell]] = [:]

    init() {
        var homeEntries: [TableCell] = []
        var cell = BasicCell(title: "Essential Places"
        , bodyText: "Grocery, Medical, Parks, Banks, Transportation, Community Centers")
        homeEntries.append(cell)

        entries[.homePage] = homeEntries // Error or Crash here
    }
}

Crash Logged:

Internal error: System.AggregateException: One or more errors occurred. ---> System.Exception: Invalid record
  at RemObjects.Elements.Toffee.Output.ObjcOutput+<>c__DisplayClass13.<EmitModule>b__0 () [0x004e7] in <d096144dadf44aad8fc533672c4c729e>:0 
  at RemObjects.Elements.Toffee.Output.ObjcOutput.<GenerateExecutable>b__16 (System.Action a) [0x00000] in <d096144dadf44aad8fc533672c4c729e>:0 
  at System.Threading.Tasks.Parallel+<PartitionerForEachWorker>c__AnonStorey7`2[TSource,TLocal].<>m__1 () [0x0011b] in <dbb16e0bacdc4a0f87478e401bc29b6c>:0 
   --- End of inner exception stack trace ---
  at System.Threading.Tasks.Task.ThrowIfExceptional (System.Boolean includeTaskCanceledExceptions) [0x00014] in <dbb16e0bacdc4a0f87478e401bc29b6c>:0 
  at System.Threading.Tasks.Task.Wait (System.Int32 millisecondsTimeout, System.Threading.CancellationToken cancellationToken) [0x00052] in <dbb16e0bacdc4a0f87478e401bc29b6c>:0 
  at System.Threading.Tasks.Task.Wait () [0x00000] in <dbb16e0bacdc4a0f87478e401bc29b6c>:0 
  at System.Threading.Tasks.Parallel.PartitionerForEachWorker[TSource,TLocal] (System.Collections.Concurrent.Partitioner`1[TSource] source, System.Threading.Tasks.ParallelOptions parallelOptions, System.Action`1[T] simpleBody, System.Action`2[T1,T2] bodyWithState, System.Action`3[T1,T2,T3] bodyWithStateAndIndex, System.Func`4[T1,T2,T3,TResult] bodyWithStateAndLocal, System.Func`5[T1,T2,T3,T4,TResult] bodyWithEverything, System.Func`1[TResult] localInit, System.Action`1[T] localFinally) [0x001a5] in <dbb16e0bacdc4a0f87478e401bc29b6c>:0 
---> (Inner Exception #0) System.Exception: Invalid record
  at RemObjects.Elements.Toffee.Output.ObjcOutput+<>c__DisplayClass13.<EmitModule>b__0 () [0x004e7] in <d096144dadf44aad8fc533672c4c729e>:0 
  at RemObjects.Elements.Toffee.Output.ObjcOutput.<GenerateExecutable>b__16 (System.Action a) [0x00000] in <d096144dadf44aad8fc533672c4c729e>:0 
  at System.Threading.Tasks.Parallel+<PartitionerForEachWorker>c__AnonStorey7`2[TSource,TLocal].<>m__1 () [0x0011b] in <dbb16e0bacdc4a0f87478e401bc29b6c>:0 <---

(RemObjects) #2

Thanks, logged as bugs://80658


(Aaron Bratcher) #3

Is there a way to track bugs?

Thanks.


(marc hoffman) #4

The status will be updated here, as it changes.


(RemObjects) #5

bugs://80658 got closed with status fixed.