Commit Graph

94 Commits

Author SHA1 Message Date
Toshiaki Kameyama cbbdec5898 Change Signature: enable on primary constructor keyword (#2482)
#KT-19744 Fixed
2020-06-11 12:10:12 +03:00
Toshiaki Kameyama 82d81d5223 Change Signature: move lambda outside of parentheses if the arguments are reordered so that the lambda goes last
#KT-30128 Fixed
2020-05-15 17:58:33 +02:00
Dmitry Gridin 11a3482970 tests: apply official code style
#KT-38632 Fixed
2020-05-07 12:36:44 +00:00
Valentin Kipyatkov 88cd129549 Fixed other parameter references broken in new parameter values in conventional Change Signature 2020-04-07 22:17:04 +03:00
Toshiaki Kameyama f487118be5 Change signature: fix it works correctly when call site function has no value argument list
#KT-23510 Fixed
2020-02-22 09:07:34 +01:00
Dmitry Gridin c34b417d0c Fix tests after disabling trailing comma
#KT-34744
2020-02-04 21:34:53 +07:00
Dmitry Gridin d06787886a Fix tests after implementing trailing comma in formatter
#KT-34744
2020-01-17 21:02:54 +07:00
Toshiaki Kameyama 6f7830a4b2 Make public: reformat after removing primary constructor visibility modifier
#KT-29444 Fixed
2019-02-09 02:56:14 +03:00
Denis Zharkov 91c86f7f56 Fix refactorings that remove parameter based on ultra-light classes
This commit fixes the exception attached to the bottom of the message
The problem is that when creating ChangeSignatureProcessor for old PsiMethod
that points to the parameter that is already removed from PSI, some pieces
of platform code run resolution on the light PSI that eventually checks
if the source element is valid.

For KtUltraLightParameter, it inherits "isValid" from LightElement and
the latter is defined as getNavigationElement().isValid(),
while here navigationElement points to already removed parameter,
and marked as invalid.

The simplest solution was to define KtUltraLightParameter::isValid
as it was before ultra-light classes, i.e. checking if parent is valid
(see KtLightElementBase::isValid)

com.intellij.psi.PsiInvalidElementAccessException: Element: class com.intellij.psi.impl.compiled.ClsJavaCodeReferenceElementImpl #JAVA  because: File language:Language: JAVA != Provider base language:Language: kotlin
invalidated at: no info
	at com.intellij.psi.util.PsiUtilCore.ensureValid(PsiUtilCore.java:482)
	at com.intellij.psi.impl.source.PsiClassReferenceType.resolveGenerics(PsiClassReferenceType.java:190)
	at com.intellij.psi.impl.source.PsiClassReferenceType.resolve(PsiClassReferenceType.java:138)
	at com.intellij.psi.util.PsiUtil.resolveClassInType(PsiUtil.java:445)
	at com.intellij.psi.util.PsiUtil.convertAnonymousToBaseType(PsiUtil.java:484)
	at com.intellij.psi.impl.light.LightTypeElement.<init>(LightTypeElement.java:33)
	at com.intellij.psi.impl.PsiElementFactoryImpl.createTypeElement(PsiElementFactoryImpl.java:142)
	at com.intellij.refactoring.changeSignature.JavaChangeInfoImpl.fillOldParams(JavaChangeInfoImpl.java:218)
	at com.intellij.refactoring.changeSignature.JavaChangeInfoImpl.<init>(JavaChangeInfoImpl.java:127)
	at com.intellij.refactoring.changeSignature.JavaChangeInfoImpl.<init>(JavaChangeInfoImpl.java:86)
	at com.intellij.refactoring.changeSignature.ChangeSignatureProcessor.generateChangeInfo(ChangeSignatureProcessor.java:121)
	at com.intellij.refactoring.changeSignature.ChangeSignatureProcessor.<init>(ChangeSignatureProcessor.java:88)
	at org.jetbrains.kotlin.idea.refactoring.changeSignature.KotlinChangeInfo$getOrCreateJavaChangeInfos$3.invoke(KotlinChangeInfo.kt:400)
	at org.jetbrains.kotlin.idea.refactoring.changeSignature.KotlinChangeInfo$getOrCreateJavaChangeInfos$5.invoke(KotlinChangeInfo.kt:469)
	at org.jetbrains.kotlin.idea.refactoring.changeSignature.KotlinChangeInfo.getOrCreateJavaChangeInfos(KotlinChangeInfo.kt:498)
	at org.jetbrains.kotlin.idea.refactoring.changeSignature.KotlinChangeSignatureUsageProcessor.processUsage(KotlinChangeSignatureUsageProcessor.kt:847)
	at com.intellij.refactoring.changeSignature.ChangeSignatureProcessorBase.doChangeSignature(ChangeSignatureProcessorBase.java:218)
2018-11-26 11:36:25 +03:00
Alexey Sedunov 8a838ab5bb Change Signature: Fix parameter name for kt-function overriding Java's
#KT-24763 Fixed
2018-06-08 14:34:23 +03:00
Alexey Sedunov fddfbf225f Change Signature: Support implicit calls of 'invoke' and 'get'
Also drop 'operator' keyword when necessary

 #KT-22718 Fixed
2018-02-09 14:17:37 +03:00
Alexey Sedunov 354a6cbfd9 Change Signature: Keep parameter 'val'/'var' when invoked from Java
#KT-20901 Fixed
 #KT-21159 Fixed
2017-11-30 12:49:24 +03:00
Alexey Sedunov f455f06a9e Change Signature: Fix replacement of implicit Unit return type 2017-08-15 19:08:25 +03:00
Dmitry Petrov c83b764c73 Update testData after changes in diagnostics 2017-05-26 13:58:46 +03:00
Alexey Sedunov f70bac019a Change Signature: Fix TypeInfo comparison
#KT-13437 Fixed
2017-05-10 14:49:53 +03:00
Alexey Sedunov b80fbe1192 Change Signature: Avoid creating parameters from scratch
#KT-15519 Fixed
2017-04-21 13:32:32 +03:00
Alexey Sedunov e79a7d3e94 Change Signature: Update test data 2017-04-17 23:00:20 +03:00
Dmitry Jemerov 159c2382b4 Convert KotlinChangeSignatureTest to light test case 2017-03-27 19:45:50 +02:00
Alexey Sedunov bab762b761 Implement post-refactoring optimization of unused imports
#KT-15822 Fixed
 #KT-13755 Fixed
2017-03-22 13:36:11 +03:00
Alexey Sedunov 59a714ca5c Presentation: Render function signature in RefactoringDescriptionLocation
#KT-12943 Fixed
2016-08-10 11:45:29 +03:00
Nikolay Krasko b107bc401c Formatter: Don't enforce empty line between secondary constructors without body (KT-12175)
#KT-12175 Fixed
2016-05-12 17:26:54 +03:00
Alexander Udalov 994dc46bcd Write nullability annotations on extension receiver parameters
#KT-5429 Fixed
2016-03-11 15:20:32 +03:00
Alexey Sedunov 8e81d0ce5f Change Signature: Skip implicit receiver references if extension receiver is dropped 2016-02-11 14:25:22 +03:00
Alexey Sedunov a9ddc4da1a Change Signature: Warn about safe call receiver being transformed to value argument
#KT-8744 Fixed
2016-02-11 14:25:16 +03:00
Alexey Sedunov b3801ffac7 Change Signature: Fix implicit receiver ->argument convertion in recusrive calls
#KT-8744 In Progress
2016-02-11 14:25:04 +03:00
Alexey Sedunov 2895e2e86f Change Signature: Process implicit usages of data class 'componentN' functions
#KT-9393 Fixed
2015-12-25 18:50:48 +03:00
Alexey Sedunov 784b250de8 Change Signature: Fix rendering of unresolved types in overriding members 2015-12-18 15:05:39 +03:00
Yan Zhulanow a3ff3ffc45 Fix tests: "Placing function type parameters after the function name" error 2015-11-27 15:51:11 +03:00
Alexey Sedunov 6ff955b66c Change Signature: Implement improved call processing algorithm
#KT-8953 Fixed
 #KT-9525 Fixed
2015-11-10 16:47:48 +03:00
Alexey Sedunov 2476393754 Change Signature: Do not move lambda out of parentheses if it neither wasn't out
before nor corresponds to the last parameter after the refactoring
 #KT-9763 Fixed
2015-11-10 16:47:42 +03:00
Alexey Sedunov f5e9d3e58f Refactoring: Simplify JetChangeSignature test 2015-11-10 16:47:41 +03:00
Alexey Sedunov 5e223927ea Change Signature: Match calls of different overloads generated due to @JvmOverloads annotation
#KT-9020 Fixed
2015-11-02 15:15:43 +03:00
Alexey Sedunov 7ce6f58c27 Change Signature: Constraint indices of parameters generated for overloaded versions of function with @JvmOverloads annotation
#KT-9762 Fixed
2015-11-02 15:15:40 +03:00
Alexey Sedunov 6a72b51677 Change Signature: Run tests with Kotlin stdlib 2015-11-02 15:15:39 +03:00
Alexey Sedunov b9ed3b91be Change Signature: Fix descriptor comparison when receiver type is changed
#KT-9201 Fixed
2015-11-02 15:15:33 +03:00
Alexey Sedunov 937b8725c6 Change Signature/Rename: Fix processing of named arguments when renaming parameter of extension function
#KT-8605 Fixed
2015-11-02 15:15:32 +03:00
Alexey Sedunov 8d3296e08d Change Signature: Search & process as-property usages of Java methods (This ixes some muted tests on Change Signature for properties).
Improve test data
2015-10-24 19:50:55 +03:00
Pavel V. Talanov 2e1967eb84 Fix test data for change signature test
(cherry picked from commit 8d420f1)
2015-10-19 16:03:18 +03:00
Denis Zharkov f0e3fd617d Adjust testData to CharSequence.length transformation 2015-10-14 20:39:35 +03:00
Denis Zharkov 1d90b2e1fe Get rid of obsolete syntax in quickfixes changing lambda's signature
- Do not wrap parameters with '()'
- Do not set return type for them
- Fix existing testData
2015-09-25 08:29:26 +03:00
Alexey Sedunov 708f7fc51f Change Signature: Fix processing of top-level declarations usages in Java (old/new package facades are supported) 2015-09-14 18:05:06 +02:00
Alexey Sedunov 794127a38b Change Signature: Add/remove constructor keyword on primary constructor when changing modifier list 2015-09-11 02:20:46 +03:00
Michael Nedzelsky ce77ac4991 fix tests in org.jetbrains.kotlin.idea.refactoring.changeSignature 2015-09-08 02:05:49 +03:00
Alexey Sedunov a085c93b5e Light Classes: Fix computation of base type in anonymous light class 2015-08-19 23:30:13 +03:00
Mikhail Glukhikh b87bbfc3e0 Deprecated enum syntax removed: change signature tests 2015-08-10 16:24:04 +03:00
Mikhail Glukhikh fe716d7e56 Change signature fix: correct parameter add / remove from enum constructor calls, relevant test fixes 2015-08-10 16:23:57 +03:00
Nikolay Krasko cac62fe4c8 Test fix after idea update 2015-07-17 20:59:07 +03:00
Alexey Sedunov a96bd546a1 Change Signature: Avoid explicit Unit return type 2015-07-09 20:47:51 +03:00
Alexey Sedunov eb7463ed81 Change Signature: Propagate parameters to chosen callers
#KT-7902 Fixed
2015-07-09 20:47:48 +03:00
Alexey Sedunov 0169963a27 Change Signature: Process internal usages of function parameters when
performing Java refactoring
2015-07-09 17:56:44 +03:00