Commit Graph

57669 Commits

Author SHA1 Message Date
Ilmir Usmanov 63f6d515bc JVM_IR: Generate correct invoke of numbered suspend lambda
Instead of continuation type as last parameter's type, generate Object
type.
2019-09-19 19:28:05 +03:00
Ilmir Usmanov 587fcafc85 JVM_IR: Support continuation crossing inline lambda boundaries
I.E. generate fake continuation markers.
2019-09-19 19:28:03 +03:00
Ivan Gavrilovic 0cdfe89a26 KT-33052: Fix KAPT stub generation for enums on JDK11
When using JDK11, generating stubs for enums is broken.
This commit handles the faulty generation by JDK11 by
fully printing enums in custom implementation of tree
printing.

Test: added JDK11 tests for KAPT stub  generation
2019-09-20 00:04:27 +09:00
Ivan Gavrilovic 58efa34a33 KT-31291: KAPT - make sure ASM version is not inlined
Switch to Java reflection when getting the ASM version used
to analyze classes. Using Kotlin reflection resulted in the constant
being inlined.

Fixes KT-31291
Fixes KT-33493
2019-09-20 00:04:27 +09:00
Ivan Gavrilovic 60fa632d02 KT-33515: Remove Kotlin sources generated by KAPT
When KAPT is unable to run incrementally make sure to
clean directory that contains generated Kotlin sources.
This location is specified using '-Akapt.kotlin.generated'
option.
2019-09-20 00:04:27 +09:00
Ivan Gavrilovic 434fb75eb7 Incremental KAPT: when unable to process incremental changes, run non-incrementally
When analyzing incremental changes in the KAPT task, incremental compilation
can handle directory changes, Java source file changes, jar/.class file changes,
and changes to the ABI structure of the classpath. Anything else should cause
a full recompilation.

Test: KaptIncrementalWithIsolatingApt.testNonIncrementalWithUnrecognizedInputs
2019-09-20 00:04:27 +09:00
Ilya Goncharov b59fba6707 Fix mocha run
#KT-33579 fixed
2019-09-19 15:42:49 +03:00
Nicolay Mitropolsky 9d01c87c51 KotlinElementActionsFactory: cleanup JvmElementActionsFactory API (KT-33779) 2019-09-19 10:45:12 +03:00
Vladimir Dolzhenko 3bcbcbfd47 Fix read action in 'processLightClassLocalImplementations' (EA-210464) 2019-09-18 10:44:43 -07:00
Vladimir Dolzhenko 81c9edfff4 Get rid of implicit resolve within statsInfo for KotlinAddImportAction (EA-210670) 2019-09-18 10:43:38 -07:00
Vladimir Dolzhenko 3a1d649b30 Don't trigger refresh of vfs in 'getOutsiderFileOrigin' (EA-209420) 2019-09-18 10:23:34 -07:00
Mads Ager 507857d452 [IR] Support Collection<*>.indices in for loop lowering.
Unmute a couple of tests that are working as intended.
2019-09-18 19:00:17 +02:00
Steven Schäfer 76ab631214 psi2ir: Optimize generated data class members
- Access underlying fields directly, instead of using accessors. This is
  safe since data classes are always final.
- Don't generate a temporary variable in hashCode to use as the
  accumulator.

Both optimizations are effectively present in the current JVM backend
and with these changes the generated code is much closer to what the
current backend generates.
2019-09-18 18:56:42 +02:00
Steven Schäfer 7ccf314808 Minor: Remove dead conditional in psi2ir 2019-09-18 18:56:42 +02:00
Steven Schäfer ce3ef4e4d0 Add more tests for inline class equality with nullable arguments 2019-09-18 18:52:58 +02:00
Steven Schäfer 1833a69c87 JVM: Optimize inline class equality with nullable arguments 2019-09-18 18:52:58 +02:00
Steven Schäfer eda4953cb3 JVM IR: Optimize inline class equality with nullable arguments 2019-09-18 18:52:58 +02:00
Steven Schäfer d8646e29b7 Add additional Result api test 2019-09-18 18:52:58 +02:00
Steven Schäfer 49efa5fbc4 Split up Result API boxing tests 2019-09-18 18:52:58 +02:00
Steven Schäfer 2e53e36fd5 JVM: Do not use equals-impl0 methods generated by older compiler versions 2019-09-18 18:52:58 +02:00
Steven Schäfer b85b2d9af8 Add more tests for inline class equality 2019-09-18 18:52:58 +02:00
Steven Schäfer cdc5e1347b JVM: Avoid boxing in inline class equality 2019-09-18 18:52:58 +02:00
Steven Schäfer f53b28e8a3 JVM: Generate equals-impl0 method for inline classes 2019-09-18 18:52:58 +02:00
Steven Schäfer 2c7da67600 JVM IR: Avoid boxing in inline class equality 2019-09-18 18:52:58 +02:00
Steven Schäfer b85a475358 JVM IR: Generate equals-impl0 method for inline classes 2019-09-18 18:52:58 +02:00
Steven Schäfer e4456127e4 JVM IR: Don't use JS IR specific inlineClasses.kt 2019-09-18 18:52:58 +02:00
Steven Schäfer 475079611d JVM IR: Avoid parameter null-checks in inline class impl methods 2019-09-18 18:52:58 +02:00
Steven Schäfer cdd3f82396 JVM IR: Use correct scope owner in JvmInlineClassLowering 2019-09-18 18:52:58 +02:00
Vladimir Dolzhenko 2afbeaa353 Drop resolve on 'collectTransferableData' and reworked MoveDeclarations QuickFix (EA-210670) 2019-09-18 09:01:09 -07:00
Alexander Udalov 6ef434a711 JVM IR: add -Xir-check-local-names to check names for consistency
Since KotlinTypeMapper is no longer used in the JVM IR backend, we need
not run CodegenBinding.initTrace and check that names of local entities
are exactly equal to local names computed by that algorithm.

However, it's still useful as an opt-in flag, to discover issues where
unwanted elements take part in the naming (such as temporary IR
variables, see for example cb2e68fece). So we introduce a new command
line argument -Xir-check-local-names which, when the IR backend is used
(via -Xuse-ir), launches the name computation algorithm from the old
backend and then compares that the names are exactly equal to the names
computed by the IR backend in InventNamesForLocalClasses.
2019-09-18 17:55:42 +02:00
Alexander Udalov 530c1411c3 Remove IR backend-specific code from KotlinTypeMapper
Add an assertion to check that we don't call mapType anymore in JVM IR.
2019-09-18 17:55:41 +02:00
Vladimir Dolzhenko 3d79e77df3 Add async profiler to perfTests 2019-09-18 08:49:28 -07:00
Ilya Chernikov 0f4176a88e [Pill] Fix pill after refactoring reflect 2019-09-18 14:44:30 +02:00
Alexander Udalov aa77f6c245 Improve KParameter.toString for instance and extension receiver parameter
#KT-17860 Fixed
2019-09-18 14:05:43 +02:00
Alexander Udalov 59186b2617 Psi2ir: ignore unresolved class literals in annotations
Similarly to 38536638, skip annotation arguments that reference classes
which are not found in our compilation classpath.

This fix is especially needed because of the way _nested_ classes are
currently referenced in annotations. Since we don't generate all needed
InnerClasses attributes yet (KT-27936), we can't unambiguously resolve a
reference to a nested class in annotation arguments. This leads to an
ErrorValue loaded in the annotation descriptor. The old backend doesn't
care, since it doesn't look at that annotation or its arguments, but
psi2ir tries to convert all annotation arguments and it crashed with CCE
here, trying to cast IrErrorType to IrSimpleType.
2019-09-18 14:05:28 +02:00
Alexander Udalov c69997491f JVM IR: generate file annotations on file facade classes 2019-09-18 14:05:28 +02:00
Kevin Bierhoff 565099d941 fix new test name 2019-09-18 14:42:32 +03:00
Kevin Bierhoff bc207ed8db fix for KT-29471
#KT-29471 Fixed
2019-09-18 14:42:09 +03:00
Nikolay Krasko 220a8f2872 Clear internal caches in PerModulePackageCacheService on dispose (KT-33802) 2019-09-18 11:30:02 +03:00
Nikolay Krasko 4387862d20 Remap android home directory to allow parallel test execution (KT-33870)
Using same directory for android (user home) leads to exception on Windows
because of file lock:

com.google.gson.JsonSyntaxException: java.io.IOException: The process cannot access the file because another process has locked a portion of the file
at com.google.gson.Gson.fromJson(Gson.java:942)
at com.google.gson.Gson.fromJson(Gson.java:865)
at com.android.tools.analytics.AnalyticsSettings.loadSettingsData(AnalyticsSettings.kt:140)
at com.android.tools.analytics.AnalyticsSettings.initialize(AnalyticsSettings.kt:211)
at org.jetbrains.android.AndroidPlugin.initializeForNonStudio(AndroidPlugin.java:56)
at org.jetbrains.android.AndroidPlugin.initComponent(AndroidPlugin.java:30)
at com.intellij.openapi.components.impl.ComponentManagerImpl$ComponentConfigComponentAdapter.getComponentInstance(ComponentManagerImpl.java:503)
at com.intellij.openapi.components.impl.ComponentManagerImpl.createComponents(ComponentManagerImpl.java:126)
at com.intellij.openapi.application.impl.ApplicationImpl.load(ApplicationImpl.java:411)
at com.intellij.idea.IdeaTestApplication.a(IdeaTestApplication.java:114)
at com.intellij.idea.IdeaTestApplication.getInstance(IdeaTestApplication.java:61)
at com.intellij.idea.IdeaTestApplication.getInstance(IdeaTestApplication.java:54)
at com.intellij.testFramework.LightPlatformTestCase.initApplication(LightPlatformTestCase.java:166)
at com.intellij.testFramework.fixtures.impl.LightIdeaTestFixtureImpl.setUp(LightIdeaTestFixtureImpl.java:41)
at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.lambda$setUp$27(CodeInsightTestFixtureImpl.java:1142)
at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:18)
at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:13)
at com.intellij.testFramework.EdtTestUtilKt.runInEdtAndWait(EdtTestUtil.kt:63)
at com.intellij.testFramework.EdtTestUtil$Companion.runInEdtAndWait(EdtTestUtil.kt:18)
at com.intellij.testFramework.EdtTestUtil.runInEdtAndWait(EdtTestUtil.kt)
at com.intellij.testFramework.fixtures.impl.CodeInsightTestFixtureImpl.setUp(CodeInsightTestFixtureImpl.java:1141)
at com.intellij.testFramework.fixtures.LightJavaCodeInsightFixtureTestCase.setUp(LightJavaCodeInsightFixtureTestCase.java:96)
at org.jetbrains.kotlin.idea.test.KotlinLightCodeInsightFixtureTestCase.setUp(KotlinLightCodeInsightFixtureTestCase.kt:66)
at com.intellij.testFramework.UsefulTestCase.defaultRunBare(UsefulTestCase.java:388)
at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:18)
at com.intellij.testFramework.EdtTestUtil$Companion$runInEdtAndWait$1.invoke(EdtTestUtil.kt:13)
at com.intellij.testFramework.EdtTestUtilKt$runInEdtAndWait$3.run(EdtTestUtil.kt:67)
at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:301)
at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:758)
at java.awt.EventQueue.access$500(EventQueue.java:97)
at java.awt.EventQueue$3.run(EventQueue.java:709)
at java.awt.EventQueue$3.run(EventQueue.java:703)
at java.security.AccessController.doPrivileged(Native Method)
at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(ProtectionDomain.java:74)
at java.awt.EventQueue.dispatchEvent(EventQueue.java:728)
at com.intellij.ide.IdeEventQueue.dispatchEvent(IdeEventQueue.java:433)
at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:205)
at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:116)
at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:105)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:101)
at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:93)
at java.awt.EventDispatchThread.run(EventDispatchThread.java:82)
Caused by: java.io.IOException: The process cannot access the file because another process has locked a portion of the file
at sun.nio.ch.FileDispatcherImpl.read0(Native Method)
at sun.nio.ch.FileDispatcherImpl.read(FileDispatcherImpl.java:61)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:223)
at sun.nio.ch.IOUtil.read(IOUtil.java:197)
at sun.nio.ch.FileChannelImpl.read(FileChannelImpl.java:159)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:65)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:109)
at sun.nio.ch.ChannelInputStream.read(ChannelInputStream.java:103)
at sun.nio.cs.StreamDecoder.readBytes(StreamDecoder.java:284)
at sun.nio.cs.StreamDecoder.implRead(StreamDecoder.java:326)
at sun.nio.cs.StreamDecoder.read(StreamDecoder.java:178)
at java.io.InputStreamReader.read(InputStreamReader.java:184)
at com.google.gson.stream.JsonReader.fillBuffer(JsonReader.java:1295)
at com.google.gson.stream.JsonReader.nextNonWhitespace(JsonReader.java:1333)
at com.google.gson.stream.JsonReader.consumeNonExecutePrefix(JsonReader.java:1576)
at com.google.gson.stream.JsonReader.doPeek(JsonReader.java:534)
at com.google.gson.stream.JsonReader.peek(JsonReader.java:425)
at com.google.gson.Gson.fromJson(Gson.java:923)
... 41 more

#KT-33870 Fixed
2019-09-18 11:30:02 +03:00
Anton Yalyshev dfde3b4076 Rename collector of debugger events 2019-09-18 10:06:45 +03:00
Anton Yalyshev 61eb9faecd Move status of evaluation from eventId to context for better data analytics 2019-09-18 10:06:45 +03:00
Denis Zharkov 2bdbed978b FIR: Support SAM constructors 2019-09-18 10:03:55 +07:00
Denis Zharkov b3e96a1fcf FIR: Merge FirTopLevelDeclaredMemberScope into FirSelfImportingScope
It's strange that those scopes have similar semantics but belong
to different level (that might change semantics a bit)
2019-09-18 10:03:55 +07:00
Denis Zharkov 391346ae46 FIR: Pass BodyResolveComponents to ScopeTowerLevel 2019-09-18 10:03:28 +07:00
Denis Zharkov fb4b6b8290 FIR: Move constructor processing from scopes to tower resolvers 2019-09-18 10:03:28 +07:00
Denis Zharkov 08a8a9fa61 FIR: Move SamResolver to BodyResolveComponents 2019-09-18 10:00:04 +07:00
Denis Zharkov 5ebde93eb9 FIR: Provide BodyResolveComponents instead of InferenceComponents to resolution
It seems to be more reasonable to store SamResolver, ScopeSession
and other per-transformer/per-thread components there
2019-09-18 10:00:04 +07:00
Denis Zharkov 5567620563 FIR: Support SAM conversion 2019-09-18 10:00:04 +07:00
Denis Zharkov f501730d86 Minor. Reformat Arguments.kt in fir 2019-09-18 10:00:04 +07:00