Commit Graph

25155 Commits

Author SHA1 Message Date
Alexander Udalov f7fc5d2ffa Fix codegen for JvmOverloads with more than 32 parameters
Use DefaultCallArgs to handle mask list construction correctly

 #KT-31070 Fixed
2019-07-09 19:31:59 +02:00
Alexander Udalov a6be6f4986 Use Class.forName instead of ClassLoader.loadClass in reflection
This fixes an issue in constructing annotation instances with array
class elements. For some reason, behavior of `ClassLoader.loadClass`
differs from `Class.forName` in handling arrays, namely:

* `loadClass("[Ltest.Foo;")` returns null
* `Class.forName("[Ltest.Foo;")` returns class for array of test.Foo

Overall, there doesn't seem to be any way to load an array class with
`CLassLoader.loadClass`.

We pass initialize=false to forName because this is the behavior of
ClassLoader.loadClass: it doesn't perform class initialization (e.g.
<clinit> is not executed).

 #KT-31318 Fixed
2019-07-09 18:14:45 +02:00
Alexander Udalov dabb7bb496 Fix new inference CLI tests on Windows 2019-07-09 11:52:54 +02:00
Mikhael Bogdanov b82c32a807 Use default target for android tests 2019-07-09 09:46:34 +02:00
Roman Artemev d9c6d38715 [JS IR BE] Fix private members lowering
- visit over file instead of class
2019-07-09 10:40:01 +03:00
Ilya Gorbunov 7573fcde53 Demote new experimental capitalize overloads in overload resolution
Revert "Fix method reference ambiguity in test after introducing 'capitalize' overload"
This reverts commit fe9bd9ee
2019-07-09 03:39:25 +03:00
Steven Schäfer da8fb3a195 JVM_IR: Respect -Xno-param-assertions 2019-07-08 17:48:33 +02:00
Steven Schäfer dd20b74030 Split GenerateNotNullAssertionsTests into standard box and bytecode tests 2019-07-08 17:48:33 +02:00
Simon Ogorodnik dfd0042a5b Do not create single element list if only one candidate 2019-07-08 16:59:50 +03:00
Mikhail Glukhikh f434248cb7 FIR property getter: take return type from property even if it's error 2019-07-08 16:59:45 +03:00
Mikhail Glukhikh d96c66adac FIR: partially implement invoke resolution 2019-07-08 16:59:37 +03:00
Yan Zhulanow 36e1149e51 Light classes: Fix getTextOffset() and getTextRange() for property accessors
Before this commit, getTextOffset() and getTextRange() coming from the super class, returned numbers for the property, not for its accessor. This commit fixes the inconsistency.
2019-07-08 16:25:20 +09:00
Yan Zhulanow 7078302e6c Light classes: Fix getTextOffset() for identifiers
Before this commit, getTextOffset() and getTextRange() implementations were inconsistent.
2019-07-08 16:25:19 +09:00
Yan Zhulanow d45bbaabcd Debugger: Fix missing NOPs in optimized Unit.INSTANCE calls (KT-31702) 2019-07-08 16:25:19 +09:00
Jiaxiang Chen 2c102ecd57 Replicate old backend's naming logic for captured receiver parameter and extension receiver parameters.
Context for determine if a value parameter is captured from outer
context is not directly available after lowering, hence introduce a new
IrDeclarationOrigin for captured receiver parameter to avoid duplicate
calculation.
2019-07-08 16:25:18 +09:00
Yan Zhulanow 9760c156a4 Debugger: Fix breakpoints on if/loops with constant conditions (KT-14421) 2019-07-08 16:25:18 +09:00
Yan Zhulanow 6686ed2e38 Evaluator: Do not report parsing error on empty block/expression (KT-11938) 2019-07-08 16:25:18 +09:00
Yan Zhulanow 188ed82081 Debugger: Handle closure receivers came from outer callables properly (KT-31709) 2019-07-08 16:25:17 +09:00
Yan Zhulanow 54f78a2920 Debugger: Remove debugger-related hacks in resolution
Candidate ordering should be the same in ordinary Kotlin code and in evaluated expressions.
With the invention of 'foo_field' syntax, there is no need to do these nasty things any more.
2019-07-08 16:25:16 +09:00
Yan Zhulanow b4f515a436 Debugger: Support Kotlin variables for inlined lambdas inside inline functions (KT-31418) 2019-07-08 16:25:16 +09:00
Yan Zhulanow 9c9d2b5ad4 Minor: Rename constant to match its meaning 2019-07-08 16:25:16 +09:00
Yan Zhulanow 5777592024 Debugger: Support captured values (KT-30740) 2019-07-08 16:25:15 +09:00
Mikhail Zarechenskiy 6eefea6715 Add tests for obsolete issues
#KT-32395 Obsolete (fixed in 42a5c488)
 #KT-32388 Obsolete (fixed in f3e4c9cd)
 #KT-32271 Obsolete (fixed in 60a0cf1)
2019-07-06 10:06:04 +03:00
Svyatoslav Kuzmich 675f01ee80 [JS IR BE] Set Throwable subtype name in extendThrowable function 2019-07-05 19:31:23 +03:00
Ilya Chernikov cfceeb1e8c Implement direct bindings to script properties mapping in the JSR-223 implementation
fix infrastructure and codegen parts
2019-07-05 17:02:10 +02:00
Alexander Udalov 37002748c8 Do not wrap and display cause's message in compiler exceptions
In case the wrapped exception message contains some long text (bytecode,
IR, etc.), it could be displayed several times in the same stack trace,
which significantly worsened the experience of parsing such stack traces
2019-07-05 15:55:01 +02:00
Dmitry Gridin 430aed6559 Minor: clean up code 2019-07-05 19:28:02 +07:00
Toshiaki Kameyama 1f89c0f730 "Convert to sealed class" intention: don't suggest when no "class" keyword
#KT-32365 Fixed
2019-07-05 19:28:02 +07:00
Nikolay Krasko 0b8f35c04d Revert "Register mock injection language manager in compiler"
This reverts commit 674badc6

Since idea 192.5587.17 idea has own InjectedLanguageManager registration
and fails because of duplicate.

org.junit.ComparisonFailure: exception: org.picocontainer.defaults.DuplicateComponentKeyRegistrationException: Key com.intellij.lang.injection.InjectedLanguageManager duplicated
	at com.intellij.util.pico.DefaultPicoContainer.registerComponent(DefaultPicoContainer.java:123)
	at com.intellij.util.pico.DefaultPicoContainer.registerComponentInstance(DefaultPicoContainer.java:331)
	at com.intellij.mock.MockComponentManager.registerService(MockComponentManager.java:89)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreEnvironment$ProjectEnvironment.registerJavaPsiFacade(KotlinCoreEnvironment.kt:162)
	at com.intellij.core.JavaCoreProjectEnvironment.<init>(JavaCoreProjectEnvironment.java:55)
	at org.jetbrains.kotlin.cli.jvm.compiler.KotlinCoreProjectEnvironment.<init>(KotlinCoreProjectEnvironment.kt:27)
	...
2019-07-05 09:08:15 +03:00
Roman Artemev 8a569cc698 [JS IR BE] Do not create $default stub for external function and any its fake override 2019-07-04 22:59:12 +03:00
Roman Artemev 28a108a205 [JS IR BE] Visit callable reference members in private member lowering 2019-07-04 22:59:12 +03:00
Roman Artemev b4c68025a7 [JS IR BE] Improve error reporting 2019-07-04 22:59:12 +03:00
Svyatoslav Kuzmich 94aebd0101 [JS IR BE] Proper support for String and Any constructors
Remove workarounds from codegen
2019-07-04 17:03:47 +03:00
Roman Artemev d7cb3e05ef [JS IR BE] Replace 32bit default String.hashcode with 64bit cityhash for UniqID
Split uniqID space into two part 63 bit each.
2019-07-04 12:49:30 +03:00
Svyatoslav Kuzmich 631a09e541 [JS IR BE] ThrowableLowering: Use dynamic operators instead of jsSetJSField intrinsic 2019-07-03 20:37:49 +03:00
Svyatoslav Kuzmich 871180cdc0 [JS IR BE] Fix setting names of Throwable subclasses without primary constructor 2019-07-03 20:37:49 +03:00
Svyatoslav Kuzmich 918d470e1b [JS IR BE] Simplify throwable lowering.
- Make kotlin.Throwable class extenral
- Add runtime function 'extendThrowable' to use instead of delegating
  constructors to Throwable
2019-07-03 20:37:48 +03:00
Svyatoslav Kuzmich 6d1f893a5a [JS IR BE] Move object instance creation lowerings to IR 2019-07-03 20:37:48 +03:00
Svyatoslav Kuzmich 5dcb0ee016 [JS IR BE] Reduce JsScope usage in codegen 2019-07-03 20:37:48 +03:00
Jeffrey van Gogh a9c8fd903b reduce calls to Object.hashCode originating from LabelNormailizationMethodTransformer
Building on the work in #2403, shaves 1% of compilation time on kotlinx.serialization
by using SmartIdentityTable instead of hashMap in LabelNormailizationMethodTransformer.

Metrics on the prior hashMap use in this code:

| What      | Count |
| --------- | ----- |
| instances | 21530 |
| min       | 0     |
| max       | 174   |
| mean      | 4     |
| stddev    | 8.24  |
| median    | 4     |
| 90p       | 8     |
| 95p       | 15    |
2019-07-03 19:25:57 +02:00
Alexander Udalov 361c468c33 IR: move type utilities from IrTypeUtils.kt to irTypePredicates.kt
Multiple IrType extensions were incorrectly calling isNameInPackage
which actually checked if the name of the type's classifier _starts_
with the given string, not equals it. Move them to irTypePredicates,
which seems a more natural place for these extensions anyway. Move
isKClassArray to JVM backend utilities, since this is JVM-specific
behavior at the moment. Fix minor warnings/inspections
2019-07-03 19:10:03 +02:00
Andrey Uskov e079615cdf Add possibility to edit target platform for non-HMPP projects in order to keep ability to edit target platform for IDEA-based projects 2019-07-02 22:46:48 +03:00
Andrey Uskov 9fc60be9d8 Fix serialization of facet settings in order to read properly
settings of native platforms
2019-07-02 22:46:47 +03:00
Nikolay Krasko 4f678c8289 Create project service with Kotlin trackers (KT-32364) 2019-07-02 13:59:19 +03:00
Nikolay Krasko 263d8eea16 Use Kotlin oocb instead of platform oocb tracker (KT-32364) 2019-07-02 13:59:06 +03:00
Nikolay Krasko 12bb1a5bd1 Make invalidateOnOOCB explicit in ResolverForProjectImpl and remove usage in tests 2019-07-02 13:45:35 +03:00
Svyatoslav Kuzmich 69962cbf8c [JS IR BE] Add JsExport annotations 2019-07-01 18:55:41 +03:00
Svyatoslav Kuzmich 685597d20a [JS IR BE] Codegen class model refactorings
Reduce JsScope usage
2019-07-01 18:55:41 +03:00
Steven Schäfer e7a5e5b4a0 JVM_IR: Handle annotation KClass fields in external declarations 2019-07-01 16:16:23 +02:00
Steven Schäfer 1ab0b76af3 Minor: use more descriptive argument name 2019-07-01 15:49:12 +02:00