Commit Graph

2877 Commits

Author SHA1 Message Date
Mikhail Zarechenskiy b75ab5c832 Refactoring: SingleAbstractMethodUtils -> JavaSingleAbstractMethodUtils 2020-01-27 11:03:58 +03:00
Mikhail Zarechenskiy 0530f9ed1c Refactoring: generify and remove duplicated code 2020-01-27 11:03:57 +03:00
Mikhail Zarechenskiy 4e3c27c4ec Refactoring: move SamConversionOracle to core 2020-01-27 11:03:57 +03:00
Mikhail Zarechenskiy 02387e77dd Refactoring: rename SamConversionTransformer -> SamConversionOracle 2020-01-27 11:03:56 +03:00
Mikhail Zarechenskiy 08f80ba15a Refactoring: remove useless method 2020-01-27 11:03:55 +03:00
Mikhail Zarechenskiy 00469712d1 [NI] Don't use only platform specific checks for FIC in inference 2020-01-27 11:03:55 +03:00
Alexander Udalov 5321a6af33 Forbid spread operator in signature-polymorphic calls
#KT-35226 Fixed
2020-01-21 15:57:35 +01:00
Mikhail Zarechenskiy 0fdebdfeba Refactoring: move SamConversionResolverImpl to core module 2020-01-17 19:36:07 +03:00
Mikhail Zarechenskiy cd5c1b96bb Refactoring: move SamConversionResolver to more applicable package 2020-01-17 19:36:07 +03:00
Mikhail Zarechenskiy c93c82236c Refactoring: move common parts about SAMs to frontend module 2020-01-17 19:36:06 +03:00
Mikhail Zarechenskiy fc32e8b017 FIC: Add synthetic constructors for fun interfaces aka explicit FIC 2020-01-17 19:36:05 +03:00
Mikhail Zarechenskiy 0f242a9931 FIC: Support conversions for suspend functions 2020-01-17 19:36:04 +03:00
Mikhail Zarechenskiy 87e79e72a9 Refactoring: move SamConversionResolver to core.descriptors 2020-01-17 19:36:02 +03:00
Mikhail Zarechenskiy c71c1d45c6 FIC: Make SAM conversions also for fun interfaces, add base test 2020-01-17 19:36:01 +03:00
Mikhail Zarechenskiy 193d807a1e Refactoring: make parameters of getFunctionTypeForSamType not null 2020-01-17 19:36:01 +03:00
Mikhail Zarechenskiy 588259a034 Add feature that allows references to synthetic properties with warning
See KT-35933 for details
2020-01-16 09:37:34 +03:00
Alexander Udalov 04a6f4d92b JVM IR: minor, use chars from JvmSimpleNameBacktickChecker in ClassCodegen 2020-01-14 13:54:12 +01:00
Mikhael Bogdanov 2ed0cb2a89 Support type annotations
#KT-35843 Fixed
2020-01-09 14:00:11 +01:00
Mikhail Zarechenskiy e078282767 Fix ambiguity between Java and Kotlin SAM candidates
Because of incorrect flag we generated synthetic SAM candidates and got ambiguity when feature `SamConversionPerArgument` was enabled (Gradle case) because candidates for Java were duplicated

 #KT-35579 Fixed
2019-12-23 12:22:20 +03:00
Denis Zharkov e8131d6e30 Choose Java field during overload resolution with a pure Kotlin property
^KT-31244 Fixed
2019-12-19 10:53:31 +03:00
Victor Petukhov 07269661b4 NI: Allow to resolve to functions with SAM conversion and passing array without spread as vararg (with warning)
^KT-35224 Fixed
2019-12-12 23:46:16 +03:00
Ilya Chernikov 7dd9ed7e38 [NI] Fix loosing type annotations on extension functions
#KT-32138 fixed
2019-11-29 13:44:41 +01:00
Mikhail Zarechenskiy eb73650209 Fix race in IDE: inject proper storage manager for type parameters
With NO_LOCKS strategy we can easily end up in a situation when
 constraint system for a generic call is built incorrectly,
 producing flaky errors (or don't produce errors at all)

 Now proper storage manager is injected for all cases except:
 - IR
 - Codegen
 - Serialization plugin
 - Fake local objects

 Most likely, NO_LOCKS strategy for these cases is fine as at that point
 the compiler works in one thread

 #KT-34786 Fixed
2019-11-26 10:52:45 +03:00
Alexander Udalov 57a674e9e6 Make fast class files reading mode default in compiler tests
This makes sense because this mode is the default in the production
compiler. Forgetting to enable it where necessary led to different
bizarre test failures, see for example changes around 3fee84b966 and
KT-34826
2019-11-11 15:40:49 +01:00
Alexander Udalov 5c89f2fa54 Support KClass.qualifiedName in stdlib-only reflection implementation
#KT-34586 Fixed
2019-10-29 15:51:25 +01:00
Alexander Udalov c164745301 Support KClass.simpleName in stdlib-only reflection implementation
#KT-33646 Fixed
2019-10-29 15:51:21 +01:00
Alexander Udalov df4ab4ed81 Add JVM bytecode target version 13
#KT-34119 Fixed
2019-10-29 12:54:24 +01:00
Mikhael Bogdanov c78dbaf6b3 Initializer default values in 'tailrec' method in proper order
#KT-31540 Fixed
2019-10-17 13:06:36 +02:00
Yan Zhulanow a4c8ccee06 kapt: Fix compilation in 'compile' running mode (KT-33800) 2019-10-08 19:13:57 +09:00
Pavel Kirpichenkov b7e5d9faae Update annotation rendering in diagnostics
Disable annotation rendering in default type and descriptor renderers.
Preserve annotations in Android and Serialization plugins.
Update error texts in ide tests.
Nullability annotations in Java descriptors are rendered with context-dependent renderer.

#KT-20258 Fixed
2019-10-04 11:18:45 +03:00
Alexander Udalov 6ef434a711 JVM IR: add -Xir-check-local-names to check names for consistency
Since KotlinTypeMapper is no longer used in the JVM IR backend, we need
not run CodegenBinding.initTrace and check that names of local entities
are exactly equal to local names computed by that algorithm.

However, it's still useful as an opt-in flag, to discover issues where
unwanted elements take part in the naming (such as temporary IR
variables, see for example cb2e68fece). So we introduce a new command
line argument -Xir-check-local-names which, when the IR backend is used
(via -Xuse-ir), launches the name computation algorithm from the old
backend and then compares that the names are exactly equal to the names
computed by the IR backend in InventNamesForLocalClasses.
2019-09-18 17:55:42 +02:00
Matthew Gharrity a1f4a4572a Check cancelation in KotlinJavaPsiFacade.findPackage()
This may help with some UI freezes caused by KT-33394, although
it does not fix the underlying performance problem.
2019-09-16 10:58:58 -07:00
Pavel Kirpichenkov 0a1b3a8455 Clearify diagnostic messages that involve internal visibilities
KT-7354 Fixed

Visibility.displayText is deprecated with warning.
Diagnostics for java visibilities changed.
2019-09-16 19:00:43 +03:00
Alexander Udalov 8efbcc5350 Do not use KotlinTypeMapper when generating JVM assert inline intrinsics 2019-09-11 23:33:10 +02:00
Nikolay Krasko 0ae9240e5f Remove 182 and AS33 from build scripts
#KT-33536 Fixed
2019-08-30 12:14:50 +03:00
Alexander Udalov 312205f376 Prohibit synchronized methods on interface members
#KT-9310 Fixed
2019-08-22 18:04:00 +02:00
Dmitry Savvinov 0065236bde Move default implementation of TargetPlatform.platformName to leaf classes
Otherwise, we have a static initialization loop, leading to null-leaks

Removing default interface method indeed disconnects the loop, as per JVM
Specification, "5.5 Initialization".

See KT-33245 for detailed explanations

^KT-33245 Fixed
2019-08-12 13:06:51 +03:00
Dmitry Savvinov b48218e722 [Resolve] Make ResolversForModule less static
As consequence, remove IdePlatformKindTooling.resolverForModule, because
it became more than just field, and it duplicates similar API in
IdePlatformKindResolution anyways
2019-07-30 12:41:40 +03:00
Denis Zharkov 5c2c7e7776 [Invariant fix] Avoid re-resolving declared descriptors in lazy member scopes
It becomes necessary after scopes/types refinement
Without it being applied the code might fail with slice-rewrite errors

KT-32841
2019-07-30 12:41:38 +03:00
Dmitry Savvinov 04717b57c9 [API Usage] Support refinement for Java classes' scope
Also, we should skip supertypes refinement for additional
    built-in members scope
2019-07-30 12:41:37 +03:00
Alexander Udalov f38e4d618e Support Array::class literal, forbid Array<X>::class on non-JVM
#KT-31230 Fixed
2019-07-16 15:57:26 +02:00
Steven Schäfer e7a5e5b4a0 JVM_IR: Handle annotation KClass fields in external declarations 2019-07-01 16:16:23 +02:00
Mikhail Zarechenskiy c2cf4aa2b5 [NI] Move ability to convert standalone SAM-argument under the feature
If new inference is enabled only for IDE analysis, then this feature
 will be disabled to reduce difference between new and old inference,
 but if new inference is enabled in the compiler, then this feature
 will be enabled too to preserve behavior of new inference for
 compilation

 #KT-32175 Fixed
 #KT-32143 Fixed
 #KT-32123 Fixed
 #KT-32230 Fixed
2019-07-01 12:53:33 +03:00
Dmitry Savvinov 0915f0c78a [Expect/Actual] Let DI instantiate ExpectedActualDeclarationChecker
Inject it instead of calling constructor manually and passing instance
directly into the container. This allows to accept some components in
constructor of ExpectedActualDeclarationChecker
2019-06-10 13:34:27 +03:00
Mikhail Zarechenskiy 787a8bb9bd Revert "[NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI"
This reverts commit 7c4101e21c.

 #KT-31866 Fixed
 #KT-31868 Fixed
 #EA-125401 Fixed
 #KT-25290 Open
2019-06-07 12:31:38 +03:00
Dmitry Savvinov dca23f871c Allow to force-require syntetic SAM-adapters even in NI
This is needed for some IDE clients, particularly, completion: even
though presenting only non-converted member (e.g., 'foo(Consumer<Int>')
is nominally OK, as resolution with NI is smart enough to accept 'foo { }'
for such a call, it is inconvenient for users (for example, hitting
enter would insert round brackets instead of a figure brackets)

This commit adds very-very narrow API (borderline hacky) in
JavaSyntheticScopes, to allow clients explicitly ask for a scopes with
force-enabled synthetic conversions. It fixes several tests, which had
started to fail after corresponding commit about NI and SAM-adapters
(fe5976d7f4), e.g.:
- Java8BasicCompletionTestGenerated.testCollectionMethods
- Java8BasicCompletionTestGenerated.testStreamMethods
- JvmBasicCompletionTestGenerated$Common$StaticMembers.testJavaStaticMethods
- JvmBasicCompletionTestGenerated$Java.testSAMAdaptersStatic
- JvmWithLibBasicCompletionTestGenerated.testSamAdapter
- JvmWithLibBasicCompletionTestGenerated.testSamAdapterAndGenerics

Note that changes are made in ReferenceVariantsHelper, which is used by
several other clients in IDE. Presumably, those changes are needed for
them too.
2019-06-03 10:46:53 +03:00
Alexander Udalov e9b50157da Try loading PSI from descriptor in OtherOrigin constructor
To simplify several call sites
2019-05-29 10:23:19 +02:00
Dmitriy Novozhilov 7c4101e21c [NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI 2019-05-29 10:35:46 +03:00
Mikhail Zarechenskiy 848640253a Revert "[NI] Disable capturing/approximation type in TypeSubstitutor with enabled NI"
This reverts commit f20ec3e0a6.
2019-05-29 01:31:28 +03:00
Dmitry Savvinov 893ac735bc Convert property initializer to getter in
JvmPlatforms.unspecifiedJvmPlatform

This unties static initialization loop which lead to NCDFE and other
issues.
2019-05-28 16:03:05 +03:00