From f50851a982efd22833a9735b986045648440f486 Mon Sep 17 00:00:00 2001 From: Dmitry Savvinov Date: Mon, 5 Oct 2020 17:45:41 +0300 Subject: [PATCH] Fix testdata after migrating to NewKotlinTypeCheckerImpl in OverrideResolver - In kt10409 both 'pipe'-declarations contain error type. NewKotlinTypeChecker in OverrideResolver considers error types as equal, thus they are matched as bound declarations, thus 'IterablePipeline' isn't considered to contain abstract member, thus no suggestion to add abstract modifier. Because initially test was covering purely technical issue of working with error types, instead of removing it completely the additional abstract member has been added - in kt10808 we don't add explicit type anymore because 'noTypeInference' is false, because both expected type and actual type are error-types, and KotlinIntroduceVariableHandler explicitly uses type checker with 'errorTypesEqualToAnything=false'. Also, this change might be ultimately seen as small improvement, because if one extracts something with error type, they would certainly prefer it to have a proper type as soon as errors are resolved (i.e. additional code/imports written), rather than having a useless Any-type. --- idea/testData/quickfix/modifiers/kt10409.kt | 2 +- idea/testData/quickfix/modifiers/kt10409.kt.after | 2 +- idea/testData/refactoring/introduceVariable/kt10808.kt.after | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/idea/testData/quickfix/modifiers/kt10409.kt b/idea/testData/quickfix/modifiers/kt10409.kt index 5e68ca30c30..91dd01b4684 100644 --- a/idea/testData/quickfix/modifiers/kt10409.kt +++ b/idea/testData/quickfix/modifiers/kt10409.kt @@ -1,11 +1,11 @@ // "Make 'IterablePipeline' 'abstract'" "true" -// ERROR: 'pipe' overrides nothing // ERROR: One type argument expected for interface Pipeline // Actually this test is about getting rid of assertion happenning while creating quick fixes // See KT-10409 interface Pipeline { fun pipe(block: Pipeline) + fun completelyAbstract() } class IterablePipeline : Pipeline { diff --git a/idea/testData/quickfix/modifiers/kt10409.kt.after b/idea/testData/quickfix/modifiers/kt10409.kt.after index 08373b24e68..cc76df5c1b0 100644 --- a/idea/testData/quickfix/modifiers/kt10409.kt.after +++ b/idea/testData/quickfix/modifiers/kt10409.kt.after @@ -1,11 +1,11 @@ // "Make 'IterablePipeline' 'abstract'" "true" -// ERROR: 'pipe' overrides nothing // ERROR: One type argument expected for interface Pipeline // Actually this test is about getting rid of assertion happenning while creating quick fixes // See KT-10409 interface Pipeline { fun pipe(block: Pipeline) + fun completelyAbstract() } abstract class IterablePipeline : Pipeline { diff --git a/idea/testData/refactoring/introduceVariable/kt10808.kt.after b/idea/testData/refactoring/introduceVariable/kt10808.kt.after index a961a39c8a6..4d4c5582164 100644 --- a/idea/testData/refactoring/introduceVariable/kt10808.kt.after +++ b/idea/testData/refactoring/introduceVariable/kt10808.kt.after @@ -1,6 +1,6 @@ fun main(args:Array) { val old = pref.getString("", "") pref.edit().putString("", "").apply() - val instance: Any = LocalBroadcastManager.getInstance(this) + val instance = LocalBroadcastManager.getInstance(this) instance.sendBroadcast(Intent("")) } \ No newline at end of file