diff --git a/build/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt b/build/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt index bc11e1a0b0d..6eeb13bf2ab 100644 --- a/build/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt +++ b/build/src/org/jetbrains/kotlin/incremental/ProtoCompareGenerated.kt @@ -185,9 +185,9 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.flags != new.flags) return false } - if (old.hasNewFlags() != new.hasNewFlags()) return false - if (old.hasNewFlags()) { - if (old.newFlags != new.newFlags) return false + if (old.hasOldFlags() != new.hasOldFlags()) return false + if (old.hasOldFlags()) { + if (old.oldFlags != new.oldFlags) return false } if (!checkStringEquals(old.name, new.name)) return false @@ -235,9 +235,9 @@ open class ProtoCompareGenerated(val oldNameResolver: NameResolver, val newNameR if (old.flags != new.flags) return false } - if (old.hasNewFlags() != new.hasNewFlags()) return false - if (old.hasNewFlags()) { - if (old.newFlags != new.newFlags) return false + if (old.hasOldFlags() != new.hasOldFlags()) return false + if (old.hasOldFlags()) { + if (old.oldFlags != new.oldFlags) return false } if (!checkStringEquals(old.name, new.name)) return false @@ -893,8 +893,8 @@ fun ProtoBuf.Function.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) hashCode = 31 * hashCode + flags } - if (hasNewFlags()) { - hashCode = 31 * hashCode + newFlags + if (hasOldFlags()) { + hashCode = 31 * hashCode + oldFlags } hashCode = 31 * hashCode + stringIndexes(name) @@ -941,8 +941,8 @@ fun ProtoBuf.Property.hashCode(stringIndexes: (Int) -> Int, fqNameIndexes: (Int) hashCode = 31 * hashCode + flags } - if (hasNewFlags()) { - hashCode = 31 * hashCode + newFlags + if (hasOldFlags()) { + hashCode = 31 * hashCode + oldFlags } hashCode = 31 * hashCode + stringIndexes(name) diff --git a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java index 4e60c9a7ee4..3e6f61b206e 100644 --- a/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java +++ b/compiler/frontend/src/org/jetbrains/kotlin/resolve/DescriptorResolver.java @@ -877,7 +877,7 @@ public class DescriptorResolver { return setterDescriptor; } - @Nullable + @NotNull private PropertyGetterDescriptorImpl resolvePropertyGetterDescriptor( @NotNull LexicalScope scopeWithTypeParameters, @NotNull KtProperty property, diff --git a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.java b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.java index a29e2961ad2..89d8184b06a 100644 --- a/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.java +++ b/compiler/serialization/src/org/jetbrains/kotlin/serialization/DescriptorSerializer.java @@ -252,10 +252,6 @@ public class DescriptorSerializer { if (flags != builder.getFlags()) { builder.setFlags(flags); } - int newFlags = (flags & 0x3f) + ((flags >> 2) & ~0x3f); - if (newFlags != builder.getNewFlags()) { - builder.setNewFlags(newFlags); - } builder.setName(getSimpleNameIndex(descriptor.getName())); @@ -299,10 +295,6 @@ public class DescriptorSerializer { if (flags != builder.getFlags()) { builder.setFlags(flags); } - int newFlags = (flags & 0x3f) + ((flags >> 2) & ~0x3f); - if (newFlags != builder.getNewFlags()) { - builder.setNewFlags(newFlags); - } builder.setName(getSimpleNameIndex(descriptor.getName())); diff --git a/compiler/tests/org/jetbrains/kotlin/serialization/DebugProtoBuf.java b/compiler/tests/org/jetbrains/kotlin/serialization/DebugProtoBuf.java index b9c8d6a33d9..ee149e874b6 100644 --- a/compiler/tests/org/jetbrains/kotlin/serialization/DebugProtoBuf.java +++ b/compiler/tests/org/jetbrains/kotlin/serialization/DebugProtoBuf.java @@ -15800,9 +15800,9 @@ public final class DebugProtoBuf { com.google.protobuf.GeneratedMessage. ExtendableMessageOrBuilder { - // optional int32 flags = 1 [default = 6]; + // optional int32 flags = 9 [default = 6]; /** - * optional int32 flags = 1 [default = 6]; + * optional int32 flags = 9 [default = 6]; * *
      *
@@ -15819,7 +15819,7 @@ public final class DebugProtoBuf {
      */
     boolean hasFlags();
     /**
-     * optional int32 flags = 1 [default = 6];
+     * optional int32 flags = 9 [default = 6];
      *
      * 
      *
@@ -15836,15 +15836,15 @@ public final class DebugProtoBuf {
      */
     int getFlags();
 
-    // optional int32 new_flags = 9 [default = 6];
+    // optional int32 old_flags = 1 [default = 6];
     /**
-     * optional int32 new_flags = 9 [default = 6];
+     * optional int32 old_flags = 1 [default = 6];
      */
-    boolean hasNewFlags();
+    boolean hasOldFlags();
     /**
-     * optional int32 new_flags = 9 [default = 6];
+     * optional int32 old_flags = 1 [default = 6];
      */
-    int getNewFlags();
+    int getOldFlags();
 
     // required int32 name = 2;
     /**
@@ -16020,8 +16020,8 @@ public final class DebugProtoBuf {
               break;
             }
             case 8: {
-              bitField0_ |= 0x00000001;
-              flags_ = input.readInt32();
+              bitField0_ |= 0x00000002;
+              oldFlags_ = input.readInt32();
               break;
             }
             case 16: {
@@ -16082,8 +16082,8 @@ public final class DebugProtoBuf {
               break;
             }
             case 72: {
-              bitField0_ |= 0x00000002;
-              newFlags_ = input.readInt32();
+              bitField0_ |= 0x00000001;
+              flags_ = input.readInt32();
               break;
             }
             case 242: {
@@ -16145,11 +16145,11 @@ public final class DebugProtoBuf {
     }
 
     private int bitField0_;
-    // optional int32 flags = 1 [default = 6];
-    public static final int FLAGS_FIELD_NUMBER = 1;
+    // optional int32 flags = 9 [default = 6];
+    public static final int FLAGS_FIELD_NUMBER = 9;
     private int flags_;
     /**
-     * optional int32 flags = 1 [default = 6];
+     * optional int32 flags = 9 [default = 6];
      *
      * 
      *
@@ -16168,7 +16168,7 @@ public final class DebugProtoBuf {
       return ((bitField0_ & 0x00000001) == 0x00000001);
     }
     /**
-     * optional int32 flags = 1 [default = 6];
+     * optional int32 flags = 9 [default = 6];
      *
      * 
      *
@@ -16187,20 +16187,20 @@ public final class DebugProtoBuf {
       return flags_;
     }
 
-    // optional int32 new_flags = 9 [default = 6];
-    public static final int NEW_FLAGS_FIELD_NUMBER = 9;
-    private int newFlags_;
+    // optional int32 old_flags = 1 [default = 6];
+    public static final int OLD_FLAGS_FIELD_NUMBER = 1;
+    private int oldFlags_;
     /**
-     * optional int32 new_flags = 9 [default = 6];
+     * optional int32 old_flags = 1 [default = 6];
      */
-    public boolean hasNewFlags() {
+    public boolean hasOldFlags() {
       return ((bitField0_ & 0x00000002) == 0x00000002);
     }
     /**
-     * optional int32 new_flags = 9 [default = 6];
+     * optional int32 old_flags = 1 [default = 6];
      */
-    public int getNewFlags() {
-      return newFlags_;
+    public int getOldFlags() {
+      return oldFlags_;
     }
 
     // required int32 name = 2;
@@ -16391,7 +16391,7 @@ public final class DebugProtoBuf {
 
     private void initFields() {
       flags_ = 6;
-      newFlags_ = 6;
+      oldFlags_ = 6;
       name_ = 0;
       returnType_ = org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.getDefaultInstance();
       returnTypeId_ = 0;
@@ -16454,8 +16454,8 @@ public final class DebugProtoBuf {
       com.google.protobuf.GeneratedMessage
         .ExtendableMessage.ExtensionWriter extensionWriter =
           newExtensionWriter();
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        output.writeInt32(1, flags_);
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeInt32(1, oldFlags_);
       }
       if (((bitField0_ & 0x00000004) == 0x00000004)) {
         output.writeInt32(2, name_);
@@ -16478,8 +16478,8 @@ public final class DebugProtoBuf {
       if (((bitField0_ & 0x00000040) == 0x00000040)) {
         output.writeInt32(8, receiverTypeId_);
       }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        output.writeInt32(9, newFlags_);
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeInt32(9, flags_);
       }
       if (((bitField0_ & 0x00000080) == 0x00000080)) {
         output.writeMessage(30, typeTable_);
@@ -16494,9 +16494,9 @@ public final class DebugProtoBuf {
       if (size != -1) return size;
 
       size = 0;
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeInt32Size(1, flags_);
+          .computeInt32Size(1, oldFlags_);
       }
       if (((bitField0_ & 0x00000004) == 0x00000004)) {
         size += com.google.protobuf.CodedOutputStream
@@ -16526,9 +16526,9 @@ public final class DebugProtoBuf {
         size += com.google.protobuf.CodedOutputStream
           .computeInt32Size(8, receiverTypeId_);
       }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeInt32Size(9, newFlags_);
+          .computeInt32Size(9, flags_);
       }
       if (((bitField0_ & 0x00000080) == 0x00000080)) {
         size += com.google.protobuf.CodedOutputStream
@@ -16658,7 +16658,7 @@ public final class DebugProtoBuf {
         super.clear();
         flags_ = 6;
         bitField0_ = (bitField0_ & ~0x00000001);
-        newFlags_ = 6;
+        oldFlags_ = 6;
         bitField0_ = (bitField0_ & ~0x00000002);
         name_ = 0;
         bitField0_ = (bitField0_ & ~0x00000004);
@@ -16731,7 +16731,7 @@ public final class DebugProtoBuf {
         if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
           to_bitField0_ |= 0x00000002;
         }
-        result.newFlags_ = newFlags_;
+        result.oldFlags_ = oldFlags_;
         if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
           to_bitField0_ |= 0x00000004;
         }
@@ -16805,8 +16805,8 @@ public final class DebugProtoBuf {
         if (other.hasFlags()) {
           setFlags(other.getFlags());
         }
-        if (other.hasNewFlags()) {
-          setNewFlags(other.getNewFlags());
+        if (other.hasOldFlags()) {
+          setOldFlags(other.getOldFlags());
         }
         if (other.hasName()) {
           setName(other.getName());
@@ -16944,10 +16944,10 @@ public final class DebugProtoBuf {
       }
       private int bitField0_;
 
-      // optional int32 flags = 1 [default = 6];
+      // optional int32 flags = 9 [default = 6];
       private int flags_ = 6;
       /**
-       * optional int32 flags = 1 [default = 6];
+       * optional int32 flags = 9 [default = 6];
        *
        * 
        *
@@ -16966,7 +16966,7 @@ public final class DebugProtoBuf {
         return ((bitField0_ & 0x00000001) == 0x00000001);
       }
       /**
-       * optional int32 flags = 1 [default = 6];
+       * optional int32 flags = 9 [default = 6];
        *
        * 
        *
@@ -16985,7 +16985,7 @@ public final class DebugProtoBuf {
         return flags_;
       }
       /**
-       * optional int32 flags = 1 [default = 6];
+       * optional int32 flags = 9 [default = 6];
        *
        * 
        *
@@ -17007,7 +17007,7 @@ public final class DebugProtoBuf {
         return this;
       }
       /**
-       * optional int32 flags = 1 [default = 6];
+       * optional int32 flags = 9 [default = 6];
        *
        * 
        *
@@ -17029,35 +17029,35 @@ public final class DebugProtoBuf {
         return this;
       }
 
-      // optional int32 new_flags = 9 [default = 6];
-      private int newFlags_ = 6;
+      // optional int32 old_flags = 1 [default = 6];
+      private int oldFlags_ = 6;
       /**
-       * optional int32 new_flags = 9 [default = 6];
+       * optional int32 old_flags = 1 [default = 6];
        */
-      public boolean hasNewFlags() {
+      public boolean hasOldFlags() {
         return ((bitField0_ & 0x00000002) == 0x00000002);
       }
       /**
-       * optional int32 new_flags = 9 [default = 6];
+       * optional int32 old_flags = 1 [default = 6];
        */
-      public int getNewFlags() {
-        return newFlags_;
+      public int getOldFlags() {
+        return oldFlags_;
       }
       /**
-       * optional int32 new_flags = 9 [default = 6];
+       * optional int32 old_flags = 1 [default = 6];
        */
-      public Builder setNewFlags(int value) {
+      public Builder setOldFlags(int value) {
         bitField0_ |= 0x00000002;
-        newFlags_ = value;
+        oldFlags_ = value;
         onChanged();
         return this;
       }
       /**
-       * optional int32 new_flags = 9 [default = 6];
+       * optional int32 old_flags = 1 [default = 6];
        */
-      public Builder clearNewFlags() {
+      public Builder clearOldFlags() {
         bitField0_ = (bitField0_ & ~0x00000002);
-        newFlags_ = 6;
+        oldFlags_ = 6;
         onChanged();
         return this;
       }
@@ -18007,9 +18007,9 @@ public final class DebugProtoBuf {
       com.google.protobuf.GeneratedMessage.
           ExtendableMessageOrBuilder {
 
-    // optional int32 flags = 1 [default = 262];
+    // optional int32 flags = 11 [default = 518];
     /**
-     * optional int32 flags = 1 [default = 262];
+     * optional int32 flags = 11 [default = 518];
      *
      * 
      *
@@ -18027,7 +18027,7 @@ public final class DebugProtoBuf {
      */
     boolean hasFlags();
     /**
-     * optional int32 flags = 1 [default = 262];
+     * optional int32 flags = 11 [default = 518];
      *
      * 
      *
@@ -18045,15 +18045,15 @@ public final class DebugProtoBuf {
      */
     int getFlags();
 
-    // optional int32 new_flags = 11 [default = 518];
+    // optional int32 old_flags = 1 [default = 2054];
     /**
-     * optional int32 new_flags = 11 [default = 518];
+     * optional int32 old_flags = 1 [default = 2054];
      */
-    boolean hasNewFlags();
+    boolean hasOldFlags();
     /**
-     * optional int32 new_flags = 11 [default = 518];
+     * optional int32 old_flags = 1 [default = 2054];
      */
-    int getNewFlags();
+    int getOldFlags();
 
     // required int32 name = 2;
     /**
@@ -18242,8 +18242,8 @@ public final class DebugProtoBuf {
               break;
             }
             case 8: {
-              bitField0_ |= 0x00000001;
-              flags_ = input.readInt32();
+              bitField0_ |= 0x00000002;
+              oldFlags_ = input.readInt32();
               break;
             }
             case 16: {
@@ -18319,8 +18319,8 @@ public final class DebugProtoBuf {
               break;
             }
             case 88: {
-              bitField0_ |= 0x00000002;
-              newFlags_ = input.readInt32();
+              bitField0_ |= 0x00000001;
+              flags_ = input.readInt32();
               break;
             }
           }
@@ -18366,11 +18366,11 @@ public final class DebugProtoBuf {
     }
 
     private int bitField0_;
-    // optional int32 flags = 1 [default = 262];
-    public static final int FLAGS_FIELD_NUMBER = 1;
+    // optional int32 flags = 11 [default = 518];
+    public static final int FLAGS_FIELD_NUMBER = 11;
     private int flags_;
     /**
-     * optional int32 flags = 1 [default = 262];
+     * optional int32 flags = 11 [default = 518];
      *
      * 
      *
@@ -18390,7 +18390,7 @@ public final class DebugProtoBuf {
       return ((bitField0_ & 0x00000001) == 0x00000001);
     }
     /**
-     * optional int32 flags = 1 [default = 262];
+     * optional int32 flags = 11 [default = 518];
      *
      * 
      *
@@ -18410,20 +18410,20 @@ public final class DebugProtoBuf {
       return flags_;
     }
 
-    // optional int32 new_flags = 11 [default = 518];
-    public static final int NEW_FLAGS_FIELD_NUMBER = 11;
-    private int newFlags_;
+    // optional int32 old_flags = 1 [default = 2054];
+    public static final int OLD_FLAGS_FIELD_NUMBER = 1;
+    private int oldFlags_;
     /**
-     * optional int32 new_flags = 11 [default = 518];
+     * optional int32 old_flags = 1 [default = 2054];
      */
-    public boolean hasNewFlags() {
+    public boolean hasOldFlags() {
       return ((bitField0_ & 0x00000002) == 0x00000002);
     }
     /**
-     * optional int32 new_flags = 11 [default = 518];
+     * optional int32 old_flags = 1 [default = 2054];
      */
-    public int getNewFlags() {
-      return newFlags_;
+    public int getOldFlags() {
+      return oldFlags_;
     }
 
     // required int32 name = 2;
@@ -18627,8 +18627,8 @@ public final class DebugProtoBuf {
     }
 
     private void initFields() {
-      flags_ = 262;
-      newFlags_ = 518;
+      flags_ = 518;
+      oldFlags_ = 2054;
       name_ = 0;
       returnType_ = org.jetbrains.kotlin.serialization.DebugProtoBuf.Type.getDefaultInstance();
       returnTypeId_ = 0;
@@ -18686,8 +18686,8 @@ public final class DebugProtoBuf {
       com.google.protobuf.GeneratedMessage
         .ExtendableMessage.ExtensionWriter extensionWriter =
           newExtensionWriter();
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        output.writeInt32(1, flags_);
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeInt32(1, oldFlags_);
       }
       if (((bitField0_ & 0x00000004) == 0x00000004)) {
         output.writeInt32(2, name_);
@@ -18716,8 +18716,8 @@ public final class DebugProtoBuf {
       if (((bitField0_ & 0x00000040) == 0x00000040)) {
         output.writeInt32(10, receiverTypeId_);
       }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        output.writeInt32(11, newFlags_);
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeInt32(11, flags_);
       }
       extensionWriter.writeUntil(200, output);
       getUnknownFields().writeTo(output);
@@ -18729,9 +18729,9 @@ public final class DebugProtoBuf {
       if (size != -1) return size;
 
       size = 0;
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeInt32Size(1, flags_);
+          .computeInt32Size(1, oldFlags_);
       }
       if (((bitField0_ & 0x00000004) == 0x00000004)) {
         size += com.google.protobuf.CodedOutputStream
@@ -18769,9 +18769,9 @@ public final class DebugProtoBuf {
         size += com.google.protobuf.CodedOutputStream
           .computeInt32Size(10, receiverTypeId_);
       }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeInt32Size(11, newFlags_);
+          .computeInt32Size(11, flags_);
       }
       size += extensionsSerializedSize();
       size += getUnknownFields().getSerializedSize();
@@ -18894,9 +18894,9 @@ public final class DebugProtoBuf {
 
       public Builder clear() {
         super.clear();
-        flags_ = 262;
+        flags_ = 518;
         bitField0_ = (bitField0_ & ~0x00000001);
-        newFlags_ = 518;
+        oldFlags_ = 2054;
         bitField0_ = (bitField0_ & ~0x00000002);
         name_ = 0;
         bitField0_ = (bitField0_ & ~0x00000004);
@@ -18967,7 +18967,7 @@ public final class DebugProtoBuf {
         if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
           to_bitField0_ |= 0x00000002;
         }
-        result.newFlags_ = newFlags_;
+        result.oldFlags_ = oldFlags_;
         if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
           to_bitField0_ |= 0x00000004;
         }
@@ -19040,8 +19040,8 @@ public final class DebugProtoBuf {
         if (other.hasFlags()) {
           setFlags(other.getFlags());
         }
-        if (other.hasNewFlags()) {
-          setNewFlags(other.getNewFlags());
+        if (other.hasOldFlags()) {
+          setOldFlags(other.getOldFlags());
         }
         if (other.hasName()) {
           setName(other.getName());
@@ -19153,10 +19153,10 @@ public final class DebugProtoBuf {
       }
       private int bitField0_;
 
-      // optional int32 flags = 1 [default = 262];
-      private int flags_ = 262;
+      // optional int32 flags = 11 [default = 518];
+      private int flags_ = 518;
       /**
-       * optional int32 flags = 1 [default = 262];
+       * optional int32 flags = 11 [default = 518];
        *
        * 
        *
@@ -19176,7 +19176,7 @@ public final class DebugProtoBuf {
         return ((bitField0_ & 0x00000001) == 0x00000001);
       }
       /**
-       * optional int32 flags = 1 [default = 262];
+       * optional int32 flags = 11 [default = 518];
        *
        * 
        *
@@ -19196,7 +19196,7 @@ public final class DebugProtoBuf {
         return flags_;
       }
       /**
-       * optional int32 flags = 1 [default = 262];
+       * optional int32 flags = 11 [default = 518];
        *
        * 
        *
@@ -19219,7 +19219,7 @@ public final class DebugProtoBuf {
         return this;
       }
       /**
-       * optional int32 flags = 1 [default = 262];
+       * optional int32 flags = 11 [default = 518];
        *
        * 
        *
@@ -19237,40 +19237,40 @@ public final class DebugProtoBuf {
        */
       public Builder clearFlags() {
         bitField0_ = (bitField0_ & ~0x00000001);
-        flags_ = 262;
+        flags_ = 518;
         onChanged();
         return this;
       }
 
-      // optional int32 new_flags = 11 [default = 518];
-      private int newFlags_ = 518;
+      // optional int32 old_flags = 1 [default = 2054];
+      private int oldFlags_ = 2054;
       /**
-       * optional int32 new_flags = 11 [default = 518];
+       * optional int32 old_flags = 1 [default = 2054];
        */
-      public boolean hasNewFlags() {
+      public boolean hasOldFlags() {
         return ((bitField0_ & 0x00000002) == 0x00000002);
       }
       /**
-       * optional int32 new_flags = 11 [default = 518];
+       * optional int32 old_flags = 1 [default = 2054];
        */
-      public int getNewFlags() {
-        return newFlags_;
+      public int getOldFlags() {
+        return oldFlags_;
       }
       /**
-       * optional int32 new_flags = 11 [default = 518];
+       * optional int32 old_flags = 1 [default = 2054];
        */
-      public Builder setNewFlags(int value) {
+      public Builder setOldFlags(int value) {
         bitField0_ |= 0x00000002;
-        newFlags_ = value;
+        oldFlags_ = value;
         onChanged();
         return this;
       }
       /**
-       * optional int32 new_flags = 11 [default = 518];
+       * optional int32 old_flags = 1 [default = 2054];
        */
-      public Builder clearNewFlags() {
+      public Builder clearOldFlags() {
         bitField0_ = (bitField0_ & ~0x00000002);
-        newFlags_ = 518;
+        oldFlags_ = 2054;
         onChanged();
         return this;
       }
@@ -21802,7 +21802,7 @@ public final class DebugProtoBuf {
       "\n\005flags\030\001 \001(\005:\0016\022K\n\017value_parameter\030\002 \003(" +
       "\01322.org.jetbrains.kotlin.serialization.V" +
       "alueParameter*\005\010d\020\310\001\"\332\003\n\010Function\022\020\n\005fla" +
-      "gs\030\001 \001(\005:\0016\022\024\n\tnew_flags\030\t \001(\005:\0016\022\022\n\004nam" +
+      "gs\030\t \001(\005:\0016\022\024\n\told_flags\030\001 \001(\005:\0016\022\022\n\004nam" +
       "e\030\002 \002(\005B\004\210\265\030\001\022=\n\013return_type\030\003 \001(\0132(.org" +
       ".jetbrains.kotlin.serialization.Type\022\026\n\016" +
       "return_type_id\030\007 \001(\005\022I\n\016type_parameter\030\004" +
@@ -21813,32 +21813,32 @@ public final class DebugProtoBuf {
       "meter\030\006 \003(\01322.org.jetbrains.kotlin.seria" +
       "lization.ValueParameter\022A\n\ntype_table\030\036 " +
       "\001(\0132-.org.jetbrains.kotlin.serialization" +
-      ".TypeTable*\005\010d\020\310\001\"\316\003\n\010Property\022\022\n\005flags\030" +
-      "\001 \001(\005:\003262\022\026\n\tnew_flags\030\013 \001(\005:\003518\022\022\n\004na" +
-      "me\030\002 \002(\005B\004\210\265\030\001\022=\n\013return_type\030\003 \001(\0132(.or" +
-      "g.jetbrains.kotlin.serialization.Type\022\026\n",
-      "\016return_type_id\030\t \001(\005\022I\n\016type_parameter\030" +
-      "\004 \003(\01321.org.jetbrains.kotlin.serializati" +
-      "on.TypeParameter\022?\n\rreceiver_type\030\005 \001(\0132" +
-      "(.org.jetbrains.kotlin.serialization.Typ" +
-      "e\022\030\n\020receiver_type_id\030\n \001(\005\022R\n\026setter_va" +
-      "lue_parameter\030\006 \001(\01322.org.jetbrains.kotl" +
-      "in.serialization.ValueParameter\022\024\n\014gette" +
-      "r_flags\030\007 \001(\005\022\024\n\014setter_flags\030\010 \001(\005*\005\010d\020" +
-      "\310\001\"\355\001\n\016ValueParameter\022\020\n\005flags\030\001 \001(\005:\0010\022" +
-      "\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0226\n\004type\030\003 \001(\0132(.org.",
-      "jetbrains.kotlin.serialization.Type\022\017\n\007t" +
-      "ype_id\030\005 \001(\005\022E\n\023vararg_element_type\030\004 \001(" +
-      "\0132(.org.jetbrains.kotlin.serialization.T" +
-      "ype\022\036\n\026vararg_element_type_id\030\006 \001(\005*\005\010d\020" +
-      "\310\001\"&\n\tEnumEntry\022\022\n\004name\030\001 \001(\005B\004\210\265\030\001*\005\010d\020" +
-      "\310\001*9\n\010Modality\022\t\n\005FINAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010A" +
-      "BSTRACT\020\002\022\n\n\006SEALED\020\003*b\n\nVisibility\022\014\n\010I" +
-      "NTERNAL\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROTECTED\020\002\022\n\n" +
-      "\006PUBLIC\020\003\022\023\n\017PRIVATE_TO_THIS\020\004\022\t\n\005LOCAL\020" +
-      "\005*Q\n\nMemberKind\022\017\n\013DECLARATION\020\000\022\021\n\rFAKE",
-      "_OVERRIDE\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESIZ" +
-      "ED\020\003B\022B\rDebugProtoBuf\210\001\000"
+      ".TypeTable*\005\010d\020\310\001\"\317\003\n\010Property\022\022\n\005flags\030" +
+      "\013 \001(\005:\003518\022\027\n\told_flags\030\001 \001(\005:\0042054\022\022\n\004n" +
+      "ame\030\002 \002(\005B\004\210\265\030\001\022=\n\013return_type\030\003 \001(\0132(.o" +
+      "rg.jetbrains.kotlin.serialization.Type\022\026",
+      "\n\016return_type_id\030\t \001(\005\022I\n\016type_parameter" +
+      "\030\004 \003(\01321.org.jetbrains.kotlin.serializat" +
+      "ion.TypeParameter\022?\n\rreceiver_type\030\005 \001(\013" +
+      "2(.org.jetbrains.kotlin.serialization.Ty" +
+      "pe\022\030\n\020receiver_type_id\030\n \001(\005\022R\n\026setter_v" +
+      "alue_parameter\030\006 \001(\01322.org.jetbrains.kot" +
+      "lin.serialization.ValueParameter\022\024\n\014gett" +
+      "er_flags\030\007 \001(\005\022\024\n\014setter_flags\030\010 \001(\005*\005\010d" +
+      "\020\310\001\"\355\001\n\016ValueParameter\022\020\n\005flags\030\001 \001(\005:\0010" +
+      "\022\022\n\004name\030\002 \002(\005B\004\210\265\030\001\0226\n\004type\030\003 \001(\0132(.org",
+      ".jetbrains.kotlin.serialization.Type\022\017\n\007" +
+      "type_id\030\005 \001(\005\022E\n\023vararg_element_type\030\004 \001" +
+      "(\0132(.org.jetbrains.kotlin.serialization." +
+      "Type\022\036\n\026vararg_element_type_id\030\006 \001(\005*\005\010d" +
+      "\020\310\001\"&\n\tEnumEntry\022\022\n\004name\030\001 \001(\005B\004\210\265\030\001*\005\010d" +
+      "\020\310\001*9\n\010Modality\022\t\n\005FINAL\020\000\022\010\n\004OPEN\020\001\022\014\n\010" +
+      "ABSTRACT\020\002\022\n\n\006SEALED\020\003*b\n\nVisibility\022\014\n\010" +
+      "INTERNAL\020\000\022\013\n\007PRIVATE\020\001\022\r\n\tPROTECTED\020\002\022\n" +
+      "\n\006PUBLIC\020\003\022\023\n\017PRIVATE_TO_THIS\020\004\022\t\n\005LOCAL" +
+      "\020\005*Q\n\nMemberKind\022\017\n\013DECLARATION\020\000\022\021\n\rFAK",
+      "E_OVERRIDE\020\001\022\016\n\nDELEGATION\020\002\022\017\n\013SYNTHESI" +
+      "ZED\020\003B\022B\rDebugProtoBuf\210\001\000"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {
@@ -21928,13 +21928,13 @@ public final class DebugProtoBuf {
           internal_static_org_jetbrains_kotlin_serialization_Function_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_jetbrains_kotlin_serialization_Function_descriptor,
-              new java.lang.String[] { "Flags", "NewFlags", "Name", "ReturnType", "ReturnTypeId", "TypeParameter", "ReceiverType", "ReceiverTypeId", "ValueParameter", "TypeTable", });
+              new java.lang.String[] { "Flags", "OldFlags", "Name", "ReturnType", "ReturnTypeId", "TypeParameter", "ReceiverType", "ReceiverTypeId", "ValueParameter", "TypeTable", });
           internal_static_org_jetbrains_kotlin_serialization_Property_descriptor =
             getDescriptor().getMessageTypes().get(10);
           internal_static_org_jetbrains_kotlin_serialization_Property_fieldAccessorTable = new
             com.google.protobuf.GeneratedMessage.FieldAccessorTable(
               internal_static_org_jetbrains_kotlin_serialization_Property_descriptor,
-              new java.lang.String[] { "Flags", "NewFlags", "Name", "ReturnType", "ReturnTypeId", "TypeParameter", "ReceiverType", "ReceiverTypeId", "SetterValueParameter", "GetterFlags", "SetterFlags", });
+              new java.lang.String[] { "Flags", "OldFlags", "Name", "ReturnType", "ReturnTypeId", "TypeParameter", "ReceiverType", "ReceiverTypeId", "SetterValueParameter", "GetterFlags", "SetterFlags", });
           internal_static_org_jetbrains_kotlin_serialization_ValueParameter_descriptor =
             getDescriptor().getMessageTypes().get(11);
           internal_static_org_jetbrains_kotlin_serialization_ValueParameter_fieldAccessorTable = new
diff --git a/core/deserialization/src/descriptors.proto b/core/deserialization/src/descriptors.proto
index c4c90025dc3..0b826ea8110 100644
--- a/core/deserialization/src/descriptors.proto
+++ b/core/deserialization/src/descriptors.proto
@@ -241,8 +241,8 @@ message Function {
     isTailrec
     isExternal
   */
-  optional int32 flags = 1 [default = 6];
-  optional int32 new_flags = 9 [default = 6 /* public final function, no annotations */];
+  optional int32 flags = 9 [default = 6 /* public final function, no annotations */];
+  optional int32 old_flags = 1 [default = 6];
 
   required int32 name = 2 [(name_id_in_table) = true];
 
@@ -274,8 +274,8 @@ message Property {
     lateinit
     hasConstant
   */
-  optional int32 flags = 1 [default = 262];
-  optional int32 new_flags = 11 [default = 518 /* public (6) final property with getter (512) */];
+  optional int32 flags = 11 [default = 518 /* public (6) final property with getter (512) */];
+  optional int32 old_flags = 1 [default = 2054];
 
   required int32 name = 2 [(name_id_in_table) = true];
 
diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/Flags.java b/core/deserialization/src/org/jetbrains/kotlin/serialization/Flags.java
index 941112fd169..e33bb5aa4a5 100644
--- a/core/deserialization/src/org/jetbrains/kotlin/serialization/Flags.java
+++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/Flags.java
@@ -36,18 +36,14 @@ public class Flags {
     public static final BooleanFlagField IS_INNER = FlagField.booleanAfter(CLASS_KIND);
     public static final BooleanFlagField IS_DATA = FlagField.booleanAfter(IS_INNER);
 
-    // Callables
-
-    // TODO: use these flags
-    public static final BooleanFlagField RESERVED_1 = FlagField.booleanAfter(MODALITY);
-    public static final BooleanFlagField RESERVED_2 = FlagField.booleanAfter(RESERVED_1);
-
-    public static final FlagField MEMBER_KIND = FlagField.after(RESERVED_2, ProtoBuf.MemberKind.values());
-
     // Constructors
 
     public static final BooleanFlagField IS_SECONDARY = FlagField.booleanAfter(VISIBILITY);
 
+    // Callables
+
+    public static final FlagField MEMBER_KIND = FlagField.after(MODALITY, ProtoBuf.MemberKind.values());
+
     // Functions
 
     public static final BooleanFlagField IS_OPERATOR = FlagField.booleanAfter(MEMBER_KIND);
@@ -73,7 +69,6 @@ public class Flags {
 
     // Accessors
 
-    // It's important that this flag is negated: "is NOT default" instead of "is default"
     public static final BooleanFlagField IS_NOT_DEFAULT = FlagField.booleanAfter(MODALITY);
     public static final BooleanFlagField IS_EXTERNAL_ACCESSOR = FlagField.booleanAfter(IS_NOT_DEFAULT);
 
diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/ProtoBuf.java b/core/deserialization/src/org/jetbrains/kotlin/serialization/ProtoBuf.java
index 2dd06d4743e..0dc867a480b 100644
--- a/core/deserialization/src/org/jetbrains/kotlin/serialization/ProtoBuf.java
+++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/ProtoBuf.java
@@ -11965,9 +11965,9 @@ public final class ProtoBuf {
        com.google.protobuf.GeneratedMessageLite.
             ExtendableMessageOrBuilder {
 
-    // optional int32 flags = 1 [default = 6];
+    // optional int32 flags = 9 [default = 6];
     /**
-     * optional int32 flags = 1 [default = 6];
+     * optional int32 flags = 9 [default = 6];
      *
      * 
      *
@@ -11984,7 +11984,7 @@ public final class ProtoBuf {
      */
     boolean hasFlags();
     /**
-     * optional int32 flags = 1 [default = 6];
+     * optional int32 flags = 9 [default = 6];
      *
      * 
      *
@@ -12001,15 +12001,15 @@ public final class ProtoBuf {
      */
     int getFlags();
 
-    // optional int32 new_flags = 9 [default = 6];
+    // optional int32 old_flags = 1 [default = 6];
     /**
-     * optional int32 new_flags = 9 [default = 6];
+     * optional int32 old_flags = 1 [default = 6];
      */
-    boolean hasNewFlags();
+    boolean hasOldFlags();
     /**
-     * optional int32 new_flags = 9 [default = 6];
+     * optional int32 old_flags = 1 [default = 6];
      */
-    int getNewFlags();
+    int getOldFlags();
 
     // required int32 name = 2;
     /**
@@ -12145,8 +12145,8 @@ public final class ProtoBuf {
               break;
             }
             case 8: {
-              bitField0_ |= 0x00000001;
-              flags_ = input.readInt32();
+              bitField0_ |= 0x00000002;
+              oldFlags_ = input.readInt32();
               break;
             }
             case 16: {
@@ -12207,8 +12207,8 @@ public final class ProtoBuf {
               break;
             }
             case 72: {
-              bitField0_ |= 0x00000002;
-              newFlags_ = input.readInt32();
+              bitField0_ |= 0x00000001;
+              flags_ = input.readInt32();
               break;
             }
             case 242: {
@@ -12257,11 +12257,11 @@ public final class ProtoBuf {
     }
 
     private int bitField0_;
-    // optional int32 flags = 1 [default = 6];
-    public static final int FLAGS_FIELD_NUMBER = 1;
+    // optional int32 flags = 9 [default = 6];
+    public static final int FLAGS_FIELD_NUMBER = 9;
     private int flags_;
     /**
-     * optional int32 flags = 1 [default = 6];
+     * optional int32 flags = 9 [default = 6];
      *
      * 
      *
@@ -12280,7 +12280,7 @@ public final class ProtoBuf {
       return ((bitField0_ & 0x00000001) == 0x00000001);
     }
     /**
-     * optional int32 flags = 1 [default = 6];
+     * optional int32 flags = 9 [default = 6];
      *
      * 
      *
@@ -12299,20 +12299,20 @@ public final class ProtoBuf {
       return flags_;
     }
 
-    // optional int32 new_flags = 9 [default = 6];
-    public static final int NEW_FLAGS_FIELD_NUMBER = 9;
-    private int newFlags_;
+    // optional int32 old_flags = 1 [default = 6];
+    public static final int OLD_FLAGS_FIELD_NUMBER = 1;
+    private int oldFlags_;
     /**
-     * optional int32 new_flags = 9 [default = 6];
+     * optional int32 old_flags = 1 [default = 6];
      */
-    public boolean hasNewFlags() {
+    public boolean hasOldFlags() {
       return ((bitField0_ & 0x00000002) == 0x00000002);
     }
     /**
-     * optional int32 new_flags = 9 [default = 6];
+     * optional int32 old_flags = 1 [default = 6];
      */
-    public int getNewFlags() {
-      return newFlags_;
+    public int getOldFlags() {
+      return oldFlags_;
     }
 
     // required int32 name = 2;
@@ -12485,7 +12485,7 @@ public final class ProtoBuf {
 
     private void initFields() {
       flags_ = 6;
-      newFlags_ = 6;
+      oldFlags_ = 6;
       name_ = 0;
       returnType_ = org.jetbrains.kotlin.serialization.ProtoBuf.Type.getDefaultInstance();
       returnTypeId_ = 0;
@@ -12548,8 +12548,8 @@ public final class ProtoBuf {
       com.google.protobuf.GeneratedMessageLite
         .ExtendableMessage.ExtensionWriter extensionWriter =
           newExtensionWriter();
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        output.writeInt32(1, flags_);
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeInt32(1, oldFlags_);
       }
       if (((bitField0_ & 0x00000004) == 0x00000004)) {
         output.writeInt32(2, name_);
@@ -12572,8 +12572,8 @@ public final class ProtoBuf {
       if (((bitField0_ & 0x00000040) == 0x00000040)) {
         output.writeInt32(8, receiverTypeId_);
       }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        output.writeInt32(9, newFlags_);
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeInt32(9, flags_);
       }
       if (((bitField0_ & 0x00000080) == 0x00000080)) {
         output.writeMessage(30, typeTable_);
@@ -12587,9 +12587,9 @@ public final class ProtoBuf {
       if (size != -1) return size;
 
       size = 0;
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeInt32Size(1, flags_);
+          .computeInt32Size(1, oldFlags_);
       }
       if (((bitField0_ & 0x00000004) == 0x00000004)) {
         size += com.google.protobuf.CodedOutputStream
@@ -12619,9 +12619,9 @@ public final class ProtoBuf {
         size += com.google.protobuf.CodedOutputStream
           .computeInt32Size(8, receiverTypeId_);
       }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeInt32Size(9, newFlags_);
+          .computeInt32Size(9, flags_);
       }
       if (((bitField0_ & 0x00000080) == 0x00000080)) {
         size += com.google.protobuf.CodedOutputStream
@@ -12720,7 +12720,7 @@ public final class ProtoBuf {
         super.clear();
         flags_ = 6;
         bitField0_ = (bitField0_ & ~0x00000001);
-        newFlags_ = 6;
+        oldFlags_ = 6;
         bitField0_ = (bitField0_ & ~0x00000002);
         name_ = 0;
         bitField0_ = (bitField0_ & ~0x00000004);
@@ -12768,7 +12768,7 @@ public final class ProtoBuf {
         if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
           to_bitField0_ |= 0x00000002;
         }
-        result.newFlags_ = newFlags_;
+        result.oldFlags_ = oldFlags_;
         if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
           to_bitField0_ |= 0x00000004;
         }
@@ -12812,8 +12812,8 @@ public final class ProtoBuf {
         if (other.hasFlags()) {
           setFlags(other.getFlags());
         }
-        if (other.hasNewFlags()) {
-          setNewFlags(other.getNewFlags());
+        if (other.hasOldFlags()) {
+          setOldFlags(other.getOldFlags());
         }
         if (other.hasName()) {
           setName(other.getName());
@@ -12918,10 +12918,10 @@ public final class ProtoBuf {
       }
       private int bitField0_;
 
-      // optional int32 flags = 1 [default = 6];
+      // optional int32 flags = 9 [default = 6];
       private int flags_ = 6;
       /**
-       * optional int32 flags = 1 [default = 6];
+       * optional int32 flags = 9 [default = 6];
        *
        * 
        *
@@ -12940,7 +12940,7 @@ public final class ProtoBuf {
         return ((bitField0_ & 0x00000001) == 0x00000001);
       }
       /**
-       * optional int32 flags = 1 [default = 6];
+       * optional int32 flags = 9 [default = 6];
        *
        * 
        *
@@ -12959,7 +12959,7 @@ public final class ProtoBuf {
         return flags_;
       }
       /**
-       * optional int32 flags = 1 [default = 6];
+       * optional int32 flags = 9 [default = 6];
        *
        * 
        *
@@ -12981,7 +12981,7 @@ public final class ProtoBuf {
         return this;
       }
       /**
-       * optional int32 flags = 1 [default = 6];
+       * optional int32 flags = 9 [default = 6];
        *
        * 
        *
@@ -13003,35 +13003,35 @@ public final class ProtoBuf {
         return this;
       }
 
-      // optional int32 new_flags = 9 [default = 6];
-      private int newFlags_ = 6;
+      // optional int32 old_flags = 1 [default = 6];
+      private int oldFlags_ = 6;
       /**
-       * optional int32 new_flags = 9 [default = 6];
+       * optional int32 old_flags = 1 [default = 6];
        */
-      public boolean hasNewFlags() {
+      public boolean hasOldFlags() {
         return ((bitField0_ & 0x00000002) == 0x00000002);
       }
       /**
-       * optional int32 new_flags = 9 [default = 6];
+       * optional int32 old_flags = 1 [default = 6];
        */
-      public int getNewFlags() {
-        return newFlags_;
+      public int getOldFlags() {
+        return oldFlags_;
       }
       /**
-       * optional int32 new_flags = 9 [default = 6];
+       * optional int32 old_flags = 1 [default = 6];
        */
-      public Builder setNewFlags(int value) {
+      public Builder setOldFlags(int value) {
         bitField0_ |= 0x00000002;
-        newFlags_ = value;
+        oldFlags_ = value;
         
         return this;
       }
       /**
-       * optional int32 new_flags = 9 [default = 6];
+       * optional int32 old_flags = 1 [default = 6];
        */
-      public Builder clearNewFlags() {
+      public Builder clearOldFlags() {
         bitField0_ = (bitField0_ & ~0x00000002);
-        newFlags_ = 6;
+        oldFlags_ = 6;
         
         return this;
       }
@@ -13583,9 +13583,9 @@ public final class ProtoBuf {
        com.google.protobuf.GeneratedMessageLite.
             ExtendableMessageOrBuilder {
 
-    // optional int32 flags = 1 [default = 262];
+    // optional int32 flags = 11 [default = 518];
     /**
-     * optional int32 flags = 1 [default = 262];
+     * optional int32 flags = 11 [default = 518];
      *
      * 
      *
@@ -13603,7 +13603,7 @@ public final class ProtoBuf {
      */
     boolean hasFlags();
     /**
-     * optional int32 flags = 1 [default = 262];
+     * optional int32 flags = 11 [default = 518];
      *
      * 
      *
@@ -13621,15 +13621,15 @@ public final class ProtoBuf {
      */
     int getFlags();
 
-    // optional int32 new_flags = 11 [default = 518];
+    // optional int32 old_flags = 1 [default = 2054];
     /**
-     * optional int32 new_flags = 11 [default = 518];
+     * optional int32 old_flags = 1 [default = 2054];
      */
-    boolean hasNewFlags();
+    boolean hasOldFlags();
     /**
-     * optional int32 new_flags = 11 [default = 518];
+     * optional int32 old_flags = 1 [default = 2054];
      */
-    int getNewFlags();
+    int getOldFlags();
 
     // required int32 name = 2;
     /**
@@ -13788,8 +13788,8 @@ public final class ProtoBuf {
               break;
             }
             case 8: {
-              bitField0_ |= 0x00000001;
-              flags_ = input.readInt32();
+              bitField0_ |= 0x00000002;
+              oldFlags_ = input.readInt32();
               break;
             }
             case 16: {
@@ -13865,8 +13865,8 @@ public final class ProtoBuf {
               break;
             }
             case 88: {
-              bitField0_ |= 0x00000002;
-              newFlags_ = input.readInt32();
+              bitField0_ |= 0x00000001;
+              flags_ = input.readInt32();
               break;
             }
           }
@@ -13899,11 +13899,11 @@ public final class ProtoBuf {
     }
 
     private int bitField0_;
-    // optional int32 flags = 1 [default = 262];
-    public static final int FLAGS_FIELD_NUMBER = 1;
+    // optional int32 flags = 11 [default = 518];
+    public static final int FLAGS_FIELD_NUMBER = 11;
     private int flags_;
     /**
-     * optional int32 flags = 1 [default = 262];
+     * optional int32 flags = 11 [default = 518];
      *
      * 
      *
@@ -13923,7 +13923,7 @@ public final class ProtoBuf {
       return ((bitField0_ & 0x00000001) == 0x00000001);
     }
     /**
-     * optional int32 flags = 1 [default = 262];
+     * optional int32 flags = 11 [default = 518];
      *
      * 
      *
@@ -13943,20 +13943,20 @@ public final class ProtoBuf {
       return flags_;
     }
 
-    // optional int32 new_flags = 11 [default = 518];
-    public static final int NEW_FLAGS_FIELD_NUMBER = 11;
-    private int newFlags_;
+    // optional int32 old_flags = 1 [default = 2054];
+    public static final int OLD_FLAGS_FIELD_NUMBER = 1;
+    private int oldFlags_;
     /**
-     * optional int32 new_flags = 11 [default = 518];
+     * optional int32 old_flags = 1 [default = 2054];
      */
-    public boolean hasNewFlags() {
+    public boolean hasOldFlags() {
       return ((bitField0_ & 0x00000002) == 0x00000002);
     }
     /**
-     * optional int32 new_flags = 11 [default = 518];
+     * optional int32 old_flags = 1 [default = 2054];
      */
-    public int getNewFlags() {
-      return newFlags_;
+    public int getOldFlags() {
+      return oldFlags_;
     }
 
     // required int32 name = 2;
@@ -14142,8 +14142,8 @@ public final class ProtoBuf {
     }
 
     private void initFields() {
-      flags_ = 262;
-      newFlags_ = 518;
+      flags_ = 518;
+      oldFlags_ = 2054;
       name_ = 0;
       returnType_ = org.jetbrains.kotlin.serialization.ProtoBuf.Type.getDefaultInstance();
       returnTypeId_ = 0;
@@ -14201,8 +14201,8 @@ public final class ProtoBuf {
       com.google.protobuf.GeneratedMessageLite
         .ExtendableMessage.ExtensionWriter extensionWriter =
           newExtensionWriter();
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
-        output.writeInt32(1, flags_);
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+        output.writeInt32(1, oldFlags_);
       }
       if (((bitField0_ & 0x00000004) == 0x00000004)) {
         output.writeInt32(2, name_);
@@ -14231,8 +14231,8 @@ public final class ProtoBuf {
       if (((bitField0_ & 0x00000040) == 0x00000040)) {
         output.writeInt32(10, receiverTypeId_);
       }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
-        output.writeInt32(11, newFlags_);
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+        output.writeInt32(11, flags_);
       }
       extensionWriter.writeUntil(200, output);
     }
@@ -14243,9 +14243,9 @@ public final class ProtoBuf {
       if (size != -1) return size;
 
       size = 0;
-      if (((bitField0_ & 0x00000001) == 0x00000001)) {
+      if (((bitField0_ & 0x00000002) == 0x00000002)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeInt32Size(1, flags_);
+          .computeInt32Size(1, oldFlags_);
       }
       if (((bitField0_ & 0x00000004) == 0x00000004)) {
         size += com.google.protobuf.CodedOutputStream
@@ -14283,9 +14283,9 @@ public final class ProtoBuf {
         size += com.google.protobuf.CodedOutputStream
           .computeInt32Size(10, receiverTypeId_);
       }
-      if (((bitField0_ & 0x00000002) == 0x00000002)) {
+      if (((bitField0_ & 0x00000001) == 0x00000001)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeInt32Size(11, newFlags_);
+          .computeInt32Size(11, flags_);
       }
       size += extensionsSerializedSize();
       memoizedSerializedSize = size;
@@ -14378,9 +14378,9 @@ public final class ProtoBuf {
 
       public Builder clear() {
         super.clear();
-        flags_ = 262;
+        flags_ = 518;
         bitField0_ = (bitField0_ & ~0x00000001);
-        newFlags_ = 518;
+        oldFlags_ = 2054;
         bitField0_ = (bitField0_ & ~0x00000002);
         name_ = 0;
         bitField0_ = (bitField0_ & ~0x00000004);
@@ -14430,7 +14430,7 @@ public final class ProtoBuf {
         if (((from_bitField0_ & 0x00000002) == 0x00000002)) {
           to_bitField0_ |= 0x00000002;
         }
-        result.newFlags_ = newFlags_;
+        result.oldFlags_ = oldFlags_;
         if (((from_bitField0_ & 0x00000004) == 0x00000004)) {
           to_bitField0_ |= 0x00000004;
         }
@@ -14477,8 +14477,8 @@ public final class ProtoBuf {
         if (other.hasFlags()) {
           setFlags(other.getFlags());
         }
-        if (other.hasNewFlags()) {
-          setNewFlags(other.getNewFlags());
+        if (other.hasOldFlags()) {
+          setOldFlags(other.getOldFlags());
         }
         if (other.hasName()) {
           setName(other.getName());
@@ -14573,10 +14573,10 @@ public final class ProtoBuf {
       }
       private int bitField0_;
 
-      // optional int32 flags = 1 [default = 262];
-      private int flags_ = 262;
+      // optional int32 flags = 11 [default = 518];
+      private int flags_ = 518;
       /**
-       * optional int32 flags = 1 [default = 262];
+       * optional int32 flags = 11 [default = 518];
        *
        * 
        *
@@ -14596,7 +14596,7 @@ public final class ProtoBuf {
         return ((bitField0_ & 0x00000001) == 0x00000001);
       }
       /**
-       * optional int32 flags = 1 [default = 262];
+       * optional int32 flags = 11 [default = 518];
        *
        * 
        *
@@ -14616,7 +14616,7 @@ public final class ProtoBuf {
         return flags_;
       }
       /**
-       * optional int32 flags = 1 [default = 262];
+       * optional int32 flags = 11 [default = 518];
        *
        * 
        *
@@ -14639,7 +14639,7 @@ public final class ProtoBuf {
         return this;
       }
       /**
-       * optional int32 flags = 1 [default = 262];
+       * optional int32 flags = 11 [default = 518];
        *
        * 
        *
@@ -14657,40 +14657,40 @@ public final class ProtoBuf {
        */
       public Builder clearFlags() {
         bitField0_ = (bitField0_ & ~0x00000001);
-        flags_ = 262;
+        flags_ = 518;
         
         return this;
       }
 
-      // optional int32 new_flags = 11 [default = 518];
-      private int newFlags_ = 518;
+      // optional int32 old_flags = 1 [default = 2054];
+      private int oldFlags_ = 2054;
       /**
-       * optional int32 new_flags = 11 [default = 518];
+       * optional int32 old_flags = 1 [default = 2054];
        */
-      public boolean hasNewFlags() {
+      public boolean hasOldFlags() {
         return ((bitField0_ & 0x00000002) == 0x00000002);
       }
       /**
-       * optional int32 new_flags = 11 [default = 518];
+       * optional int32 old_flags = 1 [default = 2054];
        */
-      public int getNewFlags() {
-        return newFlags_;
+      public int getOldFlags() {
+        return oldFlags_;
       }
       /**
-       * optional int32 new_flags = 11 [default = 518];
+       * optional int32 old_flags = 1 [default = 2054];
        */
-      public Builder setNewFlags(int value) {
+      public Builder setOldFlags(int value) {
         bitField0_ |= 0x00000002;
-        newFlags_ = value;
+        oldFlags_ = value;
         
         return this;
       }
       /**
-       * optional int32 new_flags = 11 [default = 518];
+       * optional int32 old_flags = 1 [default = 2054];
        */
-      public Builder clearNewFlags() {
+      public Builder clearOldFlags() {
         bitField0_ = (bitField0_ & ~0x00000002);
-        newFlags_ = 518;
+        oldFlags_ = 2054;
         
         return this;
       }
diff --git a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt
index d0255c76103..787fc815303 100644
--- a/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt
+++ b/core/deserialization/src/org/jetbrains/kotlin/serialization/deserialization/MemberDeserializer.kt
@@ -32,7 +32,7 @@ import org.jetbrains.kotlin.utils.toReadOnlyList
 
 class MemberDeserializer(private val c: DeserializationContext) {
     fun loadProperty(proto: ProtoBuf.Property): PropertyDescriptor {
-        val flags = proto.flags
+        val flags = if (proto.hasFlags()) proto.flags else loadOldFlags(proto.oldFlags)
 
         val property = DeserializedPropertyDescriptor(
                 c.containingDeclaration, null,
@@ -135,14 +135,21 @@ class MemberDeserializer(private val c: DeserializationContext) {
         return property
     }
 
+    private fun loadOldFlags(oldFlags: Int): Int {
+        val lowSixBits = oldFlags and 0x3f
+        val rest = (oldFlags shr 8) shl 6
+        return lowSixBits + rest
+    }
+
     fun loadFunction(proto: ProtoBuf.Function): FunctionDescriptor {
-        val annotations = getAnnotations(proto, proto.flags, AnnotatedCallableKind.FUNCTION)
+        val flags = if (proto.hasFlags()) proto.flags else loadOldFlags(proto.oldFlags)
+        val annotations = getAnnotations(proto, flags, AnnotatedCallableKind.FUNCTION)
         val receiverAnnotations = if (proto.hasReceiver())
             getReceiverParameterAnnotations(proto, AnnotatedCallableKind.FUNCTION)
         else Annotations.EMPTY
         val function = DeserializedSimpleFunctionDescriptor(
                 c.containingDeclaration, /* original = */ null, annotations, c.nameResolver.getName(proto.name),
-                Deserialization.memberKind(Flags.MEMBER_KIND.get(proto.flags)), proto, c.nameResolver, c.typeTable, c.packagePartSource
+                Deserialization.memberKind(Flags.MEMBER_KIND.get(flags)), proto, c.nameResolver, c.typeTable, c.packagePartSource
         )
         val local = c.childContext(function, proto.typeParameterList)
         function.initialize(
@@ -151,14 +158,14 @@ class MemberDeserializer(private val c: DeserializationContext) {
                 local.typeDeserializer.ownTypeParameters,
                 local.memberDeserializer.valueParameters(proto.valueParameterList, proto, AnnotatedCallableKind.FUNCTION),
                 local.typeDeserializer.type(proto.returnType(c.typeTable)),
-                Deserialization.modality(Flags.MODALITY.get(proto.flags)),
-                Deserialization.visibility(Flags.VISIBILITY.get(proto.flags))
+                Deserialization.modality(Flags.MODALITY.get(flags)),
+                Deserialization.visibility(Flags.VISIBILITY.get(flags))
         )
-        function.isOperator = Flags.IS_OPERATOR.get(proto.flags)
-        function.isInfix = Flags.IS_INFIX.get(proto.flags)
-        function.isExternal = Flags.IS_EXTERNAL_FUNCTION.get(proto.flags)
-        function.isInline = Flags.IS_INLINE.get(proto.flags)
-        function.isTailrec = Flags.IS_TAILREC.get(proto.flags)
+        function.isOperator = Flags.IS_OPERATOR.get(flags)
+        function.isInfix = Flags.IS_INFIX.get(flags)
+        function.isExternal = Flags.IS_EXTERNAL_FUNCTION.get(flags)
+        function.isInline = Flags.IS_INLINE.get(flags)
+        function.isTailrec = Flags.IS_TAILREC.get(flags)
         return function
     }