FIR checker: report violations related to API mode

This commit is contained in:
Tianyu Geng
2021-10-12 02:01:45 +03:00
committed by Mikhail Glukhikh
parent 52b247937e
commit c262f17d75
30 changed files with 298 additions and 222 deletions
@@ -1,47 +0,0 @@
// SKIP_TXT
annotation class A
@Target(
AnnotationTarget.CLASS,
AnnotationTarget.PROPERTY,
AnnotationTarget.CONSTRUCTOR,
AnnotationTarget.FUNCTION
)
public annotation class B
annotation class C(val a: String)
/**
* Foo1 KDoc
*/
@B
class Foo1() {}
public class Foo2() {
/**
* KDoc for methodWithAnnotations
*/
@B
fun methodWithAnnotations() {}
/**
* Property KDoc
*/
@B
var simple: Int = 10
}
public open class ClassWithOpen {
/**
* constructor KDoc
*/
@B
constructor() {}
/**
* KDoc for openAnnotatedMethod
*/
@B
open fun openAnnotatedMethod() {}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_TXT
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>annotation class A<!>
@@ -1,47 +0,0 @@
// SKIP_TXT
/**
* KDoc for Foo1
*/
class Foo1() {}
public class Foo2() {
/**
* KDoc for method
*/
fun method() {}
/**
* KDoc for method2
*/
public fun method2() {}
private fun method3() {}
fun implicit() = 10
public fun implicit2() = 10
public fun implicit3(): Int = 10
}
public open class ClassWithOpen() {
/**
* KDoc for method
*/
fun method() {}
/**
* KDoc for openMethod
*/
open fun openMethod() {}
}
public data class FooData(val i: Int, val s: String)
data class FooData2(val i: Int, val s: String)
public class WithNested {
class Nested {}
inner class Inner {}
}
enum class Foo { A, B }
public enum class Bar { A, B }
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_TXT
/**
@@ -44,4 +45,4 @@ public class WithNested {
}
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>enum class Foo<!> { A, B }
public enum class Bar { A, B }
public enum class Bar { A, B }
@@ -1,20 +0,0 @@
// SKIP_TXT
public class Bar {
companion object {}
}
public class Bar2 {
companion object MyCompanion {}
}
public class Bar3 {
/**
* Nested object KDoc
*/
object NestedObject {}
}
data class FooData2(val i: Int, val s: String) {
object NestedObject {}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_TXT
public class Bar {
@@ -1,17 +0,0 @@
// SKIP_TXT
public class Foo1 () {}
public class Foo2 constructor() {}
public class Foo3 public constructor() {}
public class Foo4 private constructor() {}
public class Foo5 {
/**
* constructor KDoc
*/
constructor() {}
}
public class Foo6 {
public constructor() {}
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_TXT
public class Foo1 () {}
@@ -1,8 +0,0 @@
// !DIAGNOSTICS: -EXPERIMENTAL_FEATURE_WARNING
// !LANGUAGE: -JvmInlineValueClasses
// SKIP_TXT
inline class Value1(val inner: Int)
public inline class Value2(val inner: Int)
inline class Value3(public val inner: Int)
public inline class Value4(public val inner: Int)
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// !DIAGNOSTICS: -EXPERIMENTAL_FEATURE_WARNING
// !LANGUAGE: -JvmInlineValueClasses
// SKIP_TXT
@@ -5,4 +6,4 @@
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>inline class Value1<!>(<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>val inner<!>: Int)
public inline class Value2(<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>val inner<!>: Int)
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>inline class Value3<!>(public val inner: Int)
public inline class Value4(public val inner: Int)
public inline class Value4(public val inner: Int)
@@ -1,35 +0,0 @@
// SKIP_TXT
interface I1 {
fun i()
}
public interface I2 {
fun i()
}
public interface I3 {
public fun i()
public val v: Int
}
public interface I4 {
public fun i(): Int
public val v: Int
}
public class Impl: I3 {
override fun i() {}
override val v: Int
get() = 10
}
public class Impl2: I4 {
override fun i() = 10
override val v = 10
}
private class PrivateImpl: I4 {
override fun i() = 10
override val v = 10
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_TXT
<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>interface I1<!> {
@@ -1,23 +0,0 @@
// SKIP_TXT
public class Foo(val bar: Int, private var bar2: String, internal var bar3: Long, public var bar4: Int) {
/**
* Property KDoc
*/
var simple: Int = 10
public var simple2: Int = 10
val withGetter: Int
get() = 10
public val withGetter2: Int
get() = 10
var getterAndSetter: Int = 10
get() = field
set(v) { field = v }
public var getterAndSetter2: Int = 10
get() = field
set(v) { field = v }
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_TXT
public class Foo(<!NO_EXPLICIT_VISIBILITY_IN_API_MODE!>val bar<!>: Int, private var bar2: String, internal var bar3: Long, public var bar4: Int) {
@@ -1,7 +0,0 @@
// SKIP_TXT
// WITH_RUNTIME
public class A {
@PublishedApi
internal fun foo() = 1
}
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_TXT
// WITH_RUNTIME
@@ -1,12 +0,0 @@
// SKIP_TXT
/**
* foo KDoc
*/
fun foo() {}
public fun foo2() {}
fun bar() = 10
public fun bar2() = 10
public fun bar3(): Int = 10
@@ -1,3 +1,4 @@
// FIR_IDENTICAL
// SKIP_TXT
/**