File tree Expand file tree Collapse file tree 1 file changed +7
-3
lines changed
core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/impl Expand file tree Collapse file tree 1 file changed +7
-3
lines changed Original file line number Diff line number Diff line change @@ -121,7 +121,7 @@ internal fun <T> Iterable<T>.anyNull(): Boolean = any { it == null }
121
121
internal fun emptyPath (): ColumnPath = ColumnPath (emptyList())
122
122
123
123
@PublishedApi
124
- internal fun <T : Number > KClass<T>.zero (): T =
124
+ internal fun <T : Number > KClass<T>.zeroOrNull (): T ? =
125
125
when (this ) {
126
126
Int ::class -> 0 as T
127
127
Byte ::class -> 0 .toByte() as T
@@ -131,10 +131,14 @@ internal fun <T : Number> KClass<T>.zero(): T =
131
131
Float ::class -> 0 .toFloat() as T
132
132
BigDecimal ::class -> BigDecimal .ZERO as T
133
133
BigInteger ::class -> BigInteger .ZERO as T
134
- Number ::class -> 0 as T
135
- else -> TODO ()
134
+ Number ::class -> 0 as ? T
135
+ else -> null
136
136
}
137
137
138
+ @PublishedApi
139
+ internal fun <T : Number > KClass<T>.zero (): T =
140
+ zeroOrNull() ? : throw NotImplementedError (" Zero value for $this is not supported" )
141
+
138
142
internal fun <T > catchSilent (body : () -> T ): T ? =
139
143
try {
140
144
body()
You can’t perform that action at this time.
0 commit comments