       "// The compiler won't synthesize support with the \(unrecognizedCaseName) case.",
       "\(visibility)static let allCases: [\(swiftFullName)] = [")
     p.withIndentation { p in
-      for v in mainEnumValueDescriptors {
+      for v in aliasInfo.mainValues {
         let dottedName = namer.dottedRelativeName(enumValue: v)
         p.print("\(dottedName),")
       }

        p.print()
      }
      let relativeName = namer.relativeName(enumValue: enumValueDescriptor)
      if let aliasOf = enumValueDescriptor.aliasOf {
        let aliasOfName = namer.relativeName(enumValue: aliasOf)
        p.print("\(comments)\(visibility)static let \(relativeName) = \(aliasOfName)")
      } else {

    self.enumDescriptor = descriptor
    self.generatorOptions = generatorOptions
    self.namer = namer
    aliasInfo = EnumDescriptor.ValueAliasInfo(enumDescriptor: descriptor)

    mainEnumValueDescriptorsSorted = aliasInfo.mainValues.sorted(by: {
      return $0.number < $1.number
    })

