Create from Usage: Make extension functions/properties 'private' by default

#KT-11799 Fixed
This commit is contained in:
Alexey Sedunov
2016-08-17 14:19:04 +03:00
parent 92b0c852dd
commit 99ba340236
35 changed files with 37 additions and 35 deletions
@@ -7,6 +7,6 @@ fun test() {
val a: A<Int> = 2 + A(1)
}
infix operator fun Int.plus(a: A<Int>): A<Int> {
private infix operator fun Int.plus(a: A<Int>): A<Int> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -5,6 +5,6 @@ fun test() {
val t: Int = 1 `!u00A0` 2
}
infix fun Int.`!u00A0`(i: Int): Int {
private infix fun Int.`!u00A0`(i: Int): Int {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -7,6 +7,6 @@ fun main(args: Array<String>) {
list.foo { object : A() {} }
}
fun <E> List<E>.foo(function: () -> A) {
private fun <E> List<E>.foo(function: () -> A) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -9,6 +9,6 @@ fun main(args: Array<String>) {
list.foo { Local() }
}
fun <E> List<E>.foo(function: () -> A) {
private fun <E> List<E>.foo(function: () -> A) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -9,6 +9,6 @@ fun A.test() {
bar(foo(n))
}
fun A.foo(n: Int): Boolean {
private fun A.foo(n: Int): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -12,6 +12,6 @@ fun test() {
}
}
fun A.foo(n: Int): Boolean {
private fun A.foo(n: Int): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -2,7 +2,7 @@
// ERROR: Property must be initialized
class A(val n: Int)
val A.foo: Boolean<caret>
private val A.foo: Boolean
class B {
val A.test: Boolean get() = foo
@@ -2,7 +2,7 @@
// ERROR: Property must be initialized
class A(val n: Int)
var A.foo: Boolean<caret>
private var A.foo: Boolean
class B {
var A.test: Boolean
@@ -5,6 +5,6 @@ fun test(): Int {
return A().foo()
}
fun A.foo(): Int {
private fun A.foo(): Int {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -5,6 +5,6 @@ fun test(): Int? {
return A().foo(1, "2")
}
fun A.foo(i: Int, s: String): Int? {
private fun A.foo(i: Int, s: String): Int? {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -6,6 +6,6 @@ fun test(t: T) {
val b: Boolean = t.foo("1", 2)
}
fun T.foo(s: String, i: Int): Boolean {
private fun T.foo(s: String, i: Int): Boolean {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -10,6 +10,6 @@ class X {
}
}
fun package2.A.foo() {
private fun package2.A.foo() {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -5,6 +5,6 @@ fun test() {
val a: Int = Unit.foo(2)
}
fun Unit.foo(i: Int): Int {
private fun Unit.foo(i: Int): Int {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -7,6 +7,6 @@ fun test() {
val a: A<Int> = 2.foo(A(1))
}
fun Int.foo(a: A<Int>): A<Int> {
private fun Int.foo(a: A<Int>): A<Int> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -4,6 +4,6 @@ fun foo(block: (Int) -> String) {
block.bar()
}
fun <P1, R> ((P1) -> R).bar() {
private fun <P1, R> ((P1) -> R).bar() {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -7,6 +7,6 @@ class A<T>(val items: List<T>) {
}
}
fun <E, T, U> List<E>.foo(t: T, u: U): T {
private fun <E, T, U> List<E>.foo(t: T, u: U): T {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -7,6 +7,6 @@ class A<T>(val items: List<T>) {
}
}
fun <E, T> List<E>.foo(t: T, s: String): T {
private fun <E, T> List<E>.foo(t: T, s: String): T {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -7,6 +7,6 @@ class A<T>(val items: List<T>) {
}
}
fun <E, T, U> List<E>.foo(t: T, u: U): T {
private fun <E, T, U> List<E>.foo(t: T, u: U): T {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -3,6 +3,6 @@ fun <T> foo(t: T) {
t.bar()
}
fun <T> T.bar() {
private fun <T> T.bar() {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -8,6 +8,6 @@ fun test() {
consume(1.map(Int::foo))
}
fun Int.foo(): String {
<selection>TODO("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
private fun Int.foo(): String {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -8,6 +8,6 @@ fun test() {
consume(1.map(Int::foo))
}
fun Int.foo(): String {
<selection>TODO("not implemented") //To change body of created functions use File | Settings | File Templates.</selection>
private fun Int.foo(): String {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -18,6 +18,6 @@ fun foo() {
for ((i: Int, j: Int) in Foo<Int>()) { }
}
operator fun Any.component2(): Int {
private operator fun Any.component2(): Int {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -5,6 +5,6 @@ fun x (y: Any) {
val z: Any = y[""]
}
operator fun Any.get(s: String): Any {
private operator fun Any.get(s: String): Any {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -7,6 +7,6 @@ fun test(): A<String> {
return 1(2, "2")
}
operator fun Int.invoke(i: Int, s: String): A<String> {
private operator fun Int.invoke(i: Int, s: String): A<String> {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -9,6 +9,6 @@ class Foo<T> {
}
}
operator fun <T> Any.set(s: String, w: ArrayList<T>, value: ArrayList<T>) {
private operator fun <T> Any.set(s: String, w: ArrayList<T>, value: ArrayList<T>) {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}
@@ -5,6 +5,6 @@ fun test() {
val a = -false
}
operator fun Boolean.unaryMinus(): Any {
private operator fun Boolean.unaryMinus(): Any {
TODO("not implemented") //To change body of created functions use File | Settings | File Templates.
}