Commit Graph

7342 Commits

Author SHA1 Message Date
Denis Zharkov 82537cdc8b Add recovery for missing comma between arguments
^KT-13497 Fixed
2019-01-17 14:58:01 +03:00
Denis Zharkov 37614254d7 Fix test on unused import suppression
Before the fix for KT-7185, the file looked like:
package suppression
@file:Suppress("UnusedImport")

import java.io.* // unused

And it was parsed incorrectly, because @file: annotations
should come before package directive
But after fix, import directives started being parsed that lead
to wrong unused import (because suppression wasn't parsed still)
2019-01-17 14:56:42 +03:00
Mikhail Glukhikh 40b88d874e Fix broken test (KT-18715) 2019-01-17 10:41:31 +03:00
Felix Guo a71bb70901 KT-18715: don't swallow comments for if->elvis
Adds a CommentSaver to the IfThenToElvis intention that will save and
restore comments when converting an if expression to elvis expression.
2019-01-16 09:41:06 +03:00
Vyacheslav Gerasimov 13d87e8eae Remove as31 bunch files 2019-01-14 21:29:02 +03:00
Vyacheslav Gerasimov 818910267e Remove 173 bunch files 2019-01-14 21:29:02 +03:00
Mikhail Glukhikh 6e369e156d FIR: implements multi-module resolve, add tests #KT-24093 Fixed
This commit introduces FIR session provider, dependency provider,
library session + other infrastructure necessary for multi-module resolve
2019-01-11 09:55:40 +03:00
Denis Zharkov 2b40ecfd29 Fix exception in ultra-light classes in case of complex mpp hierarchy
Without the introduced override, default implementation of isEquivalentTo
runs delegate computation of `another` that is illegal
for KtUltraLightClass

^KT-28912 Fixed
2019-01-10 14:11:20 +03:00
Mikhail Glukhikh 18ea86cfb4 Remove parentheses: add semicolon before lambda if necessary
In 2010b175, it was suggested just not to suggest parentheses removal.
However, it contradicts with behaviour of "Replace contains" which
adds semicolon before lambda in this case. So in this commit I made
behaviour of remove parentheses the same.

This commit reverts production part of 2010b175
Fixes failing test of "replace contains"
2019-01-10 10:45:46 +03:00
Toshiaki Kameyama f389c31d8e Replace with binary operator: don't highlight when receiver is dynamic type
#KT-28773 Fixed
2019-01-09 12:17:40 +03:00
Toshiaki Kameyama 2010b1756e Remove unnecessary parentheses: don't suggest when parentheses are for lambda 2019-01-09 12:16:01 +03:00
Toshiaki Kameyama 05d8932fa6 Remove useless cast: don't remove parentheses for lambda
#KT-28641 Fixed
2019-01-09 12:16:01 +03:00
Toshiaki Kameyama d02867a831 Add "Wrap with array literal" quick fix for annotation parameters
#KT-28969 Fixed
2019-01-09 12:12:27 +03:00
Toshiaki Kameyama 53b0aa5813 "Wrap element with arrayOf() call": don't suggest for annotation parameters
#KT-28969 Fixed
2019-01-09 12:12:27 +03:00
Nicolay Mitropolsky 41b6bcf8c3 Converting object literal to class allows to choose a name (KT-19254) 2019-01-09 11:12:47 +03:00
Toshiaki Kameyama 3040a2b145 Add quickfix for RETURN_TYPE_MISMATCH_ON_OVERRIDE
#KT-27972 Fixed
2018-12-29 10:41:14 +03:00
Vyacheslav Gerasimov 343560c533 181: Fix QuickFixTestGenerated$TypeMismatch.testParamTypeLambdaMismatch 2018-12-28 19:01:39 +03:00
goodsauce 72be9ef738 #KT-27670 Add quick fix: wrap expression in a lambda if compatible functional type is required (#2010) 2018-12-27 20:12:10 +03:00
Mikhail Glukhikh 8de2ff2163 Improve expect / actual markers on one line
Before this commit, only one-line enums and annotation classes were
considered. Now we can have enum header on one line and
some entries on another lines, and it still works.
Same with primary constructor parameters.

#KT-22637 Fixed
2018-12-27 19:45:28 +03:00
Mikhail Glukhikh cdef811c55 Do not report "redundant arrow" with parameters without expected type
#KT-29049 Fixed
Part of KT-29005
2018-12-27 19:21:34 +03:00
Nikolay Krasko 5a40fc8679 Add UI options for comments generation (KT-5590)
#KT-5590 Fixed
2018-12-26 21:10:03 +03:00
kenji tomita 7b43d5c972 Add inspection for converting !collection.isEmpty() -> isNotEmpty()
#KT-27556 Fixed
2018-12-26 19:25:14 +03:00
Toshiaki Kameyama 538a746df9 Introduce "Function with = { ... }" inspection
#KT-17119 Fixed
2018-12-26 19:14:06 +03:00
Toshiaki Kameyama 301b3aad06 Condition of 'if' expression is constant: report enum entries comparison
#KT-28803 Fixed
2018-12-26 19:04:22 +03:00
Mikhail Glukhikh 8420fceb8c Support '.toType()' and literal fixes related to unsigned type mismatch
#KT-26836 Fixed
2018-12-26 18:21:49 +03:00
Mikhail Glukhikh 73b6148407 Do not suggest cast for SIGNED_CONSTANT_CONVERTED_TO_UNSIGNED
Related to KT-27590
2018-12-26 18:21:49 +03:00
Mikhail Glukhikh d7ce79cc76 Suggest quick-fixes for SIGNED_CONSTANT_CONVERTED_TO_UNSIGNED
#KT-27590 Fixed
2018-12-26 18:21:49 +03:00
Natalia Selezneva 6eff314b9d Script tests: check that script is highlighted 2018-12-26 16:56:49 +03:00
Natalia Selezneva 2fbbf2400d Refactoring: unify methods to report errors in scratches 2018-12-26 16:56:48 +03:00
Nikolay Krasko 571ee4a1fe Don't ruin indentation for comments inside expression declarations (KT-23295)
#KT-23295 Fixed
2018-12-26 15:39:40 +03:00
Mikhail Glukhikh a9147ff446 More tests for KT-28997, fix isLocal for anonymous object in script 2018-12-26 12:53:25 +03:00
Mikhail Glukhikh 661ac711c0 Fix light class generation for local classes in scripts
Before this commit, we used script context for all classes
defined in script. However, for local classes in scripts it's mistake,
and now we generate them as usual, despite of the fact we are in script.

#KT-28997 Fixed
2018-12-26 12:53:24 +03:00
Natalia Selezneva 816a8d74a2 Fix order of initialization of project language version in ConfigureKotlinTest
Project.getLanguageVersion with contextModule == null returns latest stable version.
But Module.getLanguageVersion save it's version to project setting if useProjectSettings checkbox is selected.
So Project.getLanguageVersion can return different versions before and after invocation Module.getLanguageVersion
2018-12-25 15:32:25 +03:00
Toshiaki Kameyama d00236d366 "Remove redundant backticks": Fix false positive for underscore
#KT-28592 Fixed
2018-12-25 10:37:18 +03:00
Simon Ogorodnik 68c65a5014 KT-25156: Fix stack overflow on top level destructuring with lambda init
Support destructuring in additional resolve pass (resolveToElements)
 #KT-25156 Fixed
2018-12-24 18:29:48 +03:00
Simon Ogorodnik fefd2bf427 KT-23268: Highlight destructuring declaration entries as properties
#KT-23268 Fixed
2018-12-24 18:29:47 +03:00
Mikhail Zarechenskiy e4a4d1169e Prohibit JvmOverloads on constructors of annotation classes
In LV >= 1.4 & -progressive

 #KT-25702 Fixed
2018-12-24 12:48:00 +03:00
Mikhail Zarechenskiy 958aeff94b Prohibit type parameters for local variables in LV >= 1.4 & -progressive
#KT-8341 Fixed
2018-12-24 12:47:58 +03:00
Marcin Moskala 686cfa6fd2 Fix common misspellings 2018-12-21 16:13:42 +03:00
Mikhail Glukhikh ca3d758fba Create expect/actual class: fix inline class generation
#KT-28744 Fixed
#KT-28745 Fixed
2018-12-19 19:55:56 +03:00
Mikhail Glukhikh 8f821c9ef5 Merge pull request #2033 from t-kameyama/KT-28699
KT-28699 Add "Convert to also" intention
2018-12-18 09:37:34 +03:00
Toshiaki Kameyama f2cf3a8e7b Replace with binary operator: don't suggest for non-operator function
#KT-12273 Fixed
2018-12-18 09:30:38 +03:00
Toshiaki Kameyama ea0f9d124d Split property declaration: don't add parentheses for anonymous function
#KT-7593 Fixed
2018-12-18 09:28:57 +03:00
Toshiaki Kameyama 6a4c6eacd7 Add "Convert to also" intention
#KT-28699 Fixed
2018-12-18 12:21:56 +09:00
Nikolay Krasko 0482fe9414 Move check with selection tags to base check 2018-12-13 12:36:02 +03:00
shiraji 06dad5f45b Surround with try/catch should generate more Kotlin-style code (KT-5435)
#KT-5435 Fixed
2018-12-13 12:36:02 +03:00
Nikolay Krasko 5fb90a8a81 Better caret position after Insert curly braces around variable (KT-28739)
Introduce helper class and move caret to it's original position.

 #KT-28739 Fixed
2018-12-13 12:36:01 +03:00
Mikhail Glukhikh a15b47c93c Add "Ambiguous context due to scope receiver in suspend fun" inspection
#KT-28696 Fixed
2018-12-12 17:10:37 +03:00
Mikhail Glukhikh 13b09f532c Boolean literal arguments: check previous arg, fix all args in a row 2018-12-12 15:56:12 +03:00
Mikhail Glukhikh d31e0b9632 Boolean literal arguments: don't report on a call, just on an element 2018-12-12 15:56:12 +03:00