Commit Graph

2877 Commits

Author SHA1 Message Date
Alexey Andreev 7e37d5d6fa Prohibit external modifiers on classes and properties in JVM target 2016-12-08 15:41:42 +03:00
Alexey Andreev ba2443bcb3 Add external property to class and property descriptors 2016-12-08 15:41:38 +03:00
Alexander Udalov 228d0a1c43 Move "missing dependency class" diagnostic from JVM to common front-end 2016-12-07 21:46:37 +03:00
Alexander Udalov 3b18531b20 Add expectedVersion to IncompatibleVersionErrorData, move to deserialization 2016-12-07 21:46:36 +03:00
Denis Zharkov dd392963ac Minor. Rename SyntheticExtensionFunctions -> SyntheticMemberFunctions 2016-12-07 21:04:57 +03:00
Denis Zharkov 891a036b59 Change resolution priority level for SAM adapters
After this change SAM adapters are being resolved in the same group
as members, thus their overload resolution happens simultaneously.

But in the case of overload resolution ambiguity try to filter out all
synthetic members and run the process again.

See the issue and new test for clarification

 #KT-11128 In Progress
2016-12-07 21:04:44 +03:00
Denis Zharkov a4adfb43d4 Minor. Refine substitution for SAM adapters
Introduce CompositionTypeSubstitution instead of manual composition of
two substitutions.

This change is necessary for the later changes where original substitution
will be able to contain outer type parameters

 #KT-11128 In Progress
2016-12-07 21:04:39 +03:00
Yan Zhulanow d884830700 Allow to avoid declaration body resolution for function and property initializers if the return type is explicitly specified. This significantly reduces the analysis time in kapt3. 2016-12-05 19:57:43 +03:00
Mikhail Zarechenskiy 240d82d167 Move reified type parameter checker to additional checkers to able turn it off by demand 2016-12-01 10:06:38 +03:00
Denis Zharkov fcd9ee037e Support coroutines stack-unwinding in JVM backend
#KT-14924 In Progress
2016-11-29 14:14:50 +03:00
Alexander Udalov 8d3f6f1ce7 Check platform<->impl declaration compatibility
For each platform declaration, there must be at least one impl declaration in
the module with the compatible signature; similarly, for each impl declaration,
there must be at least one platform declaration with the compatible signature.

Note that currently the presence of the 'impl' modifier is not checked yet.

Also, the sad fact is that if you have platform and impl declarations which are
not compatible, you get two errors: on the platform delcaration and on the impl
declaration. This needs to be addressed as well
2016-11-25 20:50:26 +03:00
Alexander Udalov ce9691cd2b Support platform/impl modifiers for properties
Do not allow platform properties to have backing fields, initializers, be
delegated, lateinit or const, or have accessors with bodies
2016-11-25 20:50:18 +03:00
Alexander Udalov bfb7b21472 Load definitions of symbols from .kotlin_metadata files
Extract AbstractDeserializedPackageFragmentProvider out of
JvmBuiltInsPackageFragmentProvider and implement it a little bit differently in
MetadataPackageFragmentProvider. The main difference is in how the package
fragment scope is constructed: for built-ins, it's just a single scope that
loads everything from one protobuf message. For metadata, package scope can
consist of many files, some of which store information about classes and others
are similar to package parts on JVM, so a ChainedMemberScope instance is
created.

Introduce a bunch of interfaces/methods to deliver the needed behavior to the
'deserialization' module which is not JVM-specific and does not depend on the
compiler code: MetadataFinderFactory,
PackagePartProvider#findMetadataPackageParts, KotlinMetadataFinder#findMetadata.
Note that these declarations are currently only implemented in the compiler; no
metadata package parts/fragments will be found in IDE or reflection
2016-11-25 20:50:13 +03:00
Dmitry Petrov fc2a965d2a Fix decompiler tests. 2016-11-22 14:40:02 +03:00
Dmitry Jemerov b8525de726 Disallow @JvmOverloads on any interface methods
#KT-12224 Fixed
2016-11-18 11:05:02 +01:00
Dmitry Jemerov 79e90b32e8 @JvmOverloads on local declarations is now an error 2016-11-18 11:05:01 +01:00
Dmitry Jemerov 12e4cf9a4f Report @JvmOverloads errors on annotation, not on entire declaration (KT-12701) 2016-11-18 11:05:00 +01:00
Dmitry Jemerov 53cb559440 Fix exception on databinding-generated classes in AS 2.3 (https://ea.jetbrains.com/browser/ea_reports/1261189) 2016-11-15 12:47:45 +01:00
Anton Bannykh 334ae72957 Moved checking that reified is used in inlines only to the main frontend (KT-12695, KT-13697 fixed) 2016-11-15 13:44:48 +03:00
Mikhael Bogdanov 61da8be260 Generate parameters metadata for java 8 reflection 2016-11-14 14:27:08 +01:00
Ilya Chernikov 6e96d192bf Move incremental components to compller util to reduce dependencies of compiler interface modules 2016-11-09 11:09:32 +01:00
Denis Zharkov 7e49db8768 Introduce CoroutineImpl as a common super class for coroutines
The main benefit are class-files sizes for them
(not repeating the same declaration for each coroutine)
Also it helped to simplify coroutine codegen code a little

Note that controller/label field become non-volatile (see KT-14636)

 #KT-14636 In Progress
2016-11-09 12:25:31 +03:00
Alexander Udalov 8c65379711 Support injecting custom module into KotlinBuiltIns
Provide a command-line option to load built-ins from the module and its
dependencies instead of looking for them in kotlin-compiler.jar; built-ins must
be found this way, or an error will be reported (or, most likely at this
moment, an exception will be thrown).

Note that this does not affect whether built-ins (loaded from one place or the
other) are added to the _dependencies_ of the module, this is controlled by
another option. The option added in this commit only makes the KotlinBuiltIns
instance which is used via ModuleDescriptor throughout the compiler front-end
(and also injected in a bunch of places) a sort of "helper" which always goes
to that same module to find descriptors for built-in classes
2016-11-08 12:14:24 +03:00
Alexander Udalov 7898e2447d Minor, rename JVMConfigurationKeys.ADD_BUILT_INS_TO_DEPENDENCIES 2016-11-08 12:14:24 +03:00
Alexey Sedunov 30d08c989d Kotlin Facet: Use facet configuration to provide language version for IDE analyzer 2016-11-07 20:03:30 +03:00
Yan Zhulanow 951868f590 Explicitly filter out classes found by DataBindingClassFinder and DataBindingComponentClassFinder for scope without sources (KT-12402)
This change is temporary, and it should be reverted when the original problem in DataBinding IDE support is fixed.
2016-11-01 19:36:33 +03:00
Mikhail Glukhikh 2130164d9b EXTERNAL_DECLARATION_CANNOT_BE_ABSTRACT is now reported on property if accessor is external #KT-9297 Fixed
Also fixes EA-89227
2016-10-27 16:25:43 +03:00
Alexander Udalov 7f86ce0a20 Introduce fallback option to add built-ins in position manager test
In AbstractPositionManagerTest, built-ins could no longer be resolved because
JvmIDEVirtualFileFinder is used in IDE tests (even when the compilation is
called through JvmResolveUtil/GenerationUtils as in compiler tests), which is
not yet able to locate .kotlin_builtins files
2016-10-26 16:31:09 +03:00
Alexander Udalov e0989caf46 Load built-ins from module dependencies in JVM compiler
Introduce a new method KotlinClassFinder#findBuiltInsData, which is only
implemented correctly in the JvmCliVirtualFileFinder because it's only used in
the compiler code at the moment.

Introduce JvmBuiltInsPackageFragmentProvider, the purpose of which is to look
for .kotlin_builtins files in the classpath and provide definitions of
built-ins from those files.

Also exclude script.runtime from compilation because, as other excluded
modules, it has no dependency on the stdlib and is no longer compilable from
the IDE now, because it cannot resolve built-ins from anywhere
2016-10-26 16:31:09 +03:00
Alexander Udalov 484b0e36fb Add KotlinBuiltIns#isBuiltIn, use it instead of other utilities 2016-10-26 16:31:05 +03:00
Alexander Udalov 8a5c8da757 Simplify module configuration and built-ins dependency in some tests
- In tests on built-ins with no sources, just call
  JvmResolve.analyze(environment) and inspect the resulting module
- In AbstractLocalClassProtoTest, create container via
  TDAForJVM.createContainer
- Inline single module container creation into AbstractDiagnosticsTest
2016-10-26 16:31:04 +03:00
Alexander Udalov 035d6156a7 Drop Cloneable in JS, synthesize it at compile-time on JVM
Use the same approach that is used for creating function type classes
(Function{0,1,...}) + add Cloneable to supertypes of Array and primitive arrays

 #KT-5537 Fixed
2016-10-25 15:42:33 +03:00
Alexander Udalov 0e9f29fdba Make ClassDescriptor#classId nullable
Local classes or anonymous objects do not have a class id. Use "!!" almost
everywhere to make assertion explicit
2016-10-25 15:42:32 +03:00
Alexander Udalov 6b6ddf5f75 Import classes from kotlin.coroutines by default, add to default imports in JS 2016-10-24 15:30:38 +03:00
Alexander Udalov 4c52ce37d2 Drop TargetPlatform in utilities for module creation 2016-10-21 17:10:40 +03:00
Alexander Udalov 56e2173b3c Extract platform-independent default imports to TargetPlatform.Default.defaultImports
This is needed because SourceNavigationHelper uses default platform and it
needs default imports to be able to resolve references (otherwise
NavigateToLibrarySourceTestGenerated breaks)
2016-10-21 17:10:39 +03:00
Alexander Udalov 7b2a80ffa4 Fix incremental recompilation of JvmMultifileClass with top level function
See 53b584f and previous changes where this behavior was broken (this was
untested, however). Fixes EA-90065
2016-10-19 12:50:10 +03:00
Michael Bogdanov 978a4db07b Introduced IR CodegenFactory, added configuration key to enable it 2016-10-18 09:09:35 +03:00
Zalim Bashorov c21e1eb857 Report error when try to use unsupported reflection API in Kotlin JS; allow to use kotlin.Any members on reflection classes for both platforms. 2016-10-14 19:44:58 +03:00
Valentin Kipyatkov 0399772ee6 KT-9835 Completion thinks receiver is nullable when it is not
#KT-9835 Fixed
2016-10-13 15:11:19 +03:00
Valentin Kipyatkov 7b12dd498f KT-13780 No completion and assertion error in log
#KT-13780 Fixed
2016-10-13 15:10:53 +03:00
Alexander Udalov 321a19a247 Make JvmPlatform.defaultImports a stored property
It was incorrectly made a getter-only property in 2f616bdd
2016-10-12 23:30:03 +03:00
Alexander Udalov 2f616bdd33 Drop ModuleParameters, inline defaultImports everywhere 2016-10-12 17:07:09 +03:00
Ilya Chernikov 63c5133167 Remove support for xml-based script configs, other minor refactorings 2016-10-12 15:37:47 +02:00
Alexander Udalov 88af36001c Introduce DeserializationConfiguration
Will be used soon to deliver the language/API-version-related behavior to the
deserialization
2016-10-12 12:19:17 +03:00
Valentin Kipyatkov 147d1da1ed Supported obtaining function type parameter names from KotlinType 2016-10-11 23:38:48 +03:00
Alexander Udalov 2c66d4e59b Move LanguageVersionSettings and JvmTarget to module 'util'
To be used from cli-common in the subsequent commits
2016-10-11 17:30:14 +03:00
Alexander Udalov 6e0e8c6dc3 Pass LanguageVersionSettings instance to isHiddenInResolution
Unused at the moment, will be used later to check if the API version prohibits
the usage of the element
2016-10-11 17:30:12 +03:00
Ilya Gorbunov 4236a4dd07 Farewell, excluded imports from the platform. If anyone ever needs them again, they are buried in this commit. 2016-10-10 20:14:32 +03:00
Ilya Gorbunov 5042158df5 Determine automatically which types from java.lang is aliased in default imported kotlin packages and exclude them from imported java.lang.* scope. 2016-10-10 20:14:32 +03:00