Skip to content

Commit 90220d5

Browse files
authored
Merge pull request #866 from Kotlin/revert-interfaces-with-fields
Revert "Generate fields in REPL for data schemas"
2 parents c3069a3 + 72a5ea1 commit 90220d5

File tree

6 files changed

+18
-76
lines changed

6 files changed

+18
-76
lines changed

core/generated-sources/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/codeGen/ReplCodeGeneratorImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ internal class ReplCodeGeneratorImpl : ReplCodeGenerator {
8282
val result = generator.generate(
8383
schema = schema,
8484
name = name,
85-
fields = true,
85+
fields = false,
8686
extensionProperties = true,
8787
isOpen = isOpen,
8888
visibility = MarkerVisibility.IMPLICIT_PUBLIC,

core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/CodeGenerationTests.kt

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,7 @@ class CodeGenerationTests : BaseTest() {
107107
val expectedDeclaration =
108108
"""
109109
@DataSchema
110-
interface $typeName {
111-
val age: Int
112-
val city: String?
113-
val name: String
114-
val weight: Int?
115-
}
110+
interface $typeName { }
116111
117112
""".trimIndent() + "\n" + expectedProperties(typeName, typeName)
118113

@@ -138,12 +133,7 @@ class CodeGenerationTests : BaseTest() {
138133
val expectedDeclaration =
139134
"""
140135
@DataSchema
141-
interface $typeName {
142-
val age: Int
143-
val city: String?
144-
val name: String
145-
val weight: Int?
146-
}
136+
interface $typeName { }
147137
148138
""".trimIndent() + "\n" + expectedProperties(typeName, typeName)
149139

@@ -163,10 +153,7 @@ class CodeGenerationTests : BaseTest() {
163153
val declaration1 =
164154
"""
165155
@DataSchema(isOpen = false)
166-
interface $type1 {
167-
val city: String?
168-
val name: String
169-
}
156+
interface $type1 { }
170157
171158
val $dfName<$type1>.city: $dataCol<$stringName?> @JvmName("${type1}_city") get() = this["city"] as $dataCol<$stringName?>
172159
val $dfRowName<$type1>.city: $stringName? @JvmName("${type1}_city") get() = this["city"] as $stringName?
@@ -178,11 +165,7 @@ class CodeGenerationTests : BaseTest() {
178165
val declaration2 =
179166
"""
180167
@DataSchema
181-
interface $type2 {
182-
val age: Int
183-
val nameAndCity: _DataFrameType1
184-
val weight: Int?
185-
}
168+
interface $type2 { }
186169
187170
val $dfName<$type2>.age: $dataCol<$intName> @JvmName("${type2}_age") get() = this["age"] as $dataCol<$intName>
188171
val $dfRowName<$type2>.age: $intName @JvmName("${type2}_age") get() = this["age"] as $intName

core/generated-sources/src/test/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/ReplCodeGenTests.kt

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,7 @@ class ReplCodeGenTests : BaseTest() {
8181
val expected =
8282
"""
8383
@DataSchema
84-
interface $marker {
85-
val age: Int
86-
val city: String?
87-
val name: String
88-
val weight: Int?
89-
}
84+
interface $marker { }
9085
9186
val $dfName<$marker>.age: $dataCol<$intName> @JvmName("${marker}_age") get() = this["age"] as $dataCol<$intName>
9287
val $dfRowName<$marker>.age: $intName @JvmName("${marker}_age") get() = this["age"] as $intName
@@ -108,9 +103,7 @@ class ReplCodeGenTests : BaseTest() {
108103
val expected3 =
109104
"""
110105
@DataSchema
111-
interface $marker3 : $markerFull {
112-
override val city: String
113-
}
106+
interface $marker3 : $markerFull { }
114107
115108
val $dfName<$marker3>.city: $dataCol<$stringName> @JvmName("${marker3}_city") get() = this["city"] as $dataCol<$stringName>
116109
val $dfRowName<$marker3>.city: $stringName @JvmName("${marker3}_city") get() = this["city"] as $stringName
@@ -127,9 +120,7 @@ class ReplCodeGenTests : BaseTest() {
127120
val expected5 =
128121
"""
129122
@DataSchema
130-
interface $marker5 : $markerFull {
131-
override val weight: Int
132-
}
123+
interface $marker5 : $markerFull { }
133124
134125
val $dfName<$marker5>.weight: $dataCol<$intName> @JvmName("${marker5}_weight") get() = this["weight"] as $dataCol<$intName>
135126
val $dfRowName<$marker5>.weight: $intName @JvmName("${marker5}_weight") get() = this["weight"] as $intName
@@ -172,10 +163,7 @@ class ReplCodeGenTests : BaseTest() {
172163
val expected =
173164
"""
174165
@DataSchema
175-
interface $marker : ${Test2._DataFrameType::class.qualifiedName} {
176-
val city: String?
177-
val weight: Int?
178-
}
166+
interface $marker : ${Test2._DataFrameType::class.qualifiedName} { }
179167
180168
val $dfName<$marker>.city: $dataCol<$stringName?> @JvmName("${marker}_city") get() = this["city"] as $dataCol<$stringName?>
181169
val $dfRowName<$marker>.city: $stringName? @JvmName("${marker}_city") get() = this["city"] as $stringName?

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl/codeGen/ReplCodeGeneratorImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ internal class ReplCodeGeneratorImpl : ReplCodeGenerator {
8282
val result = generator.generate(
8383
schema = schema,
8484
name = name,
85-
fields = true,
85+
fields = false,
8686
extensionProperties = true,
8787
isOpen = isOpen,
8888
visibility = MarkerVisibility.IMPLICIT_PUBLIC,

core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/CodeGenerationTests.kt

Lines changed: 4 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -107,12 +107,7 @@ class CodeGenerationTests : BaseTest() {
107107
val expectedDeclaration =
108108
"""
109109
@DataSchema
110-
interface $typeName {
111-
val age: Int
112-
val city: String?
113-
val name: String
114-
val weight: Int?
115-
}
110+
interface $typeName { }
116111
117112
""".trimIndent() + "\n" + expectedProperties(typeName, typeName)
118113

@@ -138,12 +133,7 @@ class CodeGenerationTests : BaseTest() {
138133
val expectedDeclaration =
139134
"""
140135
@DataSchema
141-
interface $typeName {
142-
val age: Int
143-
val city: String?
144-
val name: String
145-
val weight: Int?
146-
}
136+
interface $typeName { }
147137
148138
""".trimIndent() + "\n" + expectedProperties(typeName, typeName)
149139

@@ -163,10 +153,7 @@ class CodeGenerationTests : BaseTest() {
163153
val declaration1 =
164154
"""
165155
@DataSchema(isOpen = false)
166-
interface $type1 {
167-
val city: String?
168-
val name: String
169-
}
156+
interface $type1 { }
170157
171158
val $dfName<$type1>.city: $dataCol<$stringName?> @JvmName("${type1}_city") get() = this["city"] as $dataCol<$stringName?>
172159
val $dfRowName<$type1>.city: $stringName? @JvmName("${type1}_city") get() = this["city"] as $stringName?
@@ -178,11 +165,7 @@ class CodeGenerationTests : BaseTest() {
178165
val declaration2 =
179166
"""
180167
@DataSchema
181-
interface $type2 {
182-
val age: Int
183-
val nameAndCity: _DataFrameType1
184-
val weight: Int?
185-
}
168+
interface $type2 { }
186169
187170
val $dfName<$type2>.age: $dataCol<$intName> @JvmName("${type2}_age") get() = this["age"] as $dataCol<$intName>
188171
val $dfRowName<$type2>.age: $intName @JvmName("${type2}_age") get() = this["age"] as $intName

core/src/test/kotlin/org/jetbrains/kotlinx/dataframe/codeGen/ReplCodeGenTests.kt

Lines changed: 4 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -81,12 +81,7 @@ class ReplCodeGenTests : BaseTest() {
8181
val expected =
8282
"""
8383
@DataSchema
84-
interface $marker {
85-
val age: Int
86-
val city: String?
87-
val name: String
88-
val weight: Int?
89-
}
84+
interface $marker { }
9085
9186
val $dfName<$marker>.age: $dataCol<$intName> @JvmName("${marker}_age") get() = this["age"] as $dataCol<$intName>
9287
val $dfRowName<$marker>.age: $intName @JvmName("${marker}_age") get() = this["age"] as $intName
@@ -108,9 +103,7 @@ class ReplCodeGenTests : BaseTest() {
108103
val expected3 =
109104
"""
110105
@DataSchema
111-
interface $marker3 : $markerFull {
112-
override val city: String
113-
}
106+
interface $marker3 : $markerFull { }
114107
115108
val $dfName<$marker3>.city: $dataCol<$stringName> @JvmName("${marker3}_city") get() = this["city"] as $dataCol<$stringName>
116109
val $dfRowName<$marker3>.city: $stringName @JvmName("${marker3}_city") get() = this["city"] as $stringName
@@ -127,9 +120,7 @@ class ReplCodeGenTests : BaseTest() {
127120
val expected5 =
128121
"""
129122
@DataSchema
130-
interface $marker5 : $markerFull {
131-
override val weight: Int
132-
}
123+
interface $marker5 : $markerFull { }
133124
134125
val $dfName<$marker5>.weight: $dataCol<$intName> @JvmName("${marker5}_weight") get() = this["weight"] as $dataCol<$intName>
135126
val $dfRowName<$marker5>.weight: $intName @JvmName("${marker5}_weight") get() = this["weight"] as $intName
@@ -172,10 +163,7 @@ class ReplCodeGenTests : BaseTest() {
172163
val expected =
173164
"""
174165
@DataSchema
175-
interface $marker : ${Test2._DataFrameType::class.qualifiedName} {
176-
val city: String?
177-
val weight: Int?
178-
}
166+
interface $marker : ${Test2._DataFrameType::class.qualifiedName} { }
179167
180168
val $dfName<$marker>.city: $dataCol<$stringName?> @JvmName("${marker}_city") get() = this["city"] as $dataCol<$stringName?>
181169
val $dfRowName<$marker>.city: $stringName? @JvmName("${marker}_city") get() = this["city"] as $stringName?

0 commit comments

Comments
 (0)