Skip to content

Commit 5632878

Browse files
committed
colGroup except can no longer be infix to reduce confusion about scope.
1 parent 2a215af commit 5632878

File tree

3 files changed

+75
-88
lines changed

3 files changed

+75
-88
lines changed

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/api/allExcept.kt

Lines changed: 43 additions & 41 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,10 @@ import org.jetbrains.kotlinx.dataframe.impl.columns.changePath
2323
import org.jetbrains.kotlinx.dataframe.impl.columns.createColumnSet
2424
import org.jetbrains.kotlinx.dataframe.impl.columns.transformSingle
2525
import org.jetbrains.kotlinx.dataframe.util.ALL_COLS_EXCEPT
26-
import org.jetbrains.kotlinx.dataframe.util.ALL_COLS_REPLACE
27-
import org.jetbrains.kotlinx.dataframe.util.ALL_COLS_REPLACE_VARARG
26+
import org.jetbrains.kotlinx.dataframe.util.ALL_COLS_EXCEPT_REPLACE
27+
import org.jetbrains.kotlinx.dataframe.util.ALL_COLS_EXCEPT_REPLACE_VARARG
28+
import org.jetbrains.kotlinx.dataframe.util.EXCEPT_REPLACE
29+
import org.jetbrains.kotlinx.dataframe.util.EXCEPT_REPLACE_VARARG
2830
import kotlin.reflect.KProperty
2931

3032
// region ColumnsSelectionDsl
@@ -473,15 +475,15 @@ public interface AllExceptColumnsSelectionDsl {
473475

474476
@Deprecated(
475477
message = ALL_COLS_EXCEPT,
476-
replaceWith = ReplaceWith(ALL_COLS_REPLACE),
478+
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE),
477479
level = DeprecationLevel.ERROR,
478480
) // present solely to redirect users to the right function
479481
public fun SingleColumn<DataRow<*>>.allColsExcept(other: ColumnsResolver<*>): ColumnSet<*> =
480482
allColsExcept { other }
481483

482484
@Deprecated(
483485
message = ALL_COLS_EXCEPT,
484-
replaceWith = ReplaceWith(ALL_COLS_REPLACE_VARARG),
486+
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE_VARARG),
485487
level = DeprecationLevel.ERROR,
486488
) // present solely to redirect users to the right function
487489
public fun SingleColumn<DataRow<*>>.allColsExcept(vararg others: ColumnsResolver<*>): ColumnSet<*> =
@@ -535,20 +537,20 @@ public interface AllExceptColumnsSelectionDsl {
535537
/**
536538
* @include [ExperimentalExceptDocs]
537539
*/
538-
public infix fun <C> SingleColumn<DataRow<C>>.except(selector: ColumnsSelector<C, *>): SingleColumn<DataRow<C>> =
540+
public fun <C> SingleColumn<DataRow<C>>.except(selector: ColumnsSelector<C, *>): SingleColumn<DataRow<C>> =
539541
exceptInternal(selector.toColumns())
540542

541543
@Deprecated(
542544
message = ALL_COLS_EXCEPT,
543-
replaceWith = ReplaceWith("except { other }"),
545+
replaceWith = ReplaceWith(EXCEPT_REPLACE),
544546
level = DeprecationLevel.ERROR,
545547
) // present solely to redirect users to the right function
546-
public infix fun <C> SingleColumn<DataRow<C>>.except(other: ColumnsResolver<*>): SingleColumn<DataRow<C>> =
548+
public fun <C> SingleColumn<DataRow<C>>.except(other: ColumnsResolver<*>): SingleColumn<DataRow<C>> =
547549
except { other }
548550

549551
@Deprecated(
550552
message = ALL_COLS_EXCEPT,
551-
replaceWith = ReplaceWith("except { others.toColumnSet() }"),
553+
replaceWith = ReplaceWith(EXCEPT_REPLACE_VARARG),
552554
level = DeprecationLevel.ERROR,
553555
) // present solely to redirect users to the right function
554556
public fun <C> SingleColumn<DataRow<C>>.except(vararg others: ColumnsResolver<*>): SingleColumn<DataRow<C>> =
@@ -557,7 +559,7 @@ public interface AllExceptColumnsSelectionDsl {
557559
/**
558560
* @include [ExperimentalExceptDocs]
559561
*/
560-
public infix fun <C> SingleColumn<DataRow<C>>.except(other: String): SingleColumn<DataRow<C>> =
562+
public fun <C> SingleColumn<DataRow<C>>.except(other: String): SingleColumn<DataRow<C>> =
561563
exceptInternal(column<Any?>(other))
562564

563565
/**
@@ -570,7 +572,7 @@ public interface AllExceptColumnsSelectionDsl {
570572
* @include [ExperimentalExceptDocs]
571573
*/
572574
@AccessApiOverload
573-
public infix fun <C> SingleColumn<DataRow<C>>.except(other: KProperty<C>): SingleColumn<DataRow<C>> =
575+
public fun <C> SingleColumn<DataRow<C>>.except(other: KProperty<C>): SingleColumn<DataRow<C>> =
574576
exceptInternal(column(other))
575577

576578
/**
@@ -583,7 +585,7 @@ public interface AllExceptColumnsSelectionDsl {
583585
/**
584586
* @include [ExperimentalExceptDocs]
585587
*/
586-
public infix fun <C> SingleColumn<DataRow<C>>.except(other: ColumnPath): SingleColumn<DataRow<C>> =
588+
public fun <C> SingleColumn<DataRow<C>>.except(other: ColumnPath): SingleColumn<DataRow<C>> =
587589
exceptInternal(column<Any?>(other))
588590

589591
/**
@@ -595,20 +597,20 @@ public interface AllExceptColumnsSelectionDsl {
595597
/**
596598
* @include [ExperimentalExceptDocs]
597599
*/
598-
public infix fun String.except(selector: ColumnsSelector<*, *>): SingleColumn<DataRow<*>> =
600+
public fun String.except(selector: ColumnsSelector<*, *>): SingleColumn<DataRow<*>> =
599601
columnGroup(this).except(selector)
600602

601603
@Deprecated(
602604
message = ALL_COLS_EXCEPT,
603-
replaceWith = ReplaceWith("except { other }"),
605+
replaceWith = ReplaceWith(EXCEPT_REPLACE),
604606
level = DeprecationLevel.ERROR,
605607
) // present solely to redirect users to the right function
606-
public infix fun String.except(other: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
608+
public fun String.except(other: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
607609
except { other }
608610

609611
@Deprecated(
610612
message = ALL_COLS_EXCEPT,
611-
replaceWith = ReplaceWith("except { others.toColumnSet() }"),
613+
replaceWith = ReplaceWith(EXCEPT_REPLACE_VARARG),
612614
level = DeprecationLevel.ERROR,
613615
) // present solely to redirect users to the right function
614616
public fun String.except(vararg others: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
@@ -617,7 +619,7 @@ public interface AllExceptColumnsSelectionDsl {
617619
/**
618620
* @include [ExperimentalExceptDocs]
619621
*/
620-
public infix fun String.except(other: String): SingleColumn<DataRow<*>> =
622+
public fun String.except(other: String): SingleColumn<DataRow<*>> =
621623
columnGroup(this).exceptInternal(column<Any?>(other))
622624

623625
/**
@@ -630,7 +632,7 @@ public interface AllExceptColumnsSelectionDsl {
630632
* @include [ExperimentalExceptDocs]
631633
*/
632634
@AccessApiOverload
633-
public infix fun String.except(other: KProperty<*>): SingleColumn<DataRow<*>> =
635+
public fun String.except(other: KProperty<*>): SingleColumn<DataRow<*>> =
634636
columnGroup(this).exceptInternal(column(other))
635637

636638
/**
@@ -643,7 +645,7 @@ public interface AllExceptColumnsSelectionDsl {
643645
/**
644646
* @include [ExperimentalExceptDocs]
645647
*/
646-
public infix fun String.except(other: ColumnPath): SingleColumn<DataRow<*>> =
648+
public fun String.except(other: ColumnPath): SingleColumn<DataRow<*>> =
647649
columnGroup(this).exceptInternal(column<Any?>(other))
648650

649651
/**
@@ -656,21 +658,21 @@ public interface AllExceptColumnsSelectionDsl {
656658
* @include [ExperimentalExceptDocs]
657659
*/
658660
@AccessApiOverload
659-
public infix fun <C> KProperty<C>.except(selector: ColumnsSelector<C, *>): SingleColumn<DataRow<C>> =
661+
public fun <C> KProperty<C>.except(selector: ColumnsSelector<C, *>): SingleColumn<DataRow<C>> =
660662
columnGroup(this).exceptInternal(selector.toColumns())
661663

662664
@Deprecated(
663665
message = ALL_COLS_EXCEPT,
664-
replaceWith = ReplaceWith("except { other }"),
666+
replaceWith = ReplaceWith(EXCEPT_REPLACE),
665667
level = DeprecationLevel.ERROR,
666668
) // present solely to redirect users to the right function
667669
@AccessApiOverload
668-
public infix fun KProperty<*>.except(other: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
670+
public fun KProperty<*>.except(other: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
669671
except { other }
670672

671673
@Deprecated(
672674
message = ALL_COLS_EXCEPT,
673-
replaceWith = ReplaceWith("except { others.toColumnSet() }"),
675+
replaceWith = ReplaceWith(EXCEPT_REPLACE_VARARG),
674676
level = DeprecationLevel.ERROR,
675677
) // present solely to redirect users to the right function
676678
@AccessApiOverload
@@ -681,7 +683,7 @@ public interface AllExceptColumnsSelectionDsl {
681683
* @include [ExperimentalExceptDocs]
682684
*/
683685
@AccessApiOverload
684-
public infix fun <C> KProperty<C>.except(other: String): SingleColumn<DataRow<C>> =
686+
public fun <C> KProperty<C>.except(other: String): SingleColumn<DataRow<C>> =
685687
columnGroup(this).exceptInternal(column<Any?>(other))
686688

687689
/**
@@ -697,7 +699,7 @@ public interface AllExceptColumnsSelectionDsl {
697699
@Suppress("INAPPLICABLE_JVM_NAME")
698700
@JvmName("KPropertyDataRowExceptNew")
699701
@AccessApiOverload
700-
public infix fun <C> KProperty<DataRow<C>>.except(other: String): SingleColumn<DataRow<C>> =
702+
public fun <C> KProperty<DataRow<C>>.except(other: String): SingleColumn<DataRow<C>> =
701703
columnGroup(this).exceptInternal(column<Any?>(other))
702704

703705
/**
@@ -713,7 +715,7 @@ public interface AllExceptColumnsSelectionDsl {
713715
* @include [ExperimentalExceptDocs]
714716
*/
715717
@AccessApiOverload
716-
public infix fun <C> KProperty<C>.except(other: KProperty<*>): SingleColumn<DataRow<C>> =
718+
public fun <C> KProperty<C>.except(other: KProperty<*>): SingleColumn<DataRow<C>> =
717719
columnGroup(this).exceptInternal(column(other))
718720

719721
/**
@@ -729,7 +731,7 @@ public interface AllExceptColumnsSelectionDsl {
729731
@Suppress("INAPPLICABLE_JVM_NAME")
730732
@JvmName("KPropertyDataRowExceptNew")
731733
@AccessApiOverload
732-
public infix fun <C> KProperty<DataRow<C>>.except(other: KProperty<*>): SingleColumn<DataRow<C>> =
734+
public fun <C> KProperty<DataRow<C>>.except(other: KProperty<*>): SingleColumn<DataRow<C>> =
733735
columnGroup(this).exceptInternal(column(other))
734736

735737
/**
@@ -745,7 +747,7 @@ public interface AllExceptColumnsSelectionDsl {
745747
* @include [ExperimentalExceptDocs]
746748
*/
747749
@AccessApiOverload
748-
public infix fun <C> KProperty<C>.except(other: ColumnPath): SingleColumn<DataRow<C>> =
750+
public fun <C> KProperty<C>.except(other: ColumnPath): SingleColumn<DataRow<C>> =
749751
columnGroup(this).exceptInternal(column<Any?>(other))
750752

751753
/**
@@ -761,7 +763,7 @@ public interface AllExceptColumnsSelectionDsl {
761763
@Suppress("INAPPLICABLE_JVM_NAME")
762764
@JvmName("KPropertyDataRowExceptNew")
763765
@AccessApiOverload
764-
public infix fun <C> KProperty<DataRow<C>>.except(other: ColumnPath): SingleColumn<DataRow<C>> =
766+
public fun <C> KProperty<DataRow<C>>.except(other: ColumnPath): SingleColumn<DataRow<C>> =
765767
columnGroup(this).exceptInternal(column<Any?>(other))
766768

767769
/**
@@ -776,20 +778,20 @@ public interface AllExceptColumnsSelectionDsl {
776778
/**
777779
* @include [ExperimentalExceptDocs]
778780
*/
779-
public infix fun ColumnPath.except(selector: ColumnsSelector<*, *>): SingleColumn<DataRow<*>> =
781+
public fun ColumnPath.except(selector: ColumnsSelector<*, *>): SingleColumn<DataRow<*>> =
780782
columnGroup(this).exceptInternal(selector.toColumns<Any?, Any?>())
781783

782784
@Deprecated(
783785
message = ALL_COLS_EXCEPT,
784-
replaceWith = ReplaceWith("except { other }"),
786+
replaceWith = ReplaceWith(EXCEPT_REPLACE),
785787
level = DeprecationLevel.ERROR,
786788
) // present solely to redirect users to the right function
787-
public infix fun ColumnPath.except(other: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
789+
public fun ColumnPath.except(other: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
788790
except { other }
789791

790792
@Deprecated(
791793
message = ALL_COLS_EXCEPT,
792-
replaceWith = ReplaceWith("except { others.toColumnSet() }"),
794+
replaceWith = ReplaceWith(EXCEPT_REPLACE_VARARG),
793795
level = DeprecationLevel.ERROR,
794796
) // present solely to redirect users to the right function
795797
public fun ColumnPath.except(vararg others: ColumnsResolver<*>): SingleColumn<DataRow<*>> =
@@ -798,7 +800,7 @@ public interface AllExceptColumnsSelectionDsl {
798800
/**
799801
* @include [ExperimentalExceptDocs]
800802
*/
801-
public infix fun ColumnPath.except(other: String): SingleColumn<DataRow<*>> =
803+
public fun ColumnPath.except(other: String): SingleColumn<DataRow<*>> =
802804
columnGroup(this).exceptInternal(column<Any?>(other))
803805

804806
/**
@@ -811,7 +813,7 @@ public interface AllExceptColumnsSelectionDsl {
811813
* @include [ExperimentalExceptDocs]
812814
*/
813815
@AccessApiOverload
814-
public infix fun ColumnPath.except(other: KProperty<*>): SingleColumn<DataRow<*>> =
816+
public fun ColumnPath.except(other: KProperty<*>): SingleColumn<DataRow<*>> =
815817
columnGroup(this).exceptInternal(column(other))
816818

817819
@AccessApiOverload
@@ -821,7 +823,7 @@ public interface AllExceptColumnsSelectionDsl {
821823
/**
822824
* @include [ExperimentalExceptDocs]
823825
*/
824-
public infix fun ColumnPath.except(other: ColumnPath): SingleColumn<DataRow<*>> =
826+
public fun ColumnPath.except(other: ColumnPath): SingleColumn<DataRow<*>> =
825827
columnGroup(this).exceptInternal(column<Any?>(other))
826828

827829
/**
@@ -845,15 +847,15 @@ public interface AllExceptColumnsSelectionDsl {
845847

846848
@Deprecated(
847849
message = ALL_COLS_EXCEPT,
848-
replaceWith = ReplaceWith(ALL_COLS_REPLACE),
850+
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE),
849851
level = DeprecationLevel.ERROR,
850852
) // present solely to redirect users to the right function
851853
public fun String.allColsExcept(other: ColumnsResolver<*>): ColumnSet<*> =
852854
allColsExcept { other }
853855

854856
@Deprecated(
855857
message = ALL_COLS_EXCEPT,
856-
replaceWith = ReplaceWith(ALL_COLS_REPLACE_VARARG),
858+
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE_VARARG),
857859
level = DeprecationLevel.ERROR,
858860
) // present solely to redirect users to the right function
859861
public fun String.allColsExcept(vararg others: ColumnsResolver<*>): ColumnSet<*> =
@@ -899,7 +901,7 @@ public interface AllExceptColumnsSelectionDsl {
899901

900902
@Deprecated(
901903
message = ALL_COLS_EXCEPT,
902-
replaceWith = ReplaceWith(ALL_COLS_REPLACE),
904+
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE),
903905
level = DeprecationLevel.ERROR,
904906
) // present solely to redirect users to the right function
905907
@AccessApiOverload
@@ -908,7 +910,7 @@ public interface AllExceptColumnsSelectionDsl {
908910

909911
@Deprecated(
910912
message = ALL_COLS_EXCEPT,
911-
replaceWith = ReplaceWith(ALL_COLS_REPLACE_VARARG),
913+
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE_VARARG),
912914
level = DeprecationLevel.ERROR,
913915
) // present solely to redirect users to the right function
914916
@AccessApiOverload
@@ -956,15 +958,15 @@ public interface AllExceptColumnsSelectionDsl {
956958

957959
@Deprecated(
958960
message = ALL_COLS_EXCEPT,
959-
replaceWith = ReplaceWith(ALL_COLS_REPLACE),
961+
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE),
960962
level = DeprecationLevel.ERROR,
961963
) // present solely to redirect users to the right function
962964
public fun ColumnPath.allColsExcept(other: ColumnsResolver<*>): ColumnSet<*> =
963965
allColsExcept { other }
964966

965967
@Deprecated(
966968
message = ALL_COLS_EXCEPT,
967-
replaceWith = ReplaceWith(ALL_COLS_REPLACE_VARARG),
969+
replaceWith = ReplaceWith(ALL_COLS_EXCEPT_REPLACE_VARARG),
968970
level = DeprecationLevel.ERROR,
969971
) // present solely to redirect users to the right function
970972
public fun ColumnPath.allColsExcept(vararg others: ColumnsResolver<*>): ColumnSet<*> =

core/src/main/kotlin/org/jetbrains/kotlinx/dataframe/util/deprecationMessages.kt

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,8 @@ internal const val COL_REPLACE = "col"
7676

7777
internal const val ALL_COLS_EXCEPT =
7878
"This overload is blocked to prevent issues with column accessors. Use the `{}` overload instead."
79-
internal const val ALL_COLS_REPLACE = "allColsExcept { other }"
80-
internal const val ALL_COLS_REPLACE_VARARG = "allColsExcept { others.toColumnSet() }"
81-
79+
internal const val ALL_COLS_EXCEPT_REPLACE = "this.allColsExcept { other }"
80+
internal const val ALL_COLS_EXCEPT_REPLACE_VARARG = "this.allColsExcept { others.toColumnSet() }"
81+
internal const val EXCEPT_REPLACE = "this.except { other }"
82+
internal const val EXCEPT_REPLACE_VARARG = "this.except { others.toColumnSet() }"
8283
// endregion

0 commit comments

Comments
 (0)