Show warning for mod from built-ins since API=1.1

This commit is contained in:
Mikhail Zarechenskiy
2017-03-14 14:09:28 +03:00
parent e4188f889e
commit 1a4b9cb228
6 changed files with 151 additions and 24 deletions
@@ -0,0 +1,46 @@
// !API_VERSION: 1.0
// !DIAGNOSTICS: -UNUSED_PARAMETER, -UNUSED_VARIABLE, -EXTENSION_SHADOWED_BY_MEMBER
class Foo {
operator fun rem(x: Int): Foo = Foo()
}
class Bar {
operator fun remAssign(x: Int) {}
}
class Baz {
companion object {
operator fun rem(x: Int) {}
operator fun Int.rem(x: Int) {}
}
}
operator fun Baz.rem(x: Int) {}
fun local() {
operator fun Int.rem(x: Int) {}
operator fun String.remAssign(x: Int) {}
}
class WithMod {
<!DEPRECATED_BINARY_MOD!>operator<!> fun mod(other: WithMod) = this
fun test() {
val a = this <!DEPRECATED_BINARY_MOD_AS_REM!>%<!> this
var b = this.mod(this)
b <!DEPRECATED_BINARY_MOD_AS_REM!>%=<!> this
}
}
fun noOverflow() {
(-1).mod(5)
}
fun builtIns(b: Byte, s: Short) {
var a = 1 % 2
a %= 3
1.mod(2)
b % s
1.0 % 2.0
}
@@ -0,0 +1,47 @@
package
public fun builtIns(/*0*/ b: kotlin.Byte, /*1*/ s: kotlin.Short): kotlin.Unit
public fun local(): kotlin.Unit
public fun noOverflow(): kotlin.Unit
public operator fun Baz.rem(/*0*/ x: kotlin.Int): kotlin.Unit
public final class Bar {
public constructor Bar()
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 remAssign(/*0*/ x: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class Baz {
public constructor Baz()
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 companion object Companion {
private constructor Companion()
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 rem(/*0*/ x: kotlin.Int): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
public final operator fun kotlin.Int.rem(/*0*/ x: kotlin.Int): kotlin.Unit
}
}
public final class Foo {
public constructor Foo()
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 rem(/*0*/ x: kotlin.Int): Foo
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}
public final class WithMod {
public constructor WithMod()
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: WithMod): WithMod
public final fun test(): kotlin.Unit
public open override /*1*/ /*fake_override*/ fun toString(): kotlin.String
}