Commit Graph

3045 Commits

Author SHA1 Message Date
Pavel V. Talanov d5b486eb80 Refactor LazyClassDescriptor and minor changes
Minor: get script definition once
Refactor: get rid of 'LazyClassDescriptor#getInjectedSupertypes'
Minor: rename scope
2016-06-07 21:13:03 +02:00
Ilya Chernikov 478ae96e50 Implement a compiler config key to add preconfigured extra imports for scripts 2016-06-07 21:13:01 +02:00
Ilya Chernikov 3e6616de42 Read script config if appropriate flag is specified, fix classpath handling 2016-06-07 21:12:58 +02:00
Ilya Chernikov 9ed8dec9fb Make a marker interface to allow ScriptDependenciesClassFilter to be used in the resolving 2016-06-07 21:12:55 +02:00
Ilya Chernikov 5c37017484 Prepare infrastruct for fixing customized script resolving
Move ConfigManager and ClassFinder to the idea-analysis
 Add (back) IndexableSetContributor
 Add a method in ConfigManager to generate all dependencies scope
 Add and use delegating scope with possibility to get base scope from it (used in the class finder)
2016-06-07 21:12:54 +02:00
Alexey Sedunov 96132fa61a Rename: @JvmName support
#KT-8044 Fixed
 #KT-9432 Fixed
2016-06-02 15:28:27 +03:00
Pavel V. Talanov 76971eca70 Refactor LanguageFeatureSettings: Add LanguageVersion and LanguageFeature entities 2016-05-26 22:16:47 +03:00
Alexander Udalov e1ba4480d7 Support "-language-version" CLI option for compatibility with older releases
Introduce LanguageFeatureSettings, instance of which should be injected by the
container and be accessible everywhere during the compilation (front-end and
back-end).

Parameters of LanguageFeatureSettings are unused in this commit, will be used
later
2016-05-26 22:15:39 +03:00
Alexander Udalov 05f8836f46 Move some configuration keys to JVM or to CommonConfigurationKeys
Move CONTENT_ROOTS and SCRIPT_DEFINITIONS_KEY to JVMConfigurationKeys because
they are only used on JVM, rename the latter to SCRIPT_DEFINITIONS.

Move MODULE_NAME to CommonConfigurationKeys to be combined with MODULE_ID in
JSConfigurationKeys in the future
2016-05-26 11:47:30 +03:00
Alexander Udalov b65980f3b7 Drop JsConfig#inlineEnabled flag
Use CommonConfigurationKeys#DISABLE_INLINE flag (moved from
JVMConfigurationKeys) in CompilerConfiguration instead, similarly to the JVM
compiler
2016-05-26 11:47:30 +03:00
Alexander Udalov c5e2f55ea7 Get rid of getModuleName(), pass configuration to createContextWithSealedModule
Add KotlinTestUtils.newConfiguration() which creates a configuration and sets
the module name to the default test one ("test-module")
2016-05-26 11:47:30 +03:00
Alexander Udalov 0fe39a186e Simplify public methods of KotlinToJVMBytecodeCompiler
Pass as much as possible in the single CompilerConfiguration instance instead
of in separate function parameters. Add corresponding keys to
JVMConfigurationKeys.

Re changes in compileModules: since output directory (stored now under the key
OUTPUT_DIRECTORY) is different for each module, the configuration of the whole
project is no longer applicable when compiling individual modules. Thus we copy
the project configuration for each module and add the output directory value
2016-05-26 11:47:30 +03:00
Pavel V. Talanov 5058e9b4e6 Fix import resolution in Repl
#KT-11428 Fixed

 Refactor ReplState to be a component
2016-05-24 15:41:56 +03:00
Alexander Udalov b9fb6c0d84 Remove dangerous readKotlinHeader() in inlineUtil.kt
It was creating a phantom FileBasedKotlinClass which was not based on any file
2016-05-23 20:00:50 +03:00
Alexander Udalov 1492c71e88 Refactor old test utility in LoadDescriptorUtil
Also make USE_TYPE_TABLE a flag in CompilerConfiguration instead of an extra
boolean parameter in numerous methods
2016-05-23 14:47:00 +03:00
Alexander Udalov a85e98a078 Minor, inline unnecessary method of TopDownAnalyzerFacadeForJVM
The TopDownAnalysisMode parameter was TopLevelDeclarations everywhere
2016-05-23 14:47:00 +03:00
Alexander Udalov 6d6488e795 Pass CompilerConfiguration to TopDownAnalyzerFacadeForJVM
In most cases, the configuration can be loaded from KotlinCoreEnvironment. In
other cases, such as IDE tests, there's no environment, so we pass EMPTY. Since
currently the configuration is only used to load incremental compilation
components and module information, it's fine to pass EMPTY
2016-05-23 14:47:00 +03:00
Alexander Udalov 6c0ff40197 Move JVMConfigurationKeys to frontend.java
Similarly to K2JVMCompilerArguments, they will soon be needed in the IDE code.
Move COMPILER_JAR_LOCATOR to CLIConfigurationKeys because it's used both in JVM
and JS, and only in CLI. Other keys, non-relevant in the IDE, may be moved out
soon as well, such as incremental compilation components
2016-05-23 14:47:00 +03:00
Dmitry Petrov 59472927cd KT-11588 Type aliases
Light class generation: do not fail on type aliases
TODO: actual binary representation for type aliases
2016-05-20 14:17:24 +03:00
Stanislav Erokhin 8c2d68fff0 Refactoring. Move specificity relations into TypeSpecificityComparator component. 2016-05-20 09:32:53 +03:00
Denis Zharkov ef940ab0df Add new 'HiddenInResolution' kind
It's used to hide additional built-ins members loaded from JDK
Such methods can be overridden and called only with 'super'-receiver
2016-05-16 15:38:13 +03:00
Denis Zharkov 1501a042e9 Add possibility to add annotations when building FunctionDescriptor copy
It's being used in next commits to add Deprecated annotation
to unknown additional built-ins members
2016-05-16 15:38:13 +03:00
Alexander Udalov d85884426e Minor optimization of lookup tracker records 2016-04-29 15:21:26 +03:00
Valentin Kipyatkov b551886889 Code cleanup: removed redundant semicolons 2016-04-29 11:26:25 +03:00
Stanislav Erokhin 5fe48313e9 Refactoring. Merge CustomSubstitutionCapability, CustomFlexibleRendering and RawTypeTag into RawTypeCapability. 2016-04-27 14:13:58 +03:00
Denis Zharkov 5bc5722051 Load additional JDK functions into built-ins member scope
#KT-5990 Fixed
 #KT-7127 Fixed
 #KT-10370 Fixed
2016-04-25 17:41:08 +03:00
Denis Zharkov f104be16cf Minor. Keep substitution in CopyConfiguration instead of originalSubstitutor 2016-04-25 17:41:08 +03:00
Denis Zharkov 5bf39689e9 Replace irrelevant usages of JvmBuiltIns.Instance with DefaultBuiltIns.Instance 2016-04-25 17:41:08 +03:00
Denis Zharkov c667f50741 Delete TargetPlatform.builtins
Replace it's usages with relevant singleton reference
2016-04-25 17:41:08 +03:00
Denis Zharkov ef18d64931 Parametrize module creation by platform with built-ins 2016-04-25 17:41:08 +03:00
Denis Zharkov c4a899d9a4 Get rid of some targetPlatform.builtIns usages
Retrieve builtIns from module itself when adding dependencies on them
2016-04-25 17:41:08 +03:00
Stanislav Erokhin a1d052b8fa Refactoring. Remove FlexibleTypeFactory.DEFAULT and refactor flexible type creation by special fq-name for tests. 2016-04-25 15:28:46 +03:00
Stanislav Erokhin 0a4ad3f267 Refactoring. Rename FlexibleTypeCapabilities -> FlexibleTypeFactory. Also use factory.create instead of DelegatingFlexibleType.create. 2016-04-25 15:28:46 +03:00
Alexander Udalov ad068ed4ac Do not call findKotlinClass when loading class annotations
The main change is in AbstractBinaryClassAnnotationAndConstantLoader, where we
no longer perform unnecessary IO operations for classes which are already
loaded to memory
2016-04-14 21:08:36 +03:00
Alexander Udalov 2ab68d53fa J2K KotlinJvmBinaryClass & AnnotationAndConstantLoader: convert 2016-04-14 21:08:36 +03:00
Alexander Udalov 8ace253559 Minor, remove paragraph symbols from comments
This character seems to cause problems on some build agents
2016-04-11 16:11:25 +03:00
Dmitry Petrov db58ebc4b2 KT-11410: Class hierarchy for parts/facade of multi-file class.
Preserve static initialization semantics for parts by introducing a special "clinit trigger" class.
Insert "static initialization trigger" call to every method of a part class, remove this call on inline.
Always mangle names for private functions in multifile class parts to avoid resolution clashes on inheritance.

NB in codegen tests initializers for all non-const vals are wrapped in 'run { ... }',
so that the initializer is not a constant expression, and some static initialization code should be generated.
2016-04-01 10:13:22 +03:00
Pavel V. Talanov d7dc122298 KT-11721 Wrong "Typechecker has run into recursive problem" on calling kotlin get function as synthetic property
#KT-11721 Fixed
2016-03-31 19:33:04 +03:00
Denis Zharkov 1511a03027 Fix SAM adapters substitution
Approximate sourceFunction types if it's needed

 #KT-11696 Fixed
2016-03-31 14:52:12 +03:00
Denis Zharkov bc1b34a989 Add additional visibility check for synthetic extensions
Use extension receiver as dispatch one, because it is effectively dispatch
(after some desugaring)
2016-03-31 14:51:57 +03:00
Denis Zharkov 182b349492 Clarify Visibility.isVisible contract for null as receiverValue
See comment
2016-03-31 14:51:57 +03:00
Alexander Udalov 8316953259 Fix double quotes in diagnostic messages
For diagnostics without any parameters, the given text is simply rendered as a
String, so no symbols should be escaped.

For diagnostics with parameters, the format in java.text.MessageFormat is used,
so one single quote is erased and two single quotes become one single quote in
the rendered text.
2016-03-30 21:41:43 +03:00
Alexander Udalov a8bebeb48d Load annotations of const properties from multifile classes
Rework backing field generation logic in PropertyCodegen to switch the
ClassBuilder instance for a multifile part to that of the corresponding facade
class. This became needed because multifile parts, and their metadata, are
generated _before_ the multifile facade class and otherwise we would never
record that there's a synthetic '$annotations' method for a const val and would
not write that to the protobuf message for the property.

See also bad83200

 #KT-10892 Fixed
2016-03-28 21:11:14 +03:00
Alexander Udalov d62535c388 Minor, drop unnecessary workaround of obsolete issue 2016-03-28 14:14:56 +03:00
Alexander Udalov e915e1548c Fix multiple 'unresolved java classifier' errors
Use the same component (NotFoundClasses) as in loading of compiled Kotlin
symbols.

Some tests were changed to avoid a diagnostic that is now reported when a
non-found class is encountered in a signature (e.g. staticMethod.1.java where
JDK seems to be not configured)

 #KT-10493 Fixed
 #KT-10820 Fixed
 #KT-11368 Fixed
2016-03-28 14:13:59 +03:00
Alexander Udalov db5e00bcc0 Report error if some deserialized classes are missing in dependencies
Technically we often can compile code which uses missing classes (as long as
nothing is called on them) but it seems better to let the user know something's
wrong in their setup before the error manifests itself at runtime. Also the
Java compiler does the same

 #KT-4328 Fixed
2016-03-28 14:13:59 +03:00
Alexander Udalov 3944d56ac2 Minor, remove unnecessary type parameter in CallChecker#check 2016-03-28 14:13:59 +03:00
Nikolay Krasko 00239914fa Minor: refactoring 2016-03-25 14:10:41 +03:00
Ilya Gorbunov 1ae0040ca3 Minor: make variables initialized in defineClass lateinit instead of nullable. 2016-03-21 18:37:27 +03:00
Natalia Ukhorskaya 589d7007fc Skip additional visibility check for java classes in debug mode 2016-03-18 15:19:03 +03:00