Commit Graph

8997 Commits

Author SHA1 Message Date
Toshiaki Kameyama 1cd438c3f7 Add inspection "main should return Unit" #KT-16085 Fixed 2018-04-18 10:59:23 +03:00
Mikhail Zarechenskiy c216749eb6 [NI] Fix substitutor for anonymous types with captured type parameters 2018-04-17 16:06:55 +03:00
Mikhail Zarechenskiy 3318549622 [NI] Fix smartcasts computation for dot-qualifier expressions 2018-04-16 18:13:12 +03:00
Alexey Sedunov c7e72af170 Override/Implement Members: Copy @Experimental-annotated annotations
#KT-22922 Fixed
2018-04-13 20:23:06 +03:00
Mikhail Zarechenskiy 612baacc25 Make useless elvis diagnostic more consistent for new and old inference
Also, remove diagnostics that can be covered by usual USELESS_ELVIS diagnostic
2018-04-12 14:38:55 +03:00
Felix Guo 9539212180 Take Java source file into account in "Add annotation target"
So #KT-22860 Fixed
2018-04-11 17:00:37 +03:00
Vyacheslav Gerasimov 8d3f71a04f 172: Revert "Quick Fixes: Support cross-language "Create from Usage" with Kotlin target"
This reverts commit 908bf71
2018-04-11 16:28:09 +03:00
Ilmir Usmanov 2cfe387bab Move coroutines to kotlin.coroutines package: compiler
Generate continuation type as kotlin.coroutines.Continuaion. This code will
fail at runtime since there is no stdlib backing this change yet.
However, in order to generate compatible stdlib we need a compiler, which
generates continuation type as kotlin.coroutines.Continuation.
Thus, firstly we support the change in the compiler, make it bootstrap
compiler and only then change stdlib and tests accordingly.
 #KT-23362
2018-04-10 22:51:46 +03:00
Dmitry Savvinov 8d2f806c6b Minor: extract rendering of type variable into a method 2018-04-10 10:47:22 +03:00
Dmitry Savvinov e450da8b63 Introduce EXTRA_VERBOSE mode for rendring ConstraintSystem
Use it for 'missing upperBoundViolatedError' debug message
2018-04-10 10:47:22 +03:00
Dmitry Savvinov 00c55c4f55 Minor: extract rendering of type bound into method 2018-04-10 10:47:22 +03:00
Dmitry Savvinov 30948269dd Minor: use enum for determining verbosity of ConstraintSystem render 2018-04-10 10:47:22 +03:00
Dmitry Savvinov d8b7de4f0e Add extra diagnostic information when no common supertypes are found
We're suspecting that the culprit of such errors is race condition on
'supertypes' in AbstractTypeConstructor, when it is created using
'LockBasedStorageManager.NO_LOCKS'
2018-04-10 10:47:22 +03:00
Ilmir Usmanov bd0ad26dcf Support local suspend functions
Treat them like lambdas. This means:
1) Like local suspend lambdas, which become "non-suspend" after creating
jvmSuspendView, they do this as well
2) They both are generated with the same codegen.
3) They are treated differently only on front-end side.
 #KT-20364: Fixed
2018-04-06 19:11:19 +03:00
Alexander Udalov 89af94be95 Report warning (1.2) or error (1.3) on local annotations
#KT-23277 Fixed
 #KT-23589 Fixed
2018-04-06 14:17:32 +02:00
Ilya Chernikov 00320bad8d Implement support for additional receivers in the backend 2018-04-04 16:23:56 +02:00
Ilya Chernikov 87de1dff03 Implement support for additional receivers for script in frontend 2018-04-04 16:23:56 +02:00
Ilya Chernikov d05f67127d Move scripting configuration into compiler plugin 2018-04-04 16:23:55 +02:00
Mikhael Bogdanov 3f5fea05de Write 'RequireKotlin' annotation on @JvmDefault members 2018-04-03 19:18:17 +02:00
Yan Zhulanow 2b0489529d Fix compatibility for compiler API in DeclarationAttributeAltererExtension (EA-114961) 2018-04-02 19:14:52 +03:00
Mikhail Zarechenskiy e1d75d5581 Migration fixes for new inference 2018-03-30 20:39:55 +03:00
Mikhail Zarechenskiy aebcb61402 Resolve elements in chain of qualifier expression without expected type
Consider call chain `foo.bar.baz()` which has expected type `Int`
Elements `foo` and `bar` doesn't have expected type `Int`,
this is especially important in NI, because we use expected type for
candidate applicability
2018-03-30 14:51:07 +03:00
Alexander Udalov 5d9348eea1 Sanitize compiler version for version requirement checks
Strip everything after (and including) the first '-' character.

The previous approach of skipping the checks if "SNAPSHOT" is in the
version, is subsumed by the new one because "1.2-SNAPSHOT" now becomes
"1.2" with regards to the version requirement checks, which allows the
compiler to use the 1.2-only API
2018-03-29 17:12:18 +02:00
Mikhail Zarechenskiy e70162771d [NI] Fix exception from IDE completion
Fake arguments that are created for completion might have missing PSI parts (see `DummyArgument`)
2018-03-29 13:13:39 +03:00
Dmitry Jemerov 20cd193030 Delete remains of external annotations support from compiler 2018-03-29 09:45:07 +02:00
Dmitry Savvinov 5b216a0270 Don't throw exception on recursion for class header scope
The root issue here is that when we have some cycle in scopes, the place
where we detect a loop depends on where we've entered that cycle.

Previously, we didn't know about cases where we enter scopes loop
through `ClassResolutionScopesSupport.scopeForClassHeaderResolution` =>
there were no need to handle recursion on `scopeForClassHeaderResolution`
carefully.

It seems that in some very narrow cases (launch of specific
inspection on specficic code with specific caches state), we do manage
to enter loop exactly through `scopeForClassHeaderResolution` (see
KT-23033), which causes exception.

^KT-23033 Fixed
2018-03-27 12:16:54 +03:00
Dmitry Savvinov 148573fcf6 Remove 'DataFlowValueKindUtils.isStable', use 'DataFlowValue.isStable' instead 2018-03-27 10:51:51 +03:00
Alexander Udalov 13df75ef74 Minor, extract isInstanceType to protoTypeTableUtil 2018-03-26 17:21:08 +02:00
Alexander Udalov f7a3182982 Minor, add default value to contract expression flags 2018-03-26 17:21:07 +02:00
Alexey Tsvetkov 8a82c1618c Use Plugins DSL in Kotlin Gradle scripts
When plugins DSL is used, there is no need to
manually generate typesafe accessors for extensions and
conventions (by running `./gradlew kotlinDslAccessorsSnapshot`).
2018-03-26 16:09:29 +03:00
Mikhail Zarechenskiy 4ed5e2f35e [NI] Improve inference for lambdas that return lambdas 2018-03-26 14:59:52 +03:00
Mikhail Zarechenskiy 3ea0b9975f [NI] Use specialized type of integer value type for delegate receiver 2018-03-25 20:22:38 +03:00
Mikhail Zarechenskiy 3dde31729e [NI] Record information about delegated property as in old inference 2018-03-25 20:22:37 +03:00
Mikhail Zarechenskiy bb4fb669a0 [NI] Refactoring: rename method 2018-03-25 20:22:36 +03:00
Mikhail Zarechenskiy 53b434a3e3 [NI] Use getValue/setValue methods simultaneously to infer types
Rewrite inference for delegated properties with the new scheme
2018-03-25 20:22:36 +03:00
Mikhail Zarechenskiy 0f60965595 [NI] Introduce basic resolver for many candidates 2018-03-25 20:22:35 +03:00
Mikhail Zarechenskiy 3078e5a6ff [NI] Simplify creation of resolution callbacks 2018-03-25 20:22:35 +03:00
Mikhail Zarechenskiy ff10e97c28 [NI] Make CallResolutionResult more typed 2018-03-25 20:22:35 +03:00
Mikhail Zarechenskiy 663b417c5a [NI] Introduce method to add extra constraints before completion 2018-03-25 20:22:34 +03:00
Mikhail Zarechenskiy 1a5282c4b7 [NI] Introduce methods to extend inference for several candidates 2018-03-25 20:22:33 +03:00
Mikhail Zarechenskiy 8c44d44e78 [NI] Propagate class to extend inference through resolution context 2018-03-25 20:22:33 +03:00
Nikolay Krasko 982b768c69 Refactoring: collect callbacks for collecting module info in one place 2018-03-23 18:04:08 +03:00
Nikolay Krasko 0b0eb210b6 Refactoring: get module language settings in ResolverForProjectImpl 2018-03-23 18:04:06 +03:00
Nikolay Krasko 586860e03a Refactoring: store correspondent module info in module content 2018-03-23 18:04:01 +03:00
Nikolay Krasko 3e313509e1 Refactoring: restrict callback in ResolverForProjectImpl 2018-03-23 18:03:59 +03:00
Nikolay Krasko dced45d1bf Refactoring: rename AnalyzerFacade -> ResolverForModuleFactory 2018-03-23 18:03:52 +03:00
Mikhail Zarechenskiy effdfe8ec0 Prohibit incorrect annotations with use-site targets more precisely
#KT-21696 Fixed

The problem is coming from the fact that `AnnotationTarget.VALUE_PARAMETER` is mapped to receiver parameter and to value parameter, but annotation with use-site target `receiver` can be used only on type reference of receiver parameter
2018-03-22 04:03:08 +03:00
Mikhail Zarechenskiy 6007559af1 Minor, remove unused method, add TODO 2018-03-22 04:03:06 +03:00
Mikhail Zarechenskiy 6086cd2cf4 Prohibit non-const expressions through varargs in annotations
Fixes #KT-23153 for Kotlin 1.3

 The problem was in the type check of expression type against expected type. When feature `AssigningArraysToVarargsInNamedFormInAnnotations` (KT-20171) appeared, expected type could be wrong, which led to failed type check
2018-03-22 04:03:04 +03:00
Mikhail Zarechenskiy 4ebd11a7ae Refactoring: rename parameter to argument for annotation diagnostics 2018-03-22 03:59:55 +03:00