Commit Graph

373 Commits

Author SHA1 Message Date
Dmitry Petrov 8e8c5fae01 Minor: reformat code 2018-03-02 10:54:32 +03:00
Yan Zhulanow 34d1611ed4 Add Pill support to compiler and IDE modules 2018-03-02 03:15:17 +03:00
Alexander Udalov 7123202670 Add getExtensionOrNull utility for protobuf messages 2018-02-08 17:08:33 +01:00
Denis Zharkov 2ad93a0330 Use extension registry when unpacking serialized type alias
It's funny here that "extension" here means protobuf extensions
while initial issue is about extension function types

 #Fixed KT-22728
2018-02-08 12:39:26 +03:00
Mikhail Zarechenskiy 915455ebe9 Introduce InlineClasses language feature
Allow to write `inline` modifier in front of class declaration
2018-02-05 12:07:38 +03:00
Dmitry Savvinov b29a6e48fb Refactor language features, which control effect system
- Introduce new language feature 'ReadDeserializedContracts', which
allows to deserialize contracts from metadata.

- Introduce new language feature 'AllowContractsForCustomFunctions',
which allows reading contracts from sources.

- Use new features instead of combination 'CallsInPlaceEffect ||
ReturnsEffect'

- Rename 'CallsInPlaceEffect' -> 'UseCallsInPlaceEffect',
'ReturnsEffect' -> 'UseReturnsEffect'. As names suggest, they control
if it is allowed to use corresponding effect in analysis.

We have to introduce separate 'ReadDeserializedContracts' to enable
contracts only in some modules of the project, because libraries are
read with project-wide settings (see KT-20692).
2018-01-26 11:30:44 +03:00
Denis Zharkov 2e933a165a Avoid retaining all protobuf objects in DeserializedMemberScope
Object model for deserialized protobuf isn't very cheap, so
loading just our stdlib's packages several times (as we do in the IDE)
might lead to ~ 96 MB of retained memory just by these objects.

While in fact many of them remain unused

 #KT-21517 Fixed
2018-01-22 10:48:25 +03:00
Alexander Udalov b3eeb2f735 Remove unneeded members of ConstantValueFactory 2018-01-18 12:49:38 +01:00
Alexander Udalov 82574cb570 Do not store ClassDescriptor in EnumValue
Only store the ClassId of the enum class and the Name of the entry, and
resolve the needed descriptor in getType() instead, which now takes the
module instance where that descriptor should be resolved
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
Denis Zharkov c86dc0d7af Add protobuf extensions to serialized Java descriptors
#KT-17621 In Progress
2017-12-12 16:17:58 +03:00
Alexander Udalov d386712903 Report pre-release errors if release LV is used
#KT-21267 Fixed
2017-11-17 13:42:36 +01:00
Alexander Udalov 02981038f3 Split core into descriptors, descriptors.jvm, deserialization, descriptors.runtime 2017-11-10 18:58:31 +01:00
Nikolay Krasko 2d7fe98e55 Don't resort deserialized descriptors based on renderer, preserve proto order
Use only names and types for sorting. Otherwise if deserialized descriptor
is rendered different from origin we might get Psi-Stub mismatch error.

Use the original proto order for declarations with same name and kind.

 #KT-20782 Fixed
 #EA-109887 Fixed
2017-10-27 15:09:04 +03:00
Alexander Udalov f2be34ca1c Support KClass<*> annotation arguments in serialization/deserialization
#KT-11586 Fixed
2017-10-23 19:16:44 +02:00
Alexander Udalov 3665255a2b Extract skipPreReleaseCheck out of DeserializationConfiguration.skipMetadataVersionCheck 2017-10-16 15:09:36 +02:00
Alexander Udalov 8a0dcca957 Do not consider 'expect' class type constructors final
Because even a final expected class can be actualized with an open
actual class and thus have subtypes in the platform code
2017-10-16 15:08:50 +02: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
Alexander Udalov a96861c353 Support version kind for RequireKotlin
#KT-20584 Fixed
2017-10-10 13:21:49 +02:00
Alexander Udalov 8962911503 Rename SinceKotlinInfo -> VersionRequirement 2017-10-10 13:19:18 +02:00
Dmitry Petrov 67a50e92d0 Load annotations for default getter and setter
#KT-14697 Fixed
2017-10-05 10:24:29 +03:00
Denis Zharkov 265794e712 Add necessary ResolutionScope::recordLookup implementations 2017-09-28 14:01:30 +03:00
Denis Zharkov 580a7e3e4d Drop location parameter from ResolutionScope::definitelyDoesNotContainName
definitelyDoesNotContainName is called too eagerly sometimes and it leads
to obviously redundant lookups

The idea is to put responsibility for calling recordLookup to resolution
itself
2017-09-28 14:01:30 +03:00
Denis Zharkov 860951748f Filter out inapplicable member scopes in resolution 2017-09-28 14:01:30 +03:00
Denis Zharkov 3322ed6e04 Implement LazyImportResolver::definitelyDoesNotContainName 2017-09-28 14:01:30 +03:00
Denis Zharkov 6e766634c1 Add location parameter to ResolutionScope::definitelyDoesNotContainName
It should be used to record lookups in case of fast paths
in resolution
2017-09-28 14:01:30 +03:00
Denis Zharkov cd3edfc5b2 Introduce MemberScope::classifierNames and some implementations
It aims to help with further optimizations
2017-09-28 14:01:30 +03:00
Denis Zharkov 94356e891b Introduce ResolutionScope::definitelyDoesNotContainName
Also add some obvious implementations

This method might be used in resolution to filter out
inapplicable scopes
2017-09-28 14:01:30 +03:00
Alexander Podkhalyuzin 3f8170d369 Clean idea files generated on the gradle import, add them to .gitignore 2017-09-19 23:58:27 +02:00
Stanislav Erokhin 194d16176c Rename protobuf header/impl flags 2017-09-15 18:29:36 +03:00
Stanislav Erokhin e86d2f00ff Rename isImpl to isActual in descriptors 2017-09-15 18:25:49 +03:00
Stanislav Erokhin c8ee424f67 Rename isHeader to isExpect in descriptors 2017-09-15 18:25:41 +03:00
Stanislav Erokhin fd6eab38e5 Regenerate comments in protobuf files for isHeader -> isExpect 2017-09-15 18:25:34 +03:00
Alexander Udalov 2bb437b219 Do not load JvmPackageName-annotated parts on Kotlin < 1.2 2017-09-13 22:59:03 +03:00
Alexey Tsvetkov 1c4ada2008 Fix searching serialized classes package contains multiple fragments 2017-08-29 04:28:03 +03:00
Alexey Tsvetkov 46a3a59b81 Fix missing lookups from deserialized JS descriptors 2017-08-10 21:19:42 +03:00
Valentin Kipyatkov 9361cd895c Support for import aliases in code completion
#KT-8848 Fixed
2017-08-08 22:06:04 +03:00
Mikhael Bogdanov db9f925bb1 Switch default project jvm target to 1.8, keep 1.6 for core modules 2017-08-04 13:14:50 +02:00
Alexander Udalov 5128b8a409 Add default implementation for Annotations.findAnnotation 2017-07-20 13:27:34 +03:00
Alexander Udalov f39106f75c Do not use parameter descriptors in AnnotationDescriptorImpl 2017-07-20 13:26:13 +03:00
Alexander Udalov 41ea0e8ef8 Introduce AnnotationDescriptor.fqName
Could be used instead of ".annotationClass.fqName" to avoid the unneeded
resolution of the annotation class descriptor
2017-07-20 13:25:38 +03:00
Alexander Udalov 7ec67505c5 Optimize Annotations.isEmpty in some implementations 2017-07-20 13:25:38 +03:00
Alexander Udalov 9ee4b39e1b Provide default implementation for Annotations.findExternalAnnotation 2017-07-20 13:25:38 +03:00
Alexander Udalov 5636318eb4 Optimize DeserializedAnnotations in terms of memory traffic
Do not wrap every annotation object into an AnnotationWithTarget
2017-07-20 13:25:38 +03:00
Alexander Udalov 21197b53aa Do not load annotations on value parameter if there are none
Also fix an error in the doc in descriptors.proto
2017-07-20 13:25:38 +03:00
Denis Zharkov 99a10d8d63 Minor. Rename compactIfPossible -> compact
As ArrayList can always be compacted
2017-07-20 10:53:09 +03:00
Mikhail Glukhikh 9c06739594 Cleanup: apply "lift out..." inspection (+ some others) 2017-07-07 18:15:30 +03:00
Alexander Udalov 751ff48301 Extract logic of builtins package fragment provider creation
This allows to drop the compile dependency of module 'descriptors' on
'deserialization', breaking the circular dependency between them
2017-06-06 14:29:20 +03:00
Alexander Udalov 1728b77b2c Minor, refactor createBuiltInsPackageFragmentProvider 2017-06-06 14:29:19 +03:00
Alexander Udalov cbaa676c3d Move some declarations between 'descriptors' and 'deserialization'
- Move the following from 'deserialization' to 'descriptors':
  NotFoundClasses.kt
  AdditionalClassPartsProvider.kt
  ClassDescriptorFactory.kt
  PlatformDependentDeclarationFilter.kt
  findClassInModule.kt
- Move the following form 'descriptors' to 'deserialization':
  BuiltInSerializerProtocol.kt
  builtInsPackageFragmentProvider.kt
- Extract a marker interface from BuiltInsPackageFragment and move its
  implementation to 'deserialization'
- Change the type of parameters in PlatformDependentDeclarationFilter
  and AdditionalClassPartsProvider to ClassDescriptor

This will help in getting rid of the circular dependency of
'descriptors' <-> 'deserialization'
2017-06-06 14:29:18 +03:00