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

    self.enumDescriptor = descriptor
    self.generatorOptions = generatorOptions
    self.namer = namer

    mainEnumValueDescriptors = descriptor.values.filter({
      return $0.aliasOf == nil
    })
    mainEnumValueDescriptorsSorted = mainEnumValueDescriptors.sorted(by: {
      return $0.number < $1.number
    })


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