Commit Graph

50148 Commits

Author SHA1 Message Date
Toshiaki Kameyama 4ae837e669 Redundant lambda arrow: fix false positive in 'when/if' without block #KT-28047 Fixed 2018-11-08 10:40:02 +03:00
Toshiaki Kameyama 0bfcfb5716 ProtectedInFinalInspection: don't report for finalize() method #KT-13311 Fixed 2018-11-08 10:37:36 +03:00
Toshiaki Kameyama b935f52a63 ProtectedInFinalInspection: reformat 2018-11-08 10:37:36 +03:00
Toshiaki Kameyama 9c18e24de5 Change to function invocation fix: use parentheses in string template
#KT-5071 Fixed
2018-11-08 10:33:50 +03:00
Timo Obereder 3c75d46328 Correctly handle end-of-line comment in "Add braces to if"
#KT-27408 Fixed
2018-11-08 10:33:15 +03:00
Alexander Udalov 61d3b6ee1f Restore heuristic to compute inner class names in ClassifierResolutionContext
This commit restores the heuristic removed in 9df02b2366, but only
enables it in case the class wasn't found with the name mapped initially
according to the InnerClasses attribute values. This helps to support
class files which do not have the InnerClasses attribute for all nested
referenced classes, such as those generated by Groovy.

Note that in theory it's still possible for this code to behave
incorrectly, for example a reference to a class `C` nested in a
_top-level_ class named `A$B` will not be loaded by this code correctly.
This is a lower-priority issue and it will need to be fixed later.

 #KT-27874 Fixed
2018-11-07 18:12:58 +01:00
Alexander Udalov a3231e561c Remove unneeded name-handling code in ClassifierResolutionContext
The only place where a name with dots was passed to
ClassifierResolutionContext.mapInternalNameToClassId was in
BinaryClassSignatureParser.parseParameterizedClassRefSignature, where
for some reason names can be both of internal (`a/b$c`) and canonical
(`a/b.c`) form. Supporting both names in mapInternalNameToClassId was
confusing because JVM internal names cannot contain dots. Replace dots
with dollars in parseParameterizedClassRefSignature to get rid of the
dot-name handling in mapInternalNameToClassId and rely on the correct
(simplified) InnerClasses-based name resolution later instead.

Also inline mapDescToClassId to its only usage.
2018-11-07 18:12:58 +01:00
Georgy Bronnikov c20f93ddbf Mute failing test 2018-11-07 19:09:15 +03:00
Georgy Bronnikov dbfbfa65a6 Remove IrClass.isFileClass as unneeded 2018-11-07 19:09:15 +03:00
Georgy Bronnikov a814e4a314 IR. Remove ClassLowerWithContext
The code is never used and shows some signs of bit rot.
2018-11-07 19:09:15 +03:00
Georgy Bronnikov 1aec16ca29 JVM_IR. Remove FileClassDescriptor, no longer used 2018-11-07 19:09:15 +03:00
Georgy Bronnikov 0a43054a92 JVM_IR. Remove descriptors from FileClassLowering 2018-11-07 19:09:15 +03:00
Georgy Bronnikov 95fbe29350 JVM_IR: remove descriptors from JvmCoercionToUnitPatcher 2018-11-07 19:09:15 +03:00
Toshiaki Kameyama c9477d94ad Replace if with when: fix behavior on 'else if' #KT-4645 Fixed 2018-11-07 19:02:11 +03:00
Dmitry Petrov 1523185734 KT-27948: Use proper KotlinType when comparing with literal 0
#KT-27948
2018-11-07 18:17:29 +03:00
Dmitry Petrov e14f74bc18 KT-27948: Properly coerce values when generating areEqual call
#KT-27948
2018-11-07 18:17:29 +03:00
Dmitry Petrov ac7cc0c08e KT-27706: Dispatch receiver type for constructor accessor is Object 2018-11-07 18:17:29 +03:00
Dmitry Petrov ea4afdaebe KT-27705: Use proper types for captured outer class instance
Call typeMapper only if we have an inline class.
2018-11-07 18:17:29 +03:00
Mikhael Bogdanov 60986293bf Minor. Use until in for iterator 2018-11-07 15:42:58 +01:00
Mikhael Bogdanov d2a205c72d Update synthetic parameter processing logic according to ASM 7 changes
#KT-27774 Fixed
2018-11-07 15:42:57 +01:00
Toshiaki Kameyama 23b9889ebb Redundant companion reference: Fix false negative in enum entry #KT-27861 Fixed 2018-11-07 17:21:41 +03:00
Monchi 07ca958ff0 Add the quickfix to add property to supertype #KT-17004 Fixed 2018-11-07 17:00:26 +03:00
Simon Ogorodnik aa8031691e Fix picocontainer version 2018-11-07 15:16:39 +03:00
Toshiaki Kameyama 0fcd1a2072 Introduce "Delegate to 'var' property" inspection #KT-26724 Fixed 2018-11-07 13:59:00 +03:00
Alexander Udalov 17d740a373 Do not try computing return type in OverloadChecker
Return type is not needed for checking overloads, but querying it may
involve resolving function bodies, which usually happens after overload
checking (see LazyTopDownAnalyzer.analyzeDeclarations) and at this point
can lead to incorrect BACKING_FIELD_REQUIRED value being computed for
some properties (see KT-27895)

 #KT-27895 Fixed
2018-11-07 11:00:15 +01:00
Anton Bannykh 829bdf6061 JS: fix noInline version of inline suspend fun (KT-27611 fixed) 2018-11-07 12:34:00 +03:00
Toshiaki Kameyama 455db32199 "Remove parameter" quick fix: remove also type constraint
#KT-26673 Fixed
2018-11-07 12:20:35 +03:00
Anton Bannykh 59009430e5 JS: report inline suspend functions to IC
* Also inline suspend lambda'a
* Also use correct JsName's in exported suspend inline fun's
* Also use less unused imports
2018-11-07 12:11:01 +03:00
Anton Bannykh 82268cd95d JS: fix concurrent access to NameSuggestion.cache 2018-11-07 12:07:58 +03:00
Anton Bannykh 5dae00182d JS: fix suspend lambda inlining
* Also avoid casts when setting inline metadata
2018-11-07 12:07:02 +03:00
Anton Bannykh 4c5201d30e JS: fix module parameter linking 2018-11-07 12:06:09 +03:00
Mikhail Glukhikh da02acd6e9 Fix flaky "plugin & stdlib versions different" #KT-23744 Fixed
Before this commit, kotlin-stdlib-common or -jdk8 can be accidentally
detected as kotlin-stdlib with the following strange version resolve.
Now we check for dash after name, so it's not possible.
2018-11-07 11:56:55 +03:00
Mikhail Glukhikh fcfeb33501 Don't suggest "Implement as constructor parameters" in actual class
This applies if expect class has primary constructor declared
#KT-27791 Fixed
2018-11-07 11:56:55 +03:00
Mikhail Glukhikh 63856cff1b Fix failing GradleImportingTestCase-based tests in 183 #KT-28026 Fixed
To fix this, we say explicitly not to use qualified module names option
during Gradle import

Related to IDEA-201249
2018-11-07 11:56:55 +03:00
Mikhail Glukhikh e597dda526 AndroidViewConstructorFix: do not reformat while creating constructor
Before this commit, it was done by createDeclarationByPattern,
preventing later reformatting in addAnnotation

Related to KT-27945
2018-11-07 11:56:54 +03:00
Toshiaki Kameyama d0d98dc283 Redundant companion reference: fix false positive for class with name Companion #KT-27861 Fixed 2018-11-07 11:53:22 +03:00
Bradley Smith 4b8f8604f2 Change kotlinSourceSets -> allKotlinSourceSets
This ensures that transitive SourceSets are also merged and included in
the model.
2018-11-06 20:19:02 +03:00
Bradley Smith f426fda18b Remove unused inport 2018-11-06 20:19:02 +03:00
Bradley Smith 1e37785de1 Populate the SourceSets with more relevant information. 2018-11-06 20:19:02 +03:00
Bradley Smith f3482d1251 Register KotlinModelBuilder for kotlin-android plugin 2018-11-06 20:19:02 +03:00
Dmitry Savvinov 939b58f8f4 Fix testdata to incorrect to keep local testruns green
This test was originally written with fix for KT-22379

Lately, fix was proven to be wrong and reverted (KT-27084), which made
this test fail.

Correct solution here would be to mute test with link to YT issue, but
unfortunately we don't have infrastructure to mute tests locally (yet),
which is a major issue because this tests is a part of very popular for
local smoke-testing test suite (DiagnosticTestsGenerated).
2018-11-06 19:29:28 +03:00
Leonid Startsev facd2d7aec Call Gradle import handlers when importing Gradle modules from new mpp plugin
This enables serialization and other plugins in IDE with new mpp
2018-11-06 16:21:32 +03:00
Simon Ogorodnik 3590d534e5 KT-24788: Fix exceptions in offline inspections
When there is severe memory load SLRUCache inside getResolutionFacade
may cause double computation of ResolutionFacade, thus will cause
moduleDescriptor to be recreated, and it will be different from one
that is stored in declarationDescriptor
Newer resolutionFacade will actually not built for old moduleDescriptor
and will cause exception

 #KT-24788 fixed
2018-11-06 15:49:01 +03:00
Nikolay Krasko 6c67cb3d7f Prioritize failure in expect file over stub validation problem in tests 2018-11-06 13:43:24 +03:00
Nikolay Krasko 6dcc3374fe Get string entries from stubs (KT-23738) 2018-11-06 13:43:23 +03:00
Nikolay Krasko 359e16eb82 Get argument name from stubs if possible (KT-23738) 2018-11-06 13:43:22 +03:00
Nikolay Krasko 3f53f9d9fb Allow storing dot qualified expression in annotations arguments (KT-23738) 2018-11-06 13:43:21 +03:00
Nikolay Krasko a794d26493 Get stubbed expressions in value arguments (KT-23738) 2018-11-06 13:43:20 +03:00
Nikolay Krasko a9c3b27d3e Don't generate stub for value arguments list when no arguments present (KT-23738)
Need this to conform stubs list obtained by decompiler.
Also ignore green stub, because is might not contain actual psi node.
2018-11-06 13:43:19 +03:00
Nikolay Krasko efa59bfc7e Make stubs for string entries (KT-23738) 2018-11-06 13:43:17 +03:00