Corrections on code review
This commit is contained in:
@@ -95,7 +95,7 @@ class ChangeFunctionLiteralReturnTypeFix(
|
||||
val parentFunctionReturnTypeRef = parentFunction.typeReference
|
||||
val parentFunctionReturnType = context.get(BindingContext.TYPE, parentFunctionReturnTypeRef)
|
||||
return if (parentFunctionReturnType != null && !KotlinTypeChecker.DEFAULT.isSubtypeOf(eventualFunctionLiteralType, parentFunctionReturnType))
|
||||
ChangeFunctionReturnTypeFix.ForCurrent(parentFunction, eventualFunctionLiteralType)
|
||||
ChangeFunctionReturnTypeFix.ForEnclosing(parentFunction, eventualFunctionLiteralType)
|
||||
else
|
||||
null
|
||||
}
|
||||
|
||||
@@ -83,24 +83,24 @@ abstract class ChangeFunctionReturnTypeFix(element: KtFunction, type: KotlinType
|
||||
override fun functionPresentation() = null
|
||||
}
|
||||
|
||||
class ForCurrent(element: KtFunction, type: KotlinType) : ChangeFunctionReturnTypeFix(element, type), HighPriorityAction {
|
||||
class ForEnclosing(element: KtFunction, type: KotlinType) : ChangeFunctionReturnTypeFix(element, type), HighPriorityAction {
|
||||
override fun functionPresentation(): String? {
|
||||
val presentation = super.functionPresentation() ?: return "current function"
|
||||
return "current $presentation"
|
||||
val presentation = super.functionPresentation() ?: return "enclosing function"
|
||||
return "enclosing $presentation"
|
||||
}
|
||||
}
|
||||
|
||||
class ForInvoked(element: KtFunction, type: KotlinType) : ChangeFunctionReturnTypeFix(element, type) {
|
||||
class ForCalled(element: KtFunction, type: KotlinType) : ChangeFunctionReturnTypeFix(element, type) {
|
||||
override fun functionPresentation(): String? {
|
||||
val presentation = super.functionPresentation() ?: return "invoked function"
|
||||
return "invoked $presentation"
|
||||
val presentation = super.functionPresentation() ?: return "called function"
|
||||
return "called $presentation"
|
||||
}
|
||||
}
|
||||
|
||||
class ForOverridden(element: KtFunction, type: KotlinType) : ChangeFunctionReturnTypeFix(element, type) {
|
||||
override fun functionPresentation(): String? {
|
||||
val presentation = super.functionPresentation() ?: return null
|
||||
return "overridden $presentation"
|
||||
return "base $presentation"
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,7 +155,7 @@ abstract class ChangeFunctionReturnTypeFix(element: KtFunction, type: KotlinType
|
||||
val resolvedCall = context.get(BindingContext.COMPONENT_RESOLVED_CALL, entry) ?: return null
|
||||
val componentFunction = DescriptorToSourceUtils.descriptorToDeclaration(resolvedCall.candidateDescriptor) as KtFunction? ?: return null
|
||||
val expectedType = context[BindingContext.TYPE, entry.typeReference!!] ?: return null
|
||||
return ChangeFunctionReturnTypeFix.ForInvoked(componentFunction, expectedType)
|
||||
return ChangeFunctionReturnTypeFix.ForCalled(componentFunction, expectedType)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -167,7 +167,7 @@ abstract class ChangeFunctionReturnTypeFix(element: KtFunction, type: KotlinType
|
||||
val resolvedCall = context[BindingContext.LOOP_RANGE_HAS_NEXT_RESOLVED_CALL, expression] ?: return null
|
||||
val hasNextDescriptor = resolvedCall.candidateDescriptor
|
||||
val hasNextFunction = DescriptorToSourceUtils.descriptorToDeclaration(hasNextDescriptor) as KtFunction? ?: return null
|
||||
return ChangeFunctionReturnTypeFix.ForInvoked(hasNextFunction, hasNextDescriptor.builtIns.booleanType)
|
||||
return ChangeFunctionReturnTypeFix.ForCalled(hasNextFunction, hasNextDescriptor.builtIns.booleanType)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -178,7 +178,7 @@ abstract class ChangeFunctionReturnTypeFix(element: KtFunction, type: KotlinType
|
||||
val resolvedCall = expression.getResolvedCall(context) ?: return null
|
||||
val compareToDescriptor = resolvedCall.candidateDescriptor
|
||||
val compareTo = DescriptorToSourceUtils.descriptorToDeclaration(compareToDescriptor) as? KtFunction ?: return null
|
||||
return ChangeFunctionReturnTypeFix.ForInvoked(compareTo, compareToDescriptor.builtIns.intType)
|
||||
return ChangeFunctionReturnTypeFix.ForCalled(compareTo, compareToDescriptor.builtIns.intType)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -219,14 +219,14 @@ abstract class ChangeFunctionReturnTypeFix(element: KtFunction, type: KotlinType
|
||||
object ChangingReturnTypeToUnitFactory : KotlinSingleIntentionActionFactory() {
|
||||
override fun createAction(diagnostic: Diagnostic): IntentionAction? {
|
||||
val function = QuickFixUtil.getParentElementOfType(diagnostic, KtFunction::class.java) ?: return null
|
||||
return ChangeFunctionReturnTypeFix.ForCurrent(function, function.builtIns.unitType)
|
||||
return ChangeFunctionReturnTypeFix.ForEnclosing(function, function.builtIns.unitType)
|
||||
}
|
||||
}
|
||||
|
||||
object ChangingReturnTypeToNothingFactory : KotlinSingleIntentionActionFactory() {
|
||||
override fun createAction(diagnostic: Diagnostic): IntentionAction? {
|
||||
val function = QuickFixUtil.getParentElementOfType(diagnostic, KtFunction::class.java) ?: return null
|
||||
return ChangeFunctionReturnTypeFix.ForCurrent(function, function.builtIns.nothingType)
|
||||
return ChangeFunctionReturnTypeFix.ForEnclosing(function, function.builtIns.nothingType)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +73,7 @@ open class ChangeVariableTypeFix(element: KtVariableDeclaration, type: KotlinTyp
|
||||
class ForOverridden(element: KtVariableDeclaration, type: KotlinType) : ChangeVariableTypeFix(element, type) {
|
||||
override fun variablePresentation(): String? {
|
||||
val presentation = super.variablePresentation() ?: return null
|
||||
return "overridden property $presentation"
|
||||
return "base property $presentation"
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -141,7 +141,7 @@ class QuickFixFactoryForTypeMismatchError : KotlinIntentionActionsFactory() {
|
||||
if (function is KtFunction && QuickFixUtil.canFunctionOrGetterReturnExpression(function, diagnosticElement)) {
|
||||
val scope = function.getResolutionScope(context, function.getResolutionFacade())
|
||||
val typeToInsert = expressionType.approximateWithResolvableType(scope, false)
|
||||
actions.add(ChangeFunctionReturnTypeFix.ForCurrent(function, typeToInsert))
|
||||
actions.add(ChangeFunctionReturnTypeFix.ForEnclosing(function, typeToInsert))
|
||||
}
|
||||
|
||||
// Fixing overloaded operators:
|
||||
@@ -150,7 +150,7 @@ class QuickFixFactoryForTypeMismatchError : KotlinIntentionActionsFactory() {
|
||||
if (resolvedCall != null) {
|
||||
val declaration = getFunctionDeclaration(resolvedCall)
|
||||
if (declaration != null) {
|
||||
actions.add(ChangeFunctionReturnTypeFix.ForInvoked(declaration, expectedType))
|
||||
actions.add(ChangeFunctionReturnTypeFix.ForCalled(declaration, expectedType))
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -161,7 +161,7 @@ class QuickFixFactoryForTypeMismatchError : KotlinIntentionActionsFactory() {
|
||||
if (resolvedCall != null) {
|
||||
val declaration = getFunctionDeclaration(resolvedCall)
|
||||
if (declaration != null) {
|
||||
actions.add(ChangeFunctionReturnTypeFix.ForInvoked(declaration, expectedType))
|
||||
actions.add(ChangeFunctionReturnTypeFix.ForCalled(declaration, expectedType))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change type of overridden property 'B.x' to '(Int) -> Int'" "true"
|
||||
// "Change type of base property 'B.x' to '(Int) -> Int'" "true"
|
||||
interface A {
|
||||
val x: (Int) -> Int
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change type of overridden property 'B.x' to '(Int) -> Int'" "true"
|
||||
// "Change type of base property 'B.x' to '(Int) -> Int'" "true"
|
||||
interface A {
|
||||
val x: (Int) -> Int
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change type of overridden property 'A.x' to 'String'" "true"
|
||||
// "Change type of base property 'A.x' to 'String'" "true"
|
||||
interface A {
|
||||
var x: Int
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change type of overridden property 'A.x' to 'String'" "true"
|
||||
// "Change type of base property 'A.x' to 'String'" "true"
|
||||
interface A {
|
||||
var x: String
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of overridden function 'A.foo' to 'Long'" "true"
|
||||
// "Change return type of base function 'A.foo' to 'Long'" "true"
|
||||
interface A {
|
||||
fun foo(): Int
|
||||
}
|
||||
|
||||
idea/testData/quickfix/override/typeMismatchOnOverride/changeReturnTypeOfOverriddenFunction.kt.after
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of overridden function 'A.foo' to 'Long'" "true"
|
||||
// "Change return type of base function 'A.foo' to 'Long'" "true"
|
||||
interface A {
|
||||
fun foo(): Long
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'bar' to 'A'" "true"
|
||||
// "Change return type of enclosing function 'bar' to 'A'" "true"
|
||||
fun foo() {
|
||||
open class A
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'bar' to 'A'" "true"
|
||||
// "Change return type of enclosing function 'bar' to 'A'" "true"
|
||||
fun foo() {
|
||||
open class A
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'T'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'T'" "true"
|
||||
interface T
|
||||
|
||||
fun foo() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'T'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'T'" "true"
|
||||
interface T
|
||||
|
||||
fun foo(): T {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'Any'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'Any'" "true"
|
||||
fun foo() {
|
||||
class A
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'Any'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'Any'" "true"
|
||||
fun foo(): Any {
|
||||
class A
|
||||
|
||||
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
// "Change return type of invoked function 'bar' to 'String'" "true"
|
||||
// "Change return type of called function 'bar' to 'String'" "true"
|
||||
fun bar(): Any = ""
|
||||
fun foo(): String = bar(<caret>)
|
||||
Vendored
+1
-1
@@ -1,3 +1,3 @@
|
||||
// "Change return type of invoked function 'bar' to 'String'" "true"
|
||||
// "Change return type of called function 'bar' to 'String'" "true"
|
||||
fun bar(): String = ""
|
||||
fun foo(): String = bar(<caret>)
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'bar' to 'HashSet<Int>'" "true"
|
||||
// "Change return type of called function 'bar' to 'HashSet<Int>'" "true"
|
||||
|
||||
fun bar(): Any = java.util.LinkedHashSet<Int>()
|
||||
fun foo(): java.util.HashSet<Int> = bar(<caret>)
|
||||
+1
-1
@@ -1,6 +1,6 @@
|
||||
import java.util.HashSet
|
||||
|
||||
// "Change return type of invoked function 'bar' to 'HashSet<Int>'" "true"
|
||||
// "Change return type of called function 'bar' to 'HashSet<Int>'" "true"
|
||||
|
||||
fun bar(): HashSet<Int> = java.util.LinkedHashSet<Int>()
|
||||
fun foo(): java.util.HashSet<Int> = bar()
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'Int'" "true"
|
||||
package foo.bar
|
||||
|
||||
fun test() {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'Int'" "true"
|
||||
package foo.bar
|
||||
|
||||
fun test() {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'Companion.foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'Companion.foo' to 'Int'" "true"
|
||||
package foo.bar
|
||||
|
||||
class A {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'Companion.foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'Companion.foo' to 'Int'" "true"
|
||||
package foo.bar
|
||||
|
||||
class A {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'A.foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'A.foo' to 'Int'" "true"
|
||||
package foo.bar
|
||||
|
||||
fun test() {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'A.foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'A.foo' to 'Int'" "true"
|
||||
package foo.bar
|
||||
|
||||
fun test() {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'B.foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'B.foo' to 'Int'" "true"
|
||||
package foo.bar
|
||||
|
||||
class A {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'B.foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'B.foo' to 'Int'" "true"
|
||||
package foo.bar
|
||||
|
||||
class A {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'A.foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'A.foo' to 'Int'" "true"
|
||||
package foo.bar
|
||||
|
||||
class A {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'A.foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'A.foo' to 'Int'" "true"
|
||||
package foo.bar
|
||||
|
||||
class A {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'Int?'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'Int?'" "true"
|
||||
|
||||
fun foo(): String {
|
||||
val n: Int? = 1
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'Int?'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'Int?'" "true"
|
||||
|
||||
fun foo(): Int? {
|
||||
val n: Int? = 1
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Remove explicitly specified return type of current function" "true"
|
||||
// "Remove explicitly specified return type of enclosing function" "true"
|
||||
// ERROR: Function declaration must have a name
|
||||
fun (): Int {
|
||||
return<caret>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Remove explicitly specified return type of current function" "true"
|
||||
// "Remove explicitly specified return type of enclosing function" "true"
|
||||
// ERROR: Function declaration must have a name
|
||||
fun () {
|
||||
return<caret>
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.hasNext' to 'Boolean'" "true"
|
||||
// "Change return type of called function 'A.hasNext' to 'Boolean'" "true"
|
||||
abstract class A {
|
||||
abstract operator fun hasNext
|
||||
abstract operator fun next(): Int
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.hasNext' to 'Boolean'" "true"
|
||||
// "Change return type of called function 'A.hasNext' to 'Boolean'" "true"
|
||||
abstract class A {
|
||||
abstract operator fun hasNext: Boolean
|
||||
abstract operator fun next(): Int
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.compareTo' to 'Int'" "true"
|
||||
// "Change return type of called function 'A.compareTo' to 'Int'" "true"
|
||||
interface A {
|
||||
operator fun compareTo(other: Any): String
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.compareTo' to 'Int'" "true"
|
||||
// "Change return type of called function 'A.compareTo' to 'Int'" "true"
|
||||
interface A {
|
||||
operator fun compareTo(other: Any): Int
|
||||
}
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.component1' to 'Int'" "true"
|
||||
// "Change return type of called function 'A.component1' to 'Int'" "true"
|
||||
abstract class A {
|
||||
abstract operator fun component1()
|
||||
abstract operator fun component2(): Int
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.component1' to 'Int'" "true"
|
||||
// "Change return type of called function 'A.component1' to 'Int'" "true"
|
||||
abstract class A {
|
||||
abstract operator fun component1(): Int
|
||||
abstract operator fun component2(): Int
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.component2' to 'Int'" "true"
|
||||
// "Change return type of called function 'A.component2' to 'Int'" "true"
|
||||
abstract class A {
|
||||
abstract operator fun component1(): Int
|
||||
abstract operator fun component2(): String
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.component2' to 'Int'" "true"
|
||||
// "Change return type of called function 'A.component2' to 'Int'" "true"
|
||||
abstract class A {
|
||||
abstract operator fun component1(): Int
|
||||
abstract operator fun component2(): Int
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Remove explicitly specified return type of invoked function 'A.component2'" "true"
|
||||
// "Remove explicitly specified return type of called function 'A.component2'" "true"
|
||||
abstract class A {
|
||||
abstract operator fun component1(): Int
|
||||
abstract operator fun component2(): Int
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Remove explicitly specified return type of invoked function 'A.component2'" "true"
|
||||
// "Remove explicitly specified return type of called function 'A.component2'" "true"
|
||||
abstract class A {
|
||||
abstract operator fun component1(): Int
|
||||
abstract operator fun component2()
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.component2' to 'Unit'" "true"
|
||||
// "Change return type of called function 'A.component2' to 'Unit'" "true"
|
||||
// ERROR: The integer literal does not conform to the expected type Unit
|
||||
abstract class A {
|
||||
abstract operator fun component1(): Int
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.component2' to 'Unit'" "true"
|
||||
// "Change return type of called function 'A.component2' to 'Unit'" "true"
|
||||
// ERROR: The integer literal does not conform to the expected type Unit
|
||||
abstract class A {
|
||||
abstract operator fun component1(): Int
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'Int'" "true"
|
||||
|
||||
fun foo(): String {
|
||||
return <caret>1
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'Int'" "true"
|
||||
|
||||
fun foo(): Int {
|
||||
return <caret>1
|
||||
|
||||
+1
-1
@@ -1,5 +1,5 @@
|
||||
// "Change type to '(String) -> [ERROR : Ay]'" "false"
|
||||
// ACTION: Change type of overridden property 'A.x' to '(Int) -> Int'
|
||||
// ACTION: Change type of base property 'A.x' to '(Int) -> Int'
|
||||
// ERROR: Type of 'x' is not a subtype of the overridden property 'public abstract val x: (String) -> [ERROR : Ay] defined in A'
|
||||
// ERROR: Unresolved reference: Ay
|
||||
interface A {
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.not' to 'A'" "true"
|
||||
// "Change return type of called function 'A.not' to 'A'" "true"
|
||||
interface A {
|
||||
operator fun not(): String
|
||||
operator fun times(a: A): A
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.not' to 'A'" "true"
|
||||
// "Change return type of called function 'A.not' to 'A'" "true"
|
||||
interface A {
|
||||
operator fun not(): A
|
||||
operator fun times(a: A): A
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.plus' to '() -> Int'" "true"
|
||||
// "Change return type of called function 'A.plus' to '() -> Int'" "true"
|
||||
interface A {
|
||||
operator fun plus(a: A): String
|
||||
}
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.plus' to '() -> Int'" "true"
|
||||
// "Change return type of called function 'A.plus' to '() -> Int'" "true"
|
||||
interface A {
|
||||
operator fun plus(a: A): () -> Int
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.hasNext' to 'Boolean'" "true"
|
||||
// "Change return type of called function 'A.hasNext' to 'Boolean'" "true"
|
||||
abstract class A {
|
||||
abstract operator fun hasNext(): Int
|
||||
abstract operator fun next(): Int
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of invoked function 'A.hasNext' to 'Boolean'" "true"
|
||||
// "Change return type of called function 'A.hasNext' to 'Boolean'" "true"
|
||||
abstract class A {
|
||||
abstract operator fun hasNext(): Boolean
|
||||
abstract operator fun next(): Int
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'U'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'U'" "true"
|
||||
interface T
|
||||
interface U
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'U'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'U'" "true"
|
||||
interface T
|
||||
interface U
|
||||
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'T'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'T'" "true"
|
||||
interface T
|
||||
|
||||
fun foo() {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'T'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'T'" "true"
|
||||
interface T
|
||||
|
||||
fun foo(): T {
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'String?'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'String?'" "true"
|
||||
|
||||
fun foo(): String {
|
||||
return <caret>null
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'String?'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'String?'" "true"
|
||||
|
||||
fun foo(): String? {
|
||||
return null
|
||||
|
||||
@@ -1,3 +1,3 @@
|
||||
// "Remove explicitly specified return type of current function 'foo'" "true"
|
||||
// "Remove explicitly specified return type of enclosing function 'foo'" "true"
|
||||
fun foo(): Int {
|
||||
<caret>}
|
||||
+1
-1
@@ -1,3 +1,3 @@
|
||||
// "Remove explicitly specified return type of current function 'foo'" "true"
|
||||
// "Remove explicitly specified return type of enclosing function 'foo'" "true"
|
||||
fun foo() {
|
||||
<caret>}
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove explicitly specified return type of current function 'foo'" "true"
|
||||
// "Remove explicitly specified return type of enclosing function 'foo'" "true"
|
||||
fun foo(): Int {
|
||||
return<caret>
|
||||
}
|
||||
@@ -1,4 +1,4 @@
|
||||
// "Remove explicitly specified return type of current function 'foo'" "true"
|
||||
// "Remove explicitly specified return type of enclosing function 'foo'" "true"
|
||||
fun foo() {
|
||||
return<caret>
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to '(Long) -> Int'" "true"
|
||||
// "Change return type of enclosing function 'foo' to '(Long) -> Int'" "true"
|
||||
fun foo(x: Any): Int {
|
||||
return {x: Long -> 42}<caret>
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to '(Long) -> Int'" "true"
|
||||
// "Change return type of enclosing function 'foo' to '(Long) -> Int'" "true"
|
||||
fun foo(x: Any): (Long) -> Int {
|
||||
return {x: Long -> 42}<caret>
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to '() -> Any'" "true"
|
||||
// "Change return type of enclosing function 'foo' to '() -> Any'" "true"
|
||||
fun foo(x: Any): () -> Int {
|
||||
return {x<caret>}
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to '() -> Any'" "true"
|
||||
// "Change return type of enclosing function 'foo' to '() -> Any'" "true"
|
||||
fun foo(x: Any): () -> Any {
|
||||
return {x<caret>}
|
||||
}
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
// "Change return type of invoked function 'AA.f' to 'Boolean'" "false"
|
||||
// ACTION: Change return type of current function 'AAA.g' to 'Int'
|
||||
// "Change return type of called function 'AA.f' to 'Boolean'" "false"
|
||||
// ACTION: Change return type of enclosing function 'AAA.g' to 'Int'
|
||||
// ACTION: Convert to expression body
|
||||
// ERROR: Type mismatch: inferred type is Int but Boolean was expected
|
||||
interface A {
|
||||
|
||||
+2
-2
@@ -1,5 +1,5 @@
|
||||
// "Change return type of invoked function 'AA.contains' to 'Int'" "false"
|
||||
// ACTION: Change return type of current function 'AAA.g' to 'Boolean'
|
||||
// "Change return type of called function 'AA.contains' to 'Int'" "false"
|
||||
// ACTION: Change return type of enclosing function 'AAA.g' to 'Boolean'
|
||||
// ACTION: Convert to expression body
|
||||
// ACTION: Replace overloaded operator with function call
|
||||
// ERROR: Type mismatch: inferred type is Boolean but Int was expected
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'Int'" "true"
|
||||
fun foo(n: Int): Boolean {
|
||||
n.let {
|
||||
return <caret>1
|
||||
|
||||
Vendored
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'Int'" "true"
|
||||
fun foo(n: Int): Int {
|
||||
n.let {
|
||||
return 1
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'Int'" "true"
|
||||
fun foo(n: Int): Boolean {
|
||||
n.let {
|
||||
return@foo <caret>1
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'Int'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'Int'" "true"
|
||||
fun foo(n: Int): Int {
|
||||
n.let {
|
||||
return@foo 1
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'boo' to 'String'" "true"
|
||||
// "Change return type of enclosing function 'boo' to 'String'" "true"
|
||||
fun boo(): Int {
|
||||
return ((if (true) {
|
||||
val a = ""
|
||||
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'boo' to 'String'" "true"
|
||||
// "Change return type of enclosing function 'boo' to 'String'" "true"
|
||||
fun boo(): String {
|
||||
return ((if (true) {
|
||||
val a = ""
|
||||
|
||||
Vendored
+1
-1
@@ -1,2 +1,2 @@
|
||||
// "Change return type of current function 'foo' to 'String'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'String'" "true"
|
||||
fun foo(): Int = <caret>""
|
||||
+1
-1
@@ -1,2 +1,2 @@
|
||||
// "Change return type of current function 'foo' to 'String'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'String'" "true"
|
||||
fun foo(): String = ""
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'String'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'String'" "true"
|
||||
fun foo() {
|
||||
return ""<caret>
|
||||
}
|
||||
+1
-1
@@ -1,4 +1,4 @@
|
||||
// "Change return type of current function 'foo' to 'String'" "true"
|
||||
// "Change return type of enclosing function 'foo' to 'String'" "true"
|
||||
fun foo(): String {
|
||||
return ""<caret>
|
||||
}
|
||||
Reference in New Issue
Block a user