Commit Graph

2579 Commits

Author SHA1 Message Date
Pavel V. Talanov 27d7bb595f CliLightClassGenerationSupport: correctly find facade files
This fixes a problem where JvmPackageName annotation could force file
    facades to be in the package different to declared kotlin package
2018-03-06 12:07:12 +01:00
Yan Zhulanow 34d1611ed4 Add Pill support to compiler and IDE modules 2018-03-02 03:15:17 +03:00
Mikhail Zarechenskiy f23b5103ec Avoid non-null assertions for inline classes based on nullable types
Note that there are more places where assertions for inline classes should refined:
  - lateinit vars
  - values that come from Java
  - type casts (interfaces to inline class type)
2018-02-20 14:41:48 +03:00
Dmitry Savvinov 0929673576 Refactor DataFlowValueFactory into proper component 2018-02-20 13:11:33 +03:00
Mikhael Bogdanov 31c63dea50 Add jvm target 10 tests on jdk 10 2018-02-16 14:22:04 +01:00
Mikhail Zarechenskiy 1ac4e9755a Generate synthetic unbox method for each wrapper of inline class 2018-02-09 02:08:11 +03:00
Alexander Udalov 7123202670 Add getExtensionOrNull utility for protobuf messages 2018-02-08 17:08:33 +01:00
Alexander Udalov 890374a42a Load module annotations for JVM and JS modules in compiler
#KT-22759 In Progress
2018-02-08 17:08:33 +01:00
Alexander Udalov b4ac852392 Add packageProto/nameResolver to JvmPackagePartSource
May be useful for loading platform-specific protobuf extensions (such as
package_module_name on JVM) when analyzing deserialized top level
members
2018-02-08 17:07:22 +01:00
Alexander Udalov 6da3f37fc3 Write anonymousObjectOriginName for classes copied during inline
#KT-21320
2018-02-06 13:05:22 +01:00
Mikhail Glukhikh 81122ed236 Fix a pack of broken IDE action tests
Related to KT-20281.
For Java resolve we can use also resolve with 'null' platform,
which is possible situation in tests.
2018-02-06 15:02:38 +03:00
Mikhail Glukhikh 19beaf57a7 JVM facade: for Java resolve, always use JvmPlatform resolver
So #KT-20281 Fixed
2018-02-06 09:50:10 +03:00
Mikhail Zarechenskiy 928a342ace Initial version of codegen for inline classes 2018-02-05 12:07:40 +03:00
Vyacheslav Gerasimov 89a07ded1c Extract versions and remove unnecessary '.jar' extensions 2018-01-30 17:06:18 +03:00
Ilya Chernikov 4eb557724c Convert compiler projects to the new intellij deps 2018-01-30 17:06:13 +03:00
Ilya Chernikov a4f28cd94f Make all dependencies to idea sdk intransitive 2018-01-30 17:06:11 +03:00
Alexander Udalov 46b8deedf7 Run classifier usage checkers on constructor calls
In some cases, REFERENCE_TARGET for annotation entries is the annotation
class descriptor, and in others -- the constructor of that class
2018-01-29 12:22:41 +01:00
Alexander Udalov 8cd7686535 Introduce DeclarationCheckerContext, remove SimpleDeclarationChecker 2018-01-29 12:22:40 +01:00
Alexander Udalov 4cb5483c13 Introduce CheckerContext and ClassifierUsageCheckerContext
To reduce the number of parameters in classifier usage checker
implementations, and to unify the API with call checkers
2018-01-29 12:20:36 +01:00
Mikhael Bogdanov c4da370b0b Allow to use @JvmStatic in interface companion object 2018-01-26 10:09:20 +01:00
Mikhael Bogdanov 2340756b88 Minor. Reformat 2018-01-26 10:09:20 +01:00
Denis Zharkov 31e73e90d6 Explicitly state that PluginDeclarationProviderFactory is source-only
Before this change `filesScope` was effectively empty in cases when
module info is a library, thus looking
into PackageIndexUtil.packageExists(name, indexedFilesScope, project)
was kind of redundant since it always returns false for empty scopes

The initial motivation was run by 1716720604
that made PackageIndexUtil::packageExists calls much more frequent
2018-01-25 14:41:28 +03:00
Denis Zharkov 4d378912bf Minor. Reformat JVM/JS analyzer facades 2018-01-25 14:41:28 +03:00
Alexander Udalov a46a2b9b1c Support nested classes in annotation classes
#KT-16962 In Progress
2018-01-24 15:54:35 +01:00
Alexander Udalov 899002b681 Refactor JavaEnumValueAnnotationArgument and implementations
Only require implementations to be able to compute the enum class name
and the corresponding entry name. Only this should be necessary to
correctly resolve the argument; the resolvers will find the
corresponding class descriptor if necessary
2018-01-18 12:49:38 +01:00
Alexander Udalov 907f53e539 Refactor ConstantValue implementations
Remove KotlinBuiltIns and take a ModuleDescriptor instance in getType
instead. This will allow to create constant values in contexts where
there's no module or built-ins accessible (such as, deserialization of
module annotations during indexing of .kotlin_module files in IDE).

Note that some values (KClassValue, EnumValue, AnnotationValue) still
take module-dependent objects (KotlinType, ClassDescriptor and
AnnotationDescriptor respectively). This is to be refactored later
2018-01-18 12:49:38 +01:00
Alexey Tsvetkov fec2d08d22 Compile actual and expected declarations together
#KT-20840 fixed
2017-12-22 16:12:19 +03:00
Pavel V. Talanov aec893180e Minor, JvmAnalyzerFacade: drop logging
Prevent log spam
2017-12-20 17:19:09 +03:00
Nikolay Krasko b133189309 Rename: MyFunctionDescriptor -> SamAdapterExtensionFunctionDescriptorImpl 2017-12-15 16:14:48 +03:00
Denis Zharkov fa6285d32a Fix NPE in JavaNullabilityChecker when checking equals-calls
This NPE was introduced in ce41b5745a
Prior to the latter change there was a synthetic PSI element for each
equals-related call, thus callOperationNode was not null here.

== are intentionally treated as safe calls, but for nullability checker
it's not relevant, it only should report warnings on real safe-calls
2017-12-14 19:15:41 +03:00
Denis Zharkov e24e711208 Avoid rebuilds after changes of layouts xml-files
This commit makes IC react more granularly on these changes
Precisely, it marks dirty only kt-files that having lookups into
synthetic package built upon a changed layout-file

 #KT-21622 Fixed
2017-12-12 16:17:58 +03:00
Denis Zharkov df533053f9 Record special name lookup when trying use interface as a SAM
It was already working in JPS, because it see our synthetic classes
as subclasses for SAM's, but with non-JPS build we have to manually
tracking places that should be recompiled after SAM members are changed
2017-12-12 16:17:58 +03:00
Denis Zharkov 34452f4f4a Introduce JavaClassesTracker interface into java resolution components
It's purpose is passing java classes being used during analysis
to incremental compilation to let it track diffs

Potentially it might be done the other way:
incremental compilation could build a separate container to analyze
necessary classes, but it's rather hard to implement now

 #KT-17621 In Progress
2017-12-12 16:17:58 +03:00
Mikhail Zarechenskiy 7f0cca52ca [NI] Use definitely not-null types for smartcasts 2017-12-06 18:36:13 +03:00
Dmitry Petrov 7a6f80606b Warn on for-in-array range variable assignment in loop body
According to KT-21354, this should be a warning in 1.2 and before, and
no warning (with changed semantics) in 1.3 and later.
NB there are some false positives in this check.

 #KT-21354 In Progress
 #KT-21321 In Progress
2017-12-05 15:45:20 +03:00
Yan Zhulanow a4a7db06d2 Kapt: force resolve import references in partial analysis mode (required for import conversion in correctErrorTypes) 2017-12-01 22:53:21 +09:00
Mikhael Bogdanov a547019ed0 Switch DEFAULT_METHOD_CALL_FROM_JAVA6_TARGET according to LL 2017-11-17 13:48:44 +01:00
Alexander Udalov c55ac55526 Restore and deprecate JvmFileClassesProvider.getFileClassInternalName
#KT-21270 Fixed
2017-11-16 11:24:11 +01:00
Alexander Udalov 02981038f3 Split core into descriptors, descriptors.jvm, deserialization, descriptors.runtime 2017-11-10 18:58:31 +01:00
Denis Zharkov 26ba2ab3db Postpone creating DataFlowValue until they're really needed
Unfortnutately DataFlowValueFactory::createDataFlowValue isn't very cheap,
so it's better to avoid these calls when it's possible
2017-11-10 13:01:13 +03:00
Denis Zharkov 714a057e3b Minor. Drop unused DataFlowExtras::possibleTypes 2017-11-10 13:01:13 +03:00
Dmitry Petrov 57602c420d Sanitize declaration return types
On JVM, strip @EnhancedNullability annotation from inferred types for
functions, properties, and local variables, so that these annotations
do not "escape" from Kotlin declarations.
2017-10-25 12:30:32 +03:00
Dmitry Petrov 2b924f44d8 Generate assertions for expressions with enhanced nullability
If an expression with type annotated with @EnhancedNullability is used
as a function expression body, or property initializer, or variable
initializer, and corresponding type can not contain null,
generate nullability assertions for this expression.
2017-10-25 12:30:32 +03:00
Denis Zharkov da52716bfd Fix wrong nullability enhancement for annotated java.lang.Object type
Effectively, this commit drops cached value for j.l.Object type
This cache was introduced when types were immutable, but they
became mutable after starting reading top-level TYPE_USE annotations,
that lead to changing shared JAVA_LANG_OBJECT_CLASSIFIER_TYPE instance

 #KT-20826 Fixed
2017-10-20 09:43:38 +03:00
Dmitry Petrov 16b7bece46 Fix constant expression inlining logic
Constant expressions are inlined if they do not depend on non-inlineable
vals.
Java constants are always inlined.
Kotlin constants are inlined in LV 1.1+.
2017-10-13 17:01:42 +03:00
Stanislav Erokhin 1f546ea1ae Revert "Temporary change default behavior for constructor call normalization"
This reverts commit 2e8cda8103.
2017-10-12 14:01:39 +03:00
Mikhael Bogdanov 232d1bd9ef Switch warning to error for java-default method calls within 1.6 target
#KT-15825 Fixed

(cherry picked from commit 9b29ebb)
2017-10-11 19:20:24 +03:00
Denis Zharkov 2e8cda8103 Temporary change default behavior for constructor call normalization
It's necessary to perform bootstrap and must be reverted after
2017-10-11 14:21:49 +03:00
Dmitry Savvinov 175d23155e Effects: add (de)serialization of contracts in metadata
- Introduce new definitions in descriptors.proto
- Add new corresponding values in Flags.java
- Introduce ContractSerializer and ContractDeserializer, responsible for
for conversion ContractDescription <-> ProtoBuf.Contract
- Add dependency of 'serialization' module on 'resolution' so that it
could see contracts model.

Note that here we do a lot of seemingly unnecessary hoops, which in fact
necessary to respect existing module system (in particular, to be able
to extract ContractDescription declarations from 'descriptors' module to
make them invisible from reflection)

==========
Effect System introduction: 8/18
2017-10-11 13:34:54 +03:00
Dmitry Petrov 26136cd0fe Check constness of 'apiVersionIsAtLeast' arguments 2017-10-10 09:04:51 +03:00