diff --git a/core/builtins/native/kotlin/Boolean.kt b/core/builtins/native/kotlin/Boolean.kt index 2822171b562..a2b0dc1bd9f 100644 --- a/core/builtins/native/kotlin/Boolean.kt +++ b/core/builtins/native/kotlin/Boolean.kt @@ -14,7 +14,7 @@ package kotlin */ public class Boolean private constructor() : Comparable { @SinceKotlin("1.3") - companion object {} + public companion object {} /** Returns the inverse of this boolean. */ @kotlin.internal.IntrinsicConstEvaluation diff --git a/core/builtins/native/kotlin/Char.kt b/core/builtins/native/kotlin/Char.kt index f521403d196..0652b537a12 100644 --- a/core/builtins/native/kotlin/Char.kt +++ b/core/builtins/native/kotlin/Char.kt @@ -108,7 +108,7 @@ public class Char private constructor() : Comparable { public override fun hashCode(): Int - companion object { + public companion object { /** * The minimum value of a character code unit. */ diff --git a/core/builtins/native/kotlin/Primitives.kt b/core/builtins/native/kotlin/Primitives.kt index 7742e055dcf..50b4272eff9 100644 --- a/core/builtins/native/kotlin/Primitives.kt +++ b/core/builtins/native/kotlin/Primitives.kt @@ -13,7 +13,7 @@ package kotlin * On the JVM, non-nullable values of this type are represented as values of the primitive type `byte`. */ public class Byte private constructor() : Number(), Comparable { - companion object { + public companion object { /** * A constant holding the minimum value an instance of Byte can have. */ @@ -383,7 +383,7 @@ public class Byte private constructor() : Number(), Comparable { * On the JVM, non-nullable values of this type are represented as values of the primitive type `short`. */ public class Short private constructor() : Number(), Comparable { - companion object { + public companion object { /** * A constant holding the minimum value an instance of Short can have. */ @@ -751,7 +751,7 @@ public class Short private constructor() : Number(), Comparable { * On the JVM, non-nullable values of this type are represented as values of the primitive type `int`. */ public class Int private constructor() : Number(), Comparable { - companion object { + public companion object { /** * A constant holding the minimum value an instance of Int can have. */ @@ -1165,7 +1165,7 @@ public class Int private constructor() : Number(), Comparable { * On the JVM, non-nullable values of this type are represented as values of the primitive type `long`. */ public class Long private constructor() : Number(), Comparable { - companion object { + public companion object { /** * A constant holding the minimum value an instance of Long can have. */ @@ -1582,7 +1582,7 @@ public class Long private constructor() : Number(), Comparable { * On the JVM, non-nullable values of this type are represented as values of the primitive type `float`. */ public class Float private constructor() : Number(), Comparable { - companion object { + public companion object { /** * A constant holding the smallest *positive* nonzero value of Float. */ @@ -1915,7 +1915,7 @@ public class Float private constructor() : Number(), Comparable { * On the JVM, non-nullable values of this type are represented as values of the primitive type `double`. */ public class Double private constructor() : Number(), Comparable { - companion object { + public companion object { /** * A constant holding the smallest *positive* nonzero value of Double. */ diff --git a/generators/builtins/primitives/BooleanGenerator.kt b/generators/builtins/primitives/BooleanGenerator.kt index bf3419a4a5f..7c99142f88d 100644 --- a/generators/builtins/primitives/BooleanGenerator.kt +++ b/generators/builtins/primitives/BooleanGenerator.kt @@ -199,10 +199,6 @@ class WasmBooleanGenerator(writer: PrintWriter) : BooleanGenerator(writer) { } } - override fun CompanionObjectBuilder.modifyGeneratedCompanionObject() { - isPublic = true - } - override fun MethodBuilder.modifyGeneratedNot() { implementAsIntrinsic(PrimitiveType.BOOLEAN, methodName) } diff --git a/generators/builtins/primitives/CharGenerator.kt b/generators/builtins/primitives/CharGenerator.kt index a5fbdeac9d7..3187d5fc21e 100644 --- a/generators/builtins/primitives/CharGenerator.kt +++ b/generators/builtins/primitives/CharGenerator.kt @@ -446,7 +446,6 @@ class WasmCharGenerator(writer: PrintWriter) : CharGenerator(writer) { } override fun CompanionObjectBuilder.modifyGeneratedCompanionObject() { - isPublic = true property { appendDoc("The minimum value of a supplementary code point, `\\u0x10000`.") visibility = MethodVisibility.INTERNAL diff --git a/generators/builtins/primitives/WasmPrimitivesGenerator.kt b/generators/builtins/primitives/WasmPrimitivesGenerator.kt index 32be7499f79..33abb5f4c98 100644 --- a/generators/builtins/primitives/WasmPrimitivesGenerator.kt +++ b/generators/builtins/primitives/WasmPrimitivesGenerator.kt @@ -29,10 +29,6 @@ class WasmPrimitivesGenerator(writer: PrintWriter) : BasePrimitivesGenerator(wri } } - override fun CompanionObjectBuilder.modifyGeneratedCompanionObject(thisKind: PrimitiveType) { - isPublic = true - } - override fun primitiveConstants(type: PrimitiveType): List { return when (type) { PrimitiveType.FLOAT -> listOf( diff --git a/generators/builtins/primitives/builders.kt b/generators/builtins/primitives/builders.kt index 1620e0cfd2e..d8012fd8874 100644 --- a/generators/builtins/primitives/builders.kt +++ b/generators/builtins/primitives/builders.kt @@ -188,7 +188,6 @@ internal class ClassBuilder : AnnotatedAndDocumented(), PrimitiveBuilder { } internal class CompanionObjectBuilder : AnnotatedAndDocumented(), PrimitiveBuilder { - var isPublic: Boolean = false private val properties: MutableList = mutableListOf() fun property(init: PropertyBuilder.() -> Unit): PropertyBuilder { @@ -200,7 +199,7 @@ internal class CompanionObjectBuilder : AnnotatedAndDocumented(), PrimitiveBuild override fun build(): String { return buildString { printDocumentationAndAnnotations() - if (isPublic) append("public ") + append("public ") if (properties.isEmpty()) { append("companion object {}") } else { @@ -235,7 +234,7 @@ internal class PrimaryConstructorBuilder : AnnotatedAndDocumented(), PrimitiveBu } internal class SecondaryConstructorBuilder : AnnotatedAndDocumented(), PrimitiveBuilder { - var visibility: MethodVisibility? = MethodVisibility.PRIVATE + var visibility: MethodVisibility = MethodVisibility.PRIVATE private var parameters: MutableList = mutableListOf() private var argumentsToPrimaryContructor: MutableList = mutableListOf() @@ -253,7 +252,7 @@ internal class SecondaryConstructorBuilder : AnnotatedAndDocumented(), Primitive return buildString { printDocumentationAndAnnotations() - visibility?.let { append("${it.name.lowercase()} ") } + append("${visibility.name.lowercase()} ") append("constructor") append(parameters.joinToString(prefix = "(", postfix = ") : ") { it.build() }) append(argumentsToPrimaryContructor.joinToString(prefix = "this(", postfix = ")")) diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/Boolean.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/Boolean.kt index 231a465e36d..ee8355cdf75 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/Boolean.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/Boolean.kt @@ -14,7 +14,7 @@ import kotlin.native.internal.IntrinsicType /** Represents a value which is either `true` or `false`. */ public class Boolean private constructor() : Comparable { @SinceKotlin("1.3") - companion object {} + public companion object {} /** Returns the inverse of this boolean. */ @kotlin.internal.IntrinsicConstEvaluation diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/Char.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/Char.kt index f943783b608..6e9828ad91c 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/Char.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/Char.kt @@ -137,7 +137,7 @@ public class Char private constructor() : Comparable { this == other @kotlin.native.internal.CanBePrecreated - companion object { + public companion object { /** * The minimum value of a character code unit. */ diff --git a/kotlin-native/runtime/src/main/kotlin/kotlin/Primitives.kt b/kotlin-native/runtime/src/main/kotlin/kotlin/Primitives.kt index 3178b982ac2..90adcb61f36 100644 --- a/kotlin-native/runtime/src/main/kotlin/kotlin/Primitives.kt +++ b/kotlin-native/runtime/src/main/kotlin/kotlin/Primitives.kt @@ -15,7 +15,7 @@ import kotlin.native.internal.* /** Represents a 8-bit signed integer. */ public class Byte private constructor() : Number(), Comparable { @CanBePrecreated - companion object { + public companion object { /** * A constant holding the minimum value an instance of Byte can have. */ @@ -448,7 +448,7 @@ public class Byte private constructor() : Number(), Comparable { /** Represents a 16-bit signed integer. */ public class Short private constructor() : Number(), Comparable { @CanBePrecreated - companion object { + public companion object { /** * A constant holding the minimum value an instance of Short can have. */ @@ -879,7 +879,7 @@ public class Short private constructor() : Number(), Comparable { /** Represents a 32-bit signed integer. */ public class Int private constructor() : Number(), Comparable { @CanBePrecreated - companion object { + public companion object { /** * A constant holding the minimum value an instance of Int can have. */ @@ -1363,7 +1363,7 @@ public class Int private constructor() : Number(), Comparable { /** Represents a 64-bit signed integer. */ public class Long private constructor() : Number(), Comparable { @CanBePrecreated - companion object { + public companion object { /** * A constant holding the minimum value an instance of Long can have. */ @@ -1849,7 +1849,7 @@ public class Long private constructor() : Number(), Comparable { /** Represents a single-precision 32-bit IEEE 754 floating point number. */ public class Float private constructor() : Number(), Comparable { - companion object { + public companion object { /** * A constant holding the smallest *positive* nonzero value of Float. */ @@ -2260,7 +2260,7 @@ public class Float private constructor() : Number(), Comparable { /** Represents a double-precision 64-bit IEEE 754 floating point number. */ public class Double private constructor() : Number(), Comparable { - companion object { + public companion object { /** * A constant holding the smallest *positive* nonzero value of Double. */ diff --git a/libraries/stdlib/js/builtins/Boolean.kt b/libraries/stdlib/js/builtins/Boolean.kt index ceae2e0e162..9b2f3aa92fe 100644 --- a/libraries/stdlib/js/builtins/Boolean.kt +++ b/libraries/stdlib/js/builtins/Boolean.kt @@ -13,7 +13,7 @@ package kotlin /** Represents a value which is either `true` or `false`. */ public class Boolean private constructor() : Comparable { @SinceKotlin("1.3") - companion object {} + public companion object {} /** Returns the inverse of this boolean. */ @kotlin.internal.IntrinsicConstEvaluation diff --git a/libraries/stdlib/js/builtins/Char.kt b/libraries/stdlib/js/builtins/Char.kt index 23893e69910..afad90730a3 100644 --- a/libraries/stdlib/js/builtins/Char.kt +++ b/libraries/stdlib/js/builtins/Char.kt @@ -139,7 +139,7 @@ internal constructor(private val value: Int) : Comparable { public override fun hashCode(): Int = value - companion object { + public companion object { /** * The minimum value of a character code unit. */ diff --git a/libraries/stdlib/js/builtins/Primitives.kt b/libraries/stdlib/js/builtins/Primitives.kt index c606a25d059..df457a1f43a 100644 --- a/libraries/stdlib/js/builtins/Primitives.kt +++ b/libraries/stdlib/js/builtins/Primitives.kt @@ -12,7 +12,7 @@ package kotlin /** Represents a 8-bit signed integer. */ public class Byte private constructor() : Number(), Comparable { - companion object { + public companion object { /** * A constant holding the minimum value an instance of Byte can have. */ @@ -385,7 +385,7 @@ public class Byte private constructor() : Number(), Comparable { /** Represents a 16-bit signed integer. */ public class Short private constructor() : Number(), Comparable { - companion object { + public companion object { /** * A constant holding the minimum value an instance of Short can have. */ @@ -756,7 +756,7 @@ public class Short private constructor() : Number(), Comparable { /** Represents a 32-bit signed integer. */ public class Int private constructor() : Number(), Comparable { - companion object { + public companion object { /** * A constant holding the minimum value an instance of Int can have. */ @@ -1174,7 +1174,7 @@ public class Int private constructor() : Number(), Comparable { /** Represents a 64-bit signed integer. */ @Suppress("NOTHING_TO_INLINE") public class Long internal constructor(internal val low: Int, internal val high: Int) : Number(), Comparable { - companion object { + public companion object { /** * A constant holding the minimum value an instance of Long can have. */ @@ -1665,7 +1665,7 @@ public class Long internal constructor(internal val low: Int, internal val high: /** Represents a single-precision 32-bit IEEE 754 floating point number. */ public class Float private constructor() : Number(), Comparable { - companion object { + public companion object { /** * A constant holding the smallest *positive* nonzero value of Float. */ @@ -2000,7 +2000,7 @@ public class Float private constructor() : Number(), Comparable { /** Represents a double-precision 64-bit IEEE 754 floating point number. */ public class Double private constructor() : Number(), Comparable { - companion object { + public companion object { /** * A constant holding the smallest *positive* nonzero value of Double. */