Add warnings at declaration and call sites of operator 'mod'
This commit is contained in:
+5
-5
@@ -1,12 +1,12 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class OldAndNew {
|
||||
operator fun modAssign(x: Int) {}
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun modAssign(x: Int) {}
|
||||
operator fun remAssign(x: Int) {}
|
||||
}
|
||||
|
||||
class OnlyOld {
|
||||
operator fun modAssign(x: Int) {}
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun modAssign(x: Int) {}
|
||||
}
|
||||
|
||||
class OnlyNew {
|
||||
@@ -15,11 +15,11 @@ class OnlyNew {
|
||||
|
||||
class Sample
|
||||
|
||||
operator fun Sample.modAssign(x: Int) {}
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun Sample.modAssign(x: Int) {}
|
||||
operator fun Sample.remAssign(x: Int) {}
|
||||
|
||||
class ModAndRemAssign {
|
||||
operator fun mod(x: Int): ModAndRemAssign = ModAndRemAssign()
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun mod(x: Int): ModAndRemAssign = ModAndRemAssign()
|
||||
operator fun remAssign(x: Int) {}
|
||||
}
|
||||
|
||||
@@ -28,7 +28,7 @@ fun test() {
|
||||
oldAndNew %= 1
|
||||
|
||||
val onlyOld = OnlyOld()
|
||||
onlyOld %= 1
|
||||
onlyOld <!DEPRECATED_BINARY_MOD_AS_REM!>%=<!> 1
|
||||
|
||||
val onlyNew = OnlyNew()
|
||||
onlyNew %= 1
|
||||
|
||||
@@ -1,12 +1,12 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class OldAndNew {
|
||||
operator fun mod(x: Int) {}
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun mod(x: Int) {}
|
||||
operator fun rem(x: Int) {}
|
||||
}
|
||||
|
||||
class OnlyOld {
|
||||
operator fun mod(x: Int) {}
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun mod(x: Int) {}
|
||||
}
|
||||
|
||||
class OnlyNew {
|
||||
@@ -15,17 +15,17 @@ class OnlyNew {
|
||||
|
||||
class Sample
|
||||
|
||||
operator fun Sample.mod(x: Int) {}
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun Sample.mod(x: Int) {}
|
||||
operator fun Sample.rem(x: Int) {}
|
||||
|
||||
class IntAndUnit {
|
||||
operator fun mod(x: Int): Int = 0
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun mod(x: Int): Int = 0
|
||||
operator fun rem(x: Int) {}
|
||||
}
|
||||
|
||||
fun test() {
|
||||
OldAndNew() % 1
|
||||
OnlyOld() % 1
|
||||
OnlyOld() <!DEPRECATED_BINARY_MOD_AS_REM!>%<!> 1
|
||||
OnlyNew() % 1
|
||||
Sample() % 1
|
||||
|
||||
|
||||
@@ -0,0 +1,37 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
object ModAndRem {
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun mod(x: Int) {}
|
||||
operator fun rem(x: Int) {}
|
||||
}
|
||||
|
||||
object OldMod {
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun mod(x: Int) {}
|
||||
}
|
||||
|
||||
object ModAndRemExtension
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun ModAndRemExtension.mod(x: Int) {}
|
||||
operator fun ModAndRemExtension.rem(x: Int) {}
|
||||
|
||||
object ModExtension
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun ModExtension.mod(x: Int) {}
|
||||
|
||||
object ModMemberAndRemExtension {
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun mod(x: Int) {}
|
||||
}
|
||||
|
||||
operator fun ModMemberAndRemExtension.rem(x: Int) {}
|
||||
|
||||
fun foo() {
|
||||
ModAndRem % 1
|
||||
OldMod <!DEPRECATED_BINARY_MOD_AS_REM!>%<!> 1
|
||||
|
||||
ModAndRemExtension % 1
|
||||
|
||||
ModExtension <!DEPRECATED_BINARY_MOD_AS_REM!>%<!> 1
|
||||
|
||||
ModMemberAndRemExtension % 1
|
||||
|
||||
OldMod.mod(1)
|
||||
ModExtension.mod(1)
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
package
|
||||
|
||||
public fun foo(): kotlin.Unit
|
||||
public operator fun ModAndRemExtension.mod(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public operator fun ModExtension.mod(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public operator fun ModAndRemExtension.rem(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public operator fun ModMemberAndRemExtension.rem(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
|
||||
public object ModAndRem {
|
||||
private constructor ModAndRem()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun mod(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public final operator fun rem(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object ModAndRemExtension {
|
||||
private constructor ModAndRemExtension()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object ModExtension {
|
||||
private constructor ModExtension()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object ModMemberAndRemExtension {
|
||||
private constructor ModMemberAndRemExtension()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun mod(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object OldMod {
|
||||
private constructor OldMod()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun mod(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
// !LANGUAGE: -OperatorRem
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
object ModAndRem {
|
||||
operator fun mod(x: Int) {}
|
||||
<!UNSUPPORTED_FEATURE!>operator<!> fun rem(x: Int) {}
|
||||
}
|
||||
|
||||
object OldMod {
|
||||
operator fun mod(x: Int) {}
|
||||
}
|
||||
|
||||
object ModAndRemExtension
|
||||
operator fun ModAndRemExtension.mod(x: Int) {}
|
||||
<!UNSUPPORTED_FEATURE!>operator<!> fun ModAndRemExtension.rem(x: Int) {}
|
||||
|
||||
object ModExtension
|
||||
operator fun ModExtension.mod(x: Int) {}
|
||||
|
||||
object ModMemberAndRemExtension {
|
||||
operator fun mod(x: Int) {}
|
||||
}
|
||||
|
||||
<!UNSUPPORTED_FEATURE!>operator<!> fun ModMemberAndRemExtension.rem(x: Int) {}
|
||||
|
||||
fun foo() {
|
||||
ModAndRem % 1
|
||||
OldMod % 1
|
||||
|
||||
ModAndRemExtension % 1
|
||||
|
||||
ModExtension % 1
|
||||
|
||||
ModMemberAndRemExtension % 1
|
||||
|
||||
OldMod.mod(1)
|
||||
ModExtension.mod(1)
|
||||
}
|
||||
Vendored
+46
@@ -0,0 +1,46 @@
|
||||
package
|
||||
|
||||
public fun foo(): kotlin.Unit
|
||||
public operator fun ModAndRemExtension.mod(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public operator fun ModExtension.mod(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public operator fun ModAndRemExtension.rem(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public operator fun ModMemberAndRemExtension.rem(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
|
||||
public object ModAndRem {
|
||||
private constructor ModAndRem()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun mod(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public final operator fun rem(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object ModAndRemExtension {
|
||||
private constructor ModAndRemExtension()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object ModExtension {
|
||||
private constructor ModExtension()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object ModMemberAndRemExtension {
|
||||
private constructor ModMemberAndRemExtension()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun mod(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
public object OldMod {
|
||||
private constructor OldMod()
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun mod(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
+1
-1
@@ -2,7 +2,7 @@
|
||||
|
||||
class Foo {
|
||||
}
|
||||
operator fun Foo.mod(x: Int): Foo = Foo()
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun Foo.mod(x: Int): Foo = Foo()
|
||||
operator fun Foo.rem(x: Int): Int = 0
|
||||
|
||||
fun foo() {
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class Foo {
|
||||
operator fun mod(x: Int): Foo = Foo()
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun mod(x: Int): Foo = Foo()
|
||||
operator fun rem(x: Int): Int = 0
|
||||
}
|
||||
|
||||
|
||||
+1
-1
@@ -1,7 +1,7 @@
|
||||
// !DIAGNOSTICS: -UNUSED_PARAMETER
|
||||
|
||||
class Foo {
|
||||
operator fun mod(x: Int): Foo = Foo()
|
||||
<!DEPRECATED_BINARY_MOD!>operator<!> fun mod(x: Int): Foo = Foo()
|
||||
}
|
||||
|
||||
operator fun Foo.rem(x: Int): Int = 0
|
||||
|
||||
+2
-2
@@ -3,7 +3,7 @@ class A {
|
||||
operator fun minusAssign(<!UNUSED_PARAMETER!>x<!>: Int) {}
|
||||
operator fun timesAssign(<!UNUSED_PARAMETER!>x<!>: Int) {}
|
||||
operator fun divAssign(<!UNUSED_PARAMETER!>x<!>: Int) {}
|
||||
operator fun modAssign(<!UNUSED_PARAMETER!>x<!>: Int) {}
|
||||
operator fun remAssign(<!UNUSED_PARAMETER!>x<!>: Int) {}
|
||||
}
|
||||
|
||||
fun testVal() {
|
||||
@@ -28,7 +28,7 @@ class B {
|
||||
operator fun minus(<!UNUSED_PARAMETER!>x<!>: Int): B = B()
|
||||
operator fun times(<!UNUSED_PARAMETER!>x<!>: Int): B = B()
|
||||
operator fun div(<!UNUSED_PARAMETER!>x<!>: Int): B = B()
|
||||
operator fun mod(<!UNUSED_PARAMETER!>x<!>: Int): B = B()
|
||||
operator fun rem(<!UNUSED_PARAMETER!>x<!>: Int): B = B()
|
||||
}
|
||||
|
||||
fun testWrong() {
|
||||
|
||||
+2
-2
@@ -10,8 +10,8 @@ public final class A {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun minusAssign(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public final operator fun modAssign(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public final operator fun plusAssign(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public final operator fun remAssign(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public final operator fun timesAssign(/*0*/ x: kotlin.Int): kotlin.Unit
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
@@ -22,8 +22,8 @@ public final class B {
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun minus(/*0*/ x: kotlin.Int): B
|
||||
public final operator fun mod(/*0*/ x: kotlin.Int): B
|
||||
public final operator fun plus(/*0*/ x: kotlin.Int): B
|
||||
public final operator fun rem(/*0*/ x: kotlin.Int): B
|
||||
public final operator fun times(/*0*/ x: kotlin.Int): B
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
|
||||
@@ -4,7 +4,7 @@ package kt629
|
||||
|
||||
class A() {
|
||||
var p = "yeah"
|
||||
operator fun mod(<!UNUSED_PARAMETER!>other<!> : A) : A {
|
||||
operator fun rem(<!UNUSED_PARAMETER!>other<!> : A) : A {
|
||||
return A();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -9,7 +9,7 @@ package kt629 {
|
||||
public final var p: kotlin.String
|
||||
public open override /*1*/ /*fake_override*/ fun equals(/*0*/ other: kotlin.Any?): kotlin.Boolean
|
||||
public open override /*1*/ /*fake_override*/ fun hashCode(): kotlin.Int
|
||||
public final operator fun mod(/*0*/ other: kt629.A): kt629.A
|
||||
public final operator fun rem(/*0*/ other: kt629.A): kt629.A
|
||||
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user