Commit Graph

31843 Commits

Author SHA1 Message Date
Alexander Udalov 76efeb4e14 Remove obsolete assertion about expressions on LHS of '::' 2016-05-26 22:22:41 +03:00
Alexander Udalov da42023dd9 Support new callable reference expressions in UAST
Manually mute the class literal test in apiCheck.kt; support for new class
literal expressions is postponed because it's not straightforward to combine
both unbound (Type::class) and bound (instance::class) class literals in one
UClassLiteralExpression: in Java they're two very different expressions
(Type.class and instance.getClass())
2016-05-26 22:22:41 +03:00
Alexander Udalov ca76e4d426 Support new double colon expressions in IDE code 2016-05-26 22:22:41 +03:00
Alexander Udalov a3b38cf6ed Extract method to fully or partially resolve callable reference
Reuse it in the main type-checking path in DoubleColonExpressionResolver, as
well as in ArgumentTypeResolver which handles the case when a callable
reference appears as an argument to another call
2016-05-26 22:22:41 +03:00
Alexander Udalov 693c753988 Support for new double colon expressions in type checker
Despite the fact that the LHS of a double colon expression is now KtExpression
instead of KtUserType, we must still consider it a type for callable references
to work. Extract and reuse relevant parts of QualifiedExpressionResolver and
TypeResolver to support this behavior
2016-05-26 22:22:41 +03:00
Alexander Udalov b5388d6a43 Parse expressions on LHS of '::'
See https://github.com/Kotlin/KEEP/issues/5
2016-05-26 22:22:41 +03:00
Alexander Udalov 7cb61b81ab Minor, capitalize language feature names in tests
To simplify textual search across the codebase
2016-05-26 22:21:22 +03:00
Pavel V. Talanov 76971eca70 Refactor LanguageFeatureSettings: Add LanguageVersion and LanguageFeature entities 2016-05-26 22:16:47 +03:00
Alexander Udalov 9bdf8f1082 Minor, update javac2 annotation filter for kotlin-build-common-test 2016-05-26 22:15:39 +03:00
Alexander Udalov 2c516f18a0 Add tests on "-language-version" usage from Ant, Maven, Gradle 2016-05-26 22:15:39 +03:00
Alexander Udalov bc5202a4d7 Validate "-language-version" argument value, add tests 2016-05-26 22:15:39 +03:00
Alexander Udalov 331a6ee414 Use LanguageFeatureSettings instead of JVM option for top level sealed classes 2016-05-26 22:15:39 +03:00
Alexander Udalov 98c3e030a1 Support enabling/disabling language features in diagnostic tests 2016-05-26 22:15:39 +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
Alexey Sedunov ec0f21c887 Spring Support: Fixed rename of custom-named beans specified with Kotlin annotation
#KT-12096 Fixed
2016-05-26 20:59:09 +03:00
Alexey Sedunov 076e31c0f8 Spring Support: Automatic configuration by @Import and @ComponentScan ("basePackages"/"basePackageClasses")
#KT-12135 Fixed
 #KT-12139 Fixed
2016-05-26 20:59:07 +03:00
Alexey Sedunov 781a1e0694 Spring Support: Implement @ComponentScan inspection
#KT-12465 Fixed
2016-05-26 20:59:05 +03:00
Alexey Sedunov d69140b7fe Code Insight: Implement package references inside of string literals
#KT-12136 In Progress
2016-05-26 20:59:03 +03:00
Alexey Sedunov d52e62b20d Light Classes: Consider FakeFileForLightClass instances equivalent if they correspond to the light classes with common KtFile
#KT-12117 Fixed
2016-05-26 20:59:01 +03:00
Alexander Udalov 9a762e0fa2 Prevent META-INF/INDEX.LIST from jsr166e.jar to be packed into compiler
INDEX.LIST contains a list of jars with the information about what packages
does each of those jars have (this feature is called JarIndex, see
http://docs.oracle.com/javase/7/docs/technotes/guides/jar/jar.html). In case of
ideaSDK/core/jsr166e.jar, it only has one entry -- jsr166e.jar itself. When the
compiler is started, the class loading mechanism reads this file and assumes
that there are no other jars nearby. But the compiler depends on other jars,
namely kotlin-runtime.jar and kotlin-reflect.jar, thus we get
ClassNotFoundException when trying to load almost any Kotlin bytecode from
kotlin-compiler.jar.

Note that, fortunately, release builds are not affected because:
1) proguard helpfully strips this file from the final kotlin-compiler.jar;
2) we use a custom class loader (Preloader) which ignores JarIndex.
This only affects local setup with proguard disabled, where one test
(CompilerDaemonTest) was failing because it was trying to invoke the compiler
directly via "java -jar ..."

To implement this, it was necessary to exclude this one file from the compiler
jar, however the "zipgroupfileset" Ant task does not support exclusion of one
file from a particular archive, so we pack all idea core libraries into one jar
beforehand and use "zipfileset" which supports exclusion of one file
(http://stackoverflow.com/a/2426245/288456).

(cherry picked from commit c3f1afee626502470dbe27a1343c777e5cade789)
2016-05-26 14:14:41 +03:00
Alexander Udalov e5d64d316d Fix kotlin-maven-plugin compilation 2016-05-26 14:14:17 +03:00
Alexander Udalov d89e907f00 Minor, comment out ignored test 2016-05-26 11:48:00 +03:00
Alexander Udalov 159d88102f Use MODULE_NAME configuration key in JS instead of MODULE_ID 2016-05-26 11:47:30 +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 6674412079 Rename compilerConfigurationForTests -> newConfiguration 2016-05-26 11:47:30 +03:00
Alexander Udalov d04624cfe9 Minor, refactor KotlinToJVMBytecodeCompiler#compileModules 2016-05-26 11:47:30 +03:00
Alexander Udalov cad4b6973c Introduce and use JSConfigurationKeys similar to JVMConfigurationKeys
Use type-safe keys in CompilerConfiguration instead of multiple parameters,
duplicated in the base class (JsConfig), derived class (LibrarySourcesConfig)
and its builder (LibrarySourcesConfig.Builder)
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 6889bdbef8 Add CompilerConfiguration to JsConfig
Will be used to store common compiler options (such as source version, inline
disabled, etc) as well as JS-specific options, to unify the logic of compiler
option initialization between JS and JVM compilers
2016-05-26 11:47:30 +03:00
Alexander Udalov 116e4a5ced Rename Config -> JsConfig 2016-05-26 11:47:30 +03:00
Alexander Udalov 2bd3211ba8 Get rid of unnecessary exceptions in JS translator
Before this commit, an internal error during JS translation resulted in the
actual exception wrapped in TranslationRuntimeException wrapped in
TranslationInternalException wrapped in RuntimeException being thrown. This
change gets rid of the two latter wrappings.

Also delete unthrown MainFunctionNotFoundException and related unused
constructors in TranslationException
2016-05-26 11:47:30 +03:00
Alexander Udalov 9418311bda Pass CompilerConfiguration to CLICompiler#doExecute
Extract common CompilerConfiguration setup code to a separate method
2016-05-26 11:47:30 +03:00
Alexander Udalov 3c81bb4bfc Add MessageCollector#hasErrors, get rid of MessageSeverityCollector
Also fix duplicated wrapping of a message collector into a message severity
collector (in CLICompiler and in the beginning of doExecute in
K2JVMCompiler/K2JSCompiler)
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 69343549b7 Move TEST_MODULE_NAME to KotlinTestUtils and change value to "test-module"
This name is more generic and thus can be used everywhere, not only in Java
integration tests
2016-05-26 11:47:30 +03:00
Alexander Udalov 3ca77de924 Remove traces of old compiler plugin architecture
It was retired with the deprecation and subsequent removal of the old KDoc, and
is now unused
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
Alexander Udalov 8c0f78db50 Introduce CompilerConfiguration#getNotNull and getBoolean
To reduce boilerplate at call sites
2016-05-26 11:47:30 +03:00
Alexander Udalov 81a0fa5f47 Minor, fix warnings and improve style in KotlinToJVMBytecodeCompiler 2016-05-26 11:47:30 +03:00
Dmitry Jemerov 495a3e9432 cleanup after code review 2016-05-25 21:05:59 +02:00
Dmitry Jemerov b37ac4f783 fix PsiCheckerTestGenerated according to removed "property with backing field" highlighting 2016-05-25 20:10:01 +02:00
Dmitry Jemerov 14559bfae0 inherit Kotlin TYPE_PARAMETER from Java TYPE_PARAMETER
#KT-11465 Fixed
2016-05-25 20:00:49 +02:00
Dmitry Jemerov 76178c531e specify base color for ANNOTATION and LABEL
#KT-9410 Fixed
2016-05-25 20:00:49 +02:00
Dmitry Jemerov 49335fa6eb highlight infix function calls
#KT-6540 Fixed
2016-05-25 20:00:49 +02:00
Dmitry Jemerov a448af5d17 remove CLASS highlight on top of CONSTRUCTOR_CALL for constructor calls
#KT-2919 Fixed
2016-05-25 20:00:49 +02:00
Dmitry Jemerov e7cb256e81 TypeKindHighlightingVisitor: J2K 2016-05-25 20:00:49 +02:00
Dmitry Jemerov e07e16abf6 TypeKindHighlightingVisitor: rename to .kt 2016-05-25 20:00:49 +02:00
Dmitry Jemerov e9cefd9ece remove PARAMETER highlight on top of INSTANCE_PROPERTY for primary constructor parameters 2016-05-25 20:00:49 +02:00
Dmitry Jemerov b51637d49f remove LOCAL_VARIABLE highlight on top of BACKING_FIELD_VARIABLE 2016-05-25 20:00:49 +02:00
Dmitry Jemerov 4261e4a5cc VariablesHighlightingVisitor: cleanup after J2K 2016-05-25 20:00:49 +02:00