Create Function From Usage: Add empty lines when inserting new function
This commit is contained in:
+48
-31
@@ -53,6 +53,11 @@ import org.jetbrains.jet.plugin.refactoring.CollectingValidator
|
|||||||
import org.jetbrains.jet.plugin.util.isUnit
|
import org.jetbrains.jet.plugin.util.isUnit
|
||||||
import org.jetbrains.jet.plugin.refactoring.runWriteAction
|
import org.jetbrains.jet.plugin.refactoring.runWriteAction
|
||||||
import com.intellij.util.ArrayUtil
|
import com.intellij.util.ArrayUtil
|
||||||
|
import com.intellij.psi.PsiWhiteSpace
|
||||||
|
import org.jetbrains.jet.plugin.refactoring.isMultiLine
|
||||||
|
import org.jetbrains.jet.plugin.refactoring.getLineCount
|
||||||
|
import com.intellij.psi.PsiElement
|
||||||
|
import org.jetbrains.jet.lexer.JetTokens
|
||||||
|
|
||||||
private val TYPE_PARAMETER_LIST_VARIABLE_NAME = "typeParameterList"
|
private val TYPE_PARAMETER_LIST_VARIABLE_NAME = "typeParameterList"
|
||||||
private val TEMPLATE_FROM_USAGE_FUNCTION_BODY = "New Kotlin Function Body.kt"
|
private val TEMPLATE_FROM_USAGE_FUNCTION_BODY = "New Kotlin Function Body.kt"
|
||||||
@@ -238,42 +243,54 @@ class FunctionBuilder(val config: FunctionBuilderConfiguration) {
|
|||||||
with (config) {
|
with (config) {
|
||||||
val parametersString = functionInfo.parameterInfos.indices.map { i -> "p$i: Any" }.joinToString(", ")
|
val parametersString = functionInfo.parameterInfos.indices.map { i -> "p$i: Any" }.joinToString(", ")
|
||||||
val returnTypeString = if (isUnit) "" else ": Any"
|
val returnTypeString = if (isUnit) "" else ": Any"
|
||||||
|
val ownerTypeString = if (isExtension) "${receiverTypeCandidate!!.renderedType!!}." else ""
|
||||||
val psiFactory = JetPsiFactory(currentFile)
|
val psiFactory = JetPsiFactory(currentFile)
|
||||||
if (isExtension) {
|
val func = psiFactory.createFunction("fun $ownerTypeString${functionInfo.name}($parametersString)$returnTypeString { }")
|
||||||
// create as extension function
|
val newLine = psiFactory.createNewLine()
|
||||||
val ownerTypeString = receiverTypeCandidate!!.renderedType!!
|
|
||||||
val func = psiFactory.createFunction(
|
fun prepend(element: PsiElement, elementBeforeStart: PsiElement): PsiElement {
|
||||||
"fun $ownerTypeString.${functionInfo.name}($parametersString)$returnTypeString { }"
|
val parent = elementBeforeStart.getParent()!!
|
||||||
)
|
val anchor = PsiTreeUtil.skipSiblingsForward(elementBeforeStart, javaClass<PsiWhiteSpace>())
|
||||||
return currentFile.add(func) as JetNamedFunction
|
val addedElement = parent.addBefore(element, anchor)!!
|
||||||
|
parent.addAfter(newLine, addedElement)
|
||||||
|
parent.addAfter(newLine, addedElement)
|
||||||
|
return addedElement
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
// create as regular function
|
|
||||||
|
|
||||||
val func = psiFactory.createFunction("fun ${functionInfo.name}($parametersString)$returnTypeString { }")
|
fun append(element: PsiElement, elementAfterEnd: PsiElement, skipInitial: Boolean): PsiElement {
|
||||||
when (containingElement) {
|
val parent = elementAfterEnd.getParent()!!
|
||||||
is JetFile -> {
|
val anchor =
|
||||||
return currentFile.add(func) as JetNamedFunction
|
if (!skipInitial && elementAfterEnd !is PsiWhiteSpace) {
|
||||||
}
|
elementAfterEnd
|
||||||
|
|
||||||
is JetClassOrObject -> {
|
|
||||||
var classBody = containingElement.getBody()
|
|
||||||
if (classBody == null) {
|
|
||||||
classBody = containingElement.add(psiFactory.createEmptyClassBody()) as JetClassBody
|
|
||||||
containingElement.addBefore(psiFactory.createWhiteSpace(), classBody)
|
|
||||||
}
|
}
|
||||||
val rBrace = classBody!!.getRBrace()
|
else {
|
||||||
|
PsiTreeUtil.skipSiblingsBackward(elementAfterEnd, javaClass<PsiWhiteSpace>())
|
||||||
//TODO: Assert rbrace not null? It can be if the class isn't closed.
|
}
|
||||||
return classBody!!.addBefore(func, rBrace) as JetNamedFunction
|
val addedElement = parent.addAfter(element, anchor)!!
|
||||||
}
|
if (anchor?.getNode()?.getElementType() != JetTokens.LBRACE) {
|
||||||
|
parent.addAfter(newLine, anchor)
|
||||||
is JetBlockExpression -> {
|
parent.addAfter(newLine, anchor)
|
||||||
return containingElement.addAfter(func, containingElement.getLBrace()) as JetNamedFunction
|
|
||||||
}
|
|
||||||
|
|
||||||
else -> throw AssertionError("Invalid containing element: ${containingElement.getText()}")
|
|
||||||
}
|
}
|
||||||
|
return addedElement
|
||||||
|
}
|
||||||
|
|
||||||
|
when (containingElement) {
|
||||||
|
is JetFile -> return append(func, containingElement.getLastChild()!!, false) as JetNamedFunction
|
||||||
|
|
||||||
|
is JetClassOrObject -> {
|
||||||
|
var classBody = containingElement.getBody()
|
||||||
|
if (classBody == null) {
|
||||||
|
classBody = containingElement.add(psiFactory.createEmptyClassBody()) as JetClassBody
|
||||||
|
containingElement.addBefore(psiFactory.createWhiteSpace(), classBody)
|
||||||
|
}
|
||||||
|
val rBrace = classBody!!.getRBrace()
|
||||||
|
return (rBrace?.let { append(func, it, true) }
|
||||||
|
?: append(func, classBody!!.getLastChild()!!, false)) as JetNamedFunction
|
||||||
|
}
|
||||||
|
|
||||||
|
is JetBlockExpression -> return prepend(func, containingElement.getLBrace()!!) as JetNamedFunction
|
||||||
|
|
||||||
|
else -> throw AssertionError("Invalid containing element: ${containingElement.getText()}")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
class A<T>(val n: T) {
|
class A<T>(val n: T) {
|
||||||
fun plus(): A<T> = throw Exception()
|
fun plus(): A<T> = throw Exception()
|
||||||
|
|
||||||
fun plus(arg: T): A<T> {
|
fun plus(arg: T): A<T> {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
class A<T>(val n: T) {
|
class A<T>(val n: T) {
|
||||||
fun plus(i: Int, s: String): A<T> = throw Exception()
|
fun plus(i: Int, s: String): A<T> = throw Exception()
|
||||||
|
|
||||||
fun plus(arg: T): A<T> {
|
fun plus(arg: T): A<T> {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class A<T>(val n: T)
|
|||||||
fun test() {
|
fun test() {
|
||||||
val a: A<Int> = 2 + A(1)
|
val a: A<Int> = 2 + A(1)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Int.plus(A: A<Int>): A<Int> {
|
fun Int.plus(A: A<Int>): A<Int> {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
// "Create function 'foo' from usage" "true"
|
// "Create function 'foo' from usage" "true"
|
||||||
|
|
||||||
class A<T>(val n: T) {
|
class A<T>(val n: T) {
|
||||||
|
|
||||||
fun foo(arg: T, s: String, function: Function1<T, T>): A<T> {
|
fun foo(arg: T, s: String, function: Function1<T, T>): A<T> {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
@@ -1,10 +1,10 @@
|
|||||||
// "Create function 'foo' from usage" "true"
|
// "Create function 'foo' from usage" "true"
|
||||||
|
|
||||||
class A<T>(val n: T) {
|
class A<T>(val n: T) {
|
||||||
|
|
||||||
fun foo(function: Function1<T, T>): A<T> {
|
fun foo(function: Function1<T, T>): A<T> {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fun test() {
|
fun test() {
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
class A<T>(val n: T) {
|
class A<T>(val n: T) {
|
||||||
fun foo(a: Int): A<T> = throw Exception()
|
fun foo(a: Int): A<T> = throw Exception()
|
||||||
|
|
||||||
fun foo(arg: T, s: String): A<T> {
|
fun foo(arg: T, s: String): A<T> {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
class A<T>(val n: T) {
|
class A<T>(val n: T) {
|
||||||
fun foo(i: Int, s: String): A<T> = throw Exception()
|
fun foo(i: Int, s: String): A<T> = throw Exception()
|
||||||
|
|
||||||
fun foo(arg: T): A<T> {
|
fun foo(arg: T): A<T> {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,10 +2,10 @@
|
|||||||
|
|
||||||
class A<T>(val n: T) {
|
class A<T>(val n: T) {
|
||||||
class object {
|
class object {
|
||||||
|
|
||||||
fun foo(i: Int): Int {
|
fun foo(i: Int): Int {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
fun test() {
|
fun test() {
|
||||||
val a: Int = Unit.foo(2)
|
val a: Int = Unit.foo(2)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Unit.foo(i: Int): Int {
|
fun Unit.foo(i: Int): Int {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
@@ -5,6 +5,7 @@ class A<T>(val n: T)
|
|||||||
fun test() {
|
fun test() {
|
||||||
val a: A<Int> = 2.foo(A(1))
|
val a: A<Int> = 2.foo(A(1))
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Int.foo(A: A<Int>): A<Int> {
|
fun Int.foo(A: A<Int>): A<Int> {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@ fun test() {
|
|||||||
fun foo(i: Int, s: String): Int {
|
fun foo(i: Int, s: String): Int {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|
||||||
fun nestedTest(): Int {
|
fun nestedTest(): Int {
|
||||||
return foo(2, "2")
|
return foo(2, "2")
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class A {
|
|||||||
fun test(): Int {
|
fun test(): Int {
|
||||||
return foo(2, "2")
|
return foo(2, "2")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo(i: Int, s: String): Int {
|
fun foo(i: Int, s: String): Int {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class A {
|
|||||||
fun test(): Int {
|
fun test(): Int {
|
||||||
return foo(2, "2")
|
return foo(2, "2")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo(i: Int, s: String): Int {
|
fun foo(i: Int, s: String): Int {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ class A<T>(val n: T) {
|
|||||||
fun test(): A<Int> {
|
fun test(): A<Int> {
|
||||||
return this.foo(2, "2")
|
return this.foo(2, "2")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo(i: Int, s: String): A<Int> {
|
fun foo(i: Int, s: String): A<Int> {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class A<T>(val n: T) {
|
|||||||
fun test(): A<Int> {
|
fun test(): A<Int> {
|
||||||
return this.foo(2, "2")
|
return this.foo(2, "2")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo(i: Int, s: String): A<Int> {
|
fun foo(i: Int, s: String): A<Int> {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ class A<T>(val n: T) {
|
|||||||
return this@A.foo(2, "2")
|
return this@A.foo(2, "2")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo(i: Int, s: String): A<Int> {
|
fun foo(i: Int, s: String): A<Int> {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
fun test(): Int {
|
fun test(): Int {
|
||||||
return foo(2, "2")
|
return foo(2, "2")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun foo(i: Int, s: String): Int {
|
fun foo(i: Int, s: String): Int {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
class Foo<T> {
|
class Foo<T> {
|
||||||
fun component1(): Int { return 0 }
|
fun component1(): Int { return 0 }
|
||||||
fun component2(): Int { return 0 }
|
fun component2(): Int { return 0 }
|
||||||
|
|
||||||
fun component3(): Any {
|
fun component3(): Any {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
class Foo<T> {
|
class Foo<T> {
|
||||||
fun component1(): Int { return 0 }
|
fun component1(): Int { return 0 }
|
||||||
fun component2(): Int { return 0 }
|
fun component2(): Int { return 0 }
|
||||||
|
|
||||||
fun component3(): String {
|
fun component3(): String {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -16,6 +16,7 @@ fun Any.component1(): Int {
|
|||||||
fun foo() {
|
fun foo() {
|
||||||
for ((i: Int, j: Int) in Foo<Int>()) { }
|
for ((i: Int, j: Int) in Foo<Int>()) { }
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Any.component2(): Int {
|
fun Any.component2(): Int {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ class Foo<T> {
|
|||||||
fun x (y: Foo<Iterable<T>>) {
|
fun x (y: Foo<Iterable<T>>) {
|
||||||
val z: Iterable<T> = y[""]
|
val z: Iterable<T> = y[""]
|
||||||
}
|
}
|
||||||
|
|
||||||
fun get(s: String): T {
|
fun get(s: String): T {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class Foo<T> {
|
|||||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||||
val z: Iterable<T> = y["", w]
|
val z: Iterable<T> = y["", w]
|
||||||
}
|
}
|
||||||
|
|
||||||
fun get(s: String, w: T): T {
|
fun get(s: String, w: T): T {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -7,6 +7,7 @@ class Foo<T> {
|
|||||||
val z = y["", w]
|
val z = y["", w]
|
||||||
bar(z)
|
bar(z)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <V> get(s: String, w: ArrayList<V>): String {
|
fun <V> get(s: String, w: ArrayList<V>): String {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -2,6 +2,7 @@
|
|||||||
fun x (y: Any) {
|
fun x (y: Any) {
|
||||||
val z: Any = y[""]
|
val z: Any = y[""]
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Any.get(s: String): Any {
|
fun Any.get(s: String): Any {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
@@ -3,6 +3,7 @@ class Foo<T> {
|
|||||||
fun <S> x (y: Foo<Iterable<S>>) {
|
fun <S> x (y: Foo<Iterable<S>>) {
|
||||||
val z: Iterable<S> = y[""]
|
val z: Iterable<S> = y[""]
|
||||||
}
|
}
|
||||||
|
|
||||||
fun get(s: String): T {
|
fun get(s: String): T {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class Foo<T, S: Iterable<T>> {
|
|||||||
fun <U> x (y: Foo<U, Iterable<U>>) {
|
fun <U> x (y: Foo<U, Iterable<U>>) {
|
||||||
val z: U = y[""]
|
val z: U = y[""]
|
||||||
}
|
}
|
||||||
|
|
||||||
fun get(s: String): T {
|
fun get(s: String): T {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class Foo<T> {
|
|||||||
fun <T, V> x (y: Foo<Iterable<T>>, w: Iterable<V>) {
|
fun <T, V> x (y: Foo<Iterable<T>>, w: Iterable<V>) {
|
||||||
val z: Iterable<T> = y["", w]
|
val z: Iterable<T> = y["", w]
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <V> get(s: String, w: Iterable<V>): T {
|
fun <V> get(s: String, w: Iterable<V>): T {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class Foo<T> {
|
|||||||
fun <T, V> x (y: Foo<List<T>>, w: ArrayList<V>, v: T) {
|
fun <T, V> x (y: Foo<List<T>>, w: ArrayList<V>, v: T) {
|
||||||
val z: Iterable<T> = y["", w, v]
|
val z: Iterable<T> = y["", w, v]
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <V, T1> get(s: String, w: ArrayList<V>, v: T1): T {
|
fun <V, T1> get(s: String, w: ArrayList<V>, v: T1): T {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class Foo<T> {
|
|||||||
fun x (y: Foo<List<T>>, w: ArrayList<T>) {
|
fun x (y: Foo<List<T>>, w: ArrayList<T>) {
|
||||||
val z: Iterable<T> = y["", w]
|
val z: Iterable<T> = y["", w]
|
||||||
}
|
}
|
||||||
|
|
||||||
fun get(s: String, w: T): T {
|
fun get(s: String, w: T): T {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class Foo<S> {
|
|||||||
fun <T> x (y: Foo<List<T>>, w: ArrayList<T>) {
|
fun <T> x (y: Foo<List<T>>, w: ArrayList<T>) {
|
||||||
val z: Iterable<T> = y["", w]
|
val z: Iterable<T> = y["", w]
|
||||||
}
|
}
|
||||||
|
|
||||||
fun get(s: String, w: S): S {
|
fun get(s: String, w: S): S {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class FooIterator<T> {
|
|||||||
fun next(): Int {
|
fun next(): Int {
|
||||||
throw Exception("not implemented")
|
throw Exception("not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hasNext(): Boolean {
|
fun hasNext(): Boolean {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class FooIterator<T> {
|
|||||||
fun next(): T {
|
fun next(): T {
|
||||||
throw Exception("not implemented")
|
throw Exception("not implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun hasNext(): Boolean {
|
fun hasNext(): Boolean {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ class A<T>(val n: T)
|
|||||||
fun test(): A<String> {
|
fun test(): A<String> {
|
||||||
return 1(2, "2")
|
return 1(2, "2")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Int.invoke(i: Int, s: String): A<String> {
|
fun Int.invoke(i: Int, s: String): A<String> {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
// "Create function 'next' from usage" "true"
|
// "Create function 'next' from usage" "true"
|
||||||
class FooIterator<T> {
|
class FooIterator<T> {
|
||||||
fun hasNext(): Boolean { return false }
|
fun hasNext(): Boolean { return false }
|
||||||
|
|
||||||
fun next(): Any {
|
fun next(): Any {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// "Create function 'next' from usage" "true"
|
// "Create function 'next' from usage" "true"
|
||||||
class FooIterator<T> {
|
class FooIterator<T> {
|
||||||
fun hasNext(): Boolean { return false }
|
fun hasNext(): Boolean { return false }
|
||||||
|
|
||||||
fun next(): Int {
|
fun next(): Int {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,6 +1,7 @@
|
|||||||
// "Create function 'next' from usage" "true"
|
// "Create function 'next' from usage" "true"
|
||||||
class FooIterator<T> {
|
class FooIterator<T> {
|
||||||
fun hasNext(): Boolean { return false }
|
fun hasNext(): Boolean { return false }
|
||||||
|
|
||||||
fun next(): T {
|
fun next(): T {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@ class Foo<T> {
|
|||||||
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
fun <T> x (y: Foo<List<T>>, w: java.util.ArrayList<T>) {
|
||||||
y["", w] = w
|
y["", w] = w
|
||||||
}
|
}
|
||||||
|
|
||||||
fun set(s: String, w: T, value: T) {
|
fun set(s: String, w: T, value: T) {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,6 +6,7 @@ class Foo<T> {
|
|||||||
y["", w] = w
|
y["", w] = w
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun <T> Any.set(s: String, w: ArrayList<T>, value: ArrayList<T>) {
|
fun <T> Any.set(s: String, w: ArrayList<T>, value: ArrayList<T>) {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
|
|
||||||
class A<T>(val n: T) {
|
class A<T>(val n: T) {
|
||||||
fun minus(n: Int): A<T> = throw Exception()
|
fun minus(n: Int): A<T> = throw Exception()
|
||||||
|
|
||||||
fun minus(): A<T> {
|
fun minus(): A<T> {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
fun test() {
|
fun test() {
|
||||||
val a = -false
|
val a = -false
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Boolean.minus(): Any {
|
fun Boolean.minus(): Any {
|
||||||
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
throw UnsupportedOperationException("not implemented") //To change body of created functions use File | Settings | File Templates.
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user